This repository was archived by the owner on Mar 28, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments