File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
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
+
6
+ // UNSUPPORTED: cuda
7
+
8
+ #include < CL/sycl.hpp>
9
+ #include < stdlib.h>
10
+
11
+ int main () {
12
+ sycl::device dev{sycl::default_selector{}};
13
+ sycl::queue q{dev};
14
+
15
+ int *x = sycl::malloc_shared<int >(1 , q);
16
+ int *y = sycl::malloc_shared<int >(1 , q);
17
+ *x = 0 ;
18
+ *y = 0 ;
19
+
20
+ q.single_task <class kernel1 >([=] { *x = 1 ; });
21
+
22
+ q.submit_barrier ();
23
+
24
+ q.single_task <class kernel2 >([=] {
25
+ if (*x == 1 ) {
26
+ *y = 2 ;
27
+ }
28
+ });
29
+
30
+ q.wait_and_throw ();
31
+
32
+ int error = (*x != 1 || *y != 2 ) ? 1 : 0 ;
33
+ std::cout << (error ? " failed\n " : " passed\n " );
34
+
35
+ sycl::free (x, q);
36
+ sycl::free (y, q);
37
+
38
+ return error;
39
+ }
You can’t perform that action at this time.
0 commit comments