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

Commit be1de4c

Browse files
Add regression test for DAE and separate compile (#970)
1 parent f05f8e0 commit be1de4c

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// There was an issue with dead argument elminitaion optimization, which lead
2+
// to runtime errors when setting kernel arguments if the app was compiled with
3+
// optimizations, but linked without them.
4+
//
5+
// The test checks that the scenario works correctly.
6+
//
7+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -O2 -c -o %t.o
8+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %t.o -O0 -o %t.out
9+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
10+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
11+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
12+
13+
#include <iostream>
14+
#include <sycl/sycl.hpp>
15+
16+
int main() {
17+
constexpr int THE_ANSWER = 42;
18+
19+
sycl::queue q;
20+
21+
int storage;
22+
int storage2;
23+
{
24+
sycl::buffer buf(&storage, sycl::range<1>(1));
25+
sycl::buffer buf2(&storage2, sycl::range<1>(1));
26+
27+
q.submit([&](sycl::handler &h) {
28+
auto acc = buf.get_access(h);
29+
auto acc2 = buf2.get_access(h);
30+
h.single_task([=]() {
31+
(void)acc; // unused
32+
acc2[0] = THE_ANSWER;
33+
});
34+
});
35+
}
36+
37+
return storage2 != THE_ANSWER;
38+
}

0 commit comments

Comments
 (0)