File tree 1 file changed +32
-0
lines changed
sycl/test-e2e/DeviceGlobal
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %{build} -o %t.out
2
+ // RUN: %{run} %t.out
3
+ //
4
+ // The OpenCL GPU backends do not currently support device_global backend
5
+ // calls.
6
+ // UNSUPPORTED: opencl && gpu
7
+ //
8
+ // Tests basic device_global access through device kernels.
9
+
10
+ #include " common.hpp"
11
+
12
+ static device_global<int [4 ], TestProperties> DeviceGlobalVar;
13
+
14
+ int main () {
15
+ queue Q;
16
+
17
+ Q.single_task ([=]() { DeviceGlobalVar.get ()[0 ] = 42 ; });
18
+ // Make sure that the write happens before subsequent read
19
+ Q.wait ();
20
+
21
+ int OutVal = 0 ;
22
+ {
23
+ buffer<int , 1 > OutBuf (&OutVal, 1 );
24
+ Q.submit ([&](handler &CGH) {
25
+ auto OutAcc = OutBuf.get_access <access ::mode::write >(CGH);
26
+ CGH.single_task ([=]() { OutAcc[0 ] = DeviceGlobalVar.get ()[0 ]; });
27
+ });
28
+ }
29
+ assert (OutVal == 42 && " Read value does not match." );
30
+ return 0 ;
31
+ }
32
+
You can’t perform that action at this time.
0 commit comments