Skip to content

Commit bf026c2

Browse files
committed
[SYCL] Add regression test for 0-size local accessors
This tests intel/llvm#6032. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 1de20a0 commit bf026c2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2+
// RUN: %HOST_RUN_PLACEHOLDER %t.out
3+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
4+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
5+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
6+
7+
//==---- zero_size_local_accessor.cpp - SYCL 0-size local accessor test ----==//
8+
//
9+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
10+
// See https://llvm.org/LICENSE.txt for license information.
11+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
#include <CL/sycl.hpp>
16+
17+
int main() {
18+
sycl::queue Q;
19+
Q.submit([&](sycl::handler &CGH) {
20+
sycl::accessor<uint8_t, 1, sycl::access_mode::read_write,
21+
sycl::access::target::local>
22+
ZeroSizeLocalAcc(sycl::range<1>(0), CGH);
23+
CGH.single_task([=]() {
24+
if (ZeroSizeLocalAcc.get_range()[0])
25+
ZeroSizeLocalAcc[0] = 1;
26+
});
27+
}).wait();
28+
return 0;
29+
}

0 commit comments

Comments
 (0)