Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 5f729d1

Browse files
[SYCL] Add regression test for spec constants & debug info (#307)
1 parent 1d6a703 commit 5f729d1

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 -g %s -o %t.out
2+
// RUN: %clangxx -fsycl -g -O0 %s -o %t.out
3+
// RUN: %clangxx -fsycl -g -O2 %s -o %t.out
4+
//
5+
// The idea of this test is to make sure that we can compile the following
6+
// simple example without crashes/assertions firing at llvm-spirv step due to
7+
// debug info corrupted by sycl-post-link
8+
9+
#include <sycl/sycl.hpp>
10+
11+
constexpr sycl::specialization_id<int> test_id_1{42};
12+
13+
int main() {
14+
15+
sycl::queue q;
16+
{
17+
sycl::buffer<double, 1> Buf{sycl::range{1}};
18+
q.submit([&](sycl::handler &cgh) {
19+
auto Acc = Buf.get_access<sycl::access::mode::read_write>(cgh);
20+
cgh.set_specialization_constant<test_id_1>(1);
21+
cgh.single_task<class Kernel1>([=](sycl::kernel_handler kh) {
22+
Acc[0] = kh.get_specialization_constant<test_id_1>();
23+
});
24+
});
25+
auto Acc = Buf.get_access<sycl::access::mode::read>();
26+
assert(Acc[0] == 1);
27+
}
28+
return 0;
29+
}

0 commit comments

Comments
 (0)