File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ // UNSUPPORTED: cuda || hip
2
+ // RUN: clang++ -fsycl -fsycl-device-obj=spirv -c -o %t.o %s
3
+ // RUN: clang++ -fsycl -o %t.out %t.o
4
+ // RUN: %{run} %t.out
5
+
6
+ // This test verifies SPIR-V based fat objects.
7
+
8
+ #include < sycl/sycl.hpp>
9
+
10
+ int main () {
11
+ sycl::buffer<size_t , 1 > Buffer (4 );
12
+
13
+ sycl::queue Queue;
14
+
15
+ sycl::range<1 > NumOfWorkItems{Buffer.size ()};
16
+
17
+ Queue.submit ([&](sycl::handler &cgh) {
18
+ sycl::accessor Accessor{Buffer, cgh, sycl::write_only};
19
+ cgh.parallel_for <class FillBuffer >(NumOfWorkItems, [=](sycl::id<1 > WIid) {
20
+ Accessor[WIid] = WIid.get (0 );
21
+ });
22
+ });
23
+
24
+ sycl::host_accessor HostAccessor{Buffer, sycl::read_only};
25
+
26
+ bool MismatchFound = false ;
27
+ for (size_t I = 0 ; I < Buffer.size (); ++I) {
28
+ if (HostAccessor[I] != I) {
29
+ std::cout << " The result is incorrect for element: " << I
30
+ << " , expected: " << I << " , got: " << HostAccessor[I]
31
+ << std::endl;
32
+ MismatchFound = true ;
33
+ }
34
+ }
35
+
36
+ return MismatchFound;
37
+ }
You can’t perform that action at this time.
0 commit comments