1
+ // ==---------------- atomic_update_test.cpp - DPC++ ESIMD on-device test --==//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+ // This test checks regression in lsc_atomic_update
9
+ // ===----------------------------------------------------------------------===//
10
+ // REQUIRES: gpu-intel-pvc
11
+ // RUN: %clangxx -fsycl %s -o %t.out
12
+ // RUN: %GPU_RUN_PLACEHOLDER %t.out
13
+
14
+ #include " ../esimd_test_utils.hpp"
15
+
16
+ #include < CL/sycl.hpp>
17
+ #include < iostream>
18
+ #include < sycl/ext/intel/esimd.hpp>
19
+
20
+ int main () {
21
+ sycl::queue q{};
22
+ auto p_sync = malloc_shared<uint32_t >(1024 , q);
23
+ p_sync[0 ] = 5 ;
24
+ p_sync[1 ] = 0 ;
25
+ q.submit ([&](sycl::handler &cgh) {
26
+ cgh.single_task <class reproducer >([=]() [[intel::sycl_explicit_simd]] {
27
+ uint32_t result =
28
+ sycl::ext::intel::experimental::esimd::lsc_atomic_update<
29
+ sycl::ext::intel::esimd::atomic_op::load, uint32_t , 1 >(p_sync, 0 ,
30
+ 1 )[0 ];
31
+ sycl::ext::intel::experimental::esimd::lsc_atomic_update<
32
+ sycl::ext::intel::esimd::atomic_op::store, uint32_t , 1 >(p_sync, 1 ,
33
+ result, 1 );
34
+ });
35
+ });
36
+ q.wait ();
37
+
38
+ bool passed = true ;
39
+
40
+ passed &= p_sync[0 ] == p_sync[1 ];
41
+
42
+ std::cout << (passed ? " Test passed\n " : " Test FAILED\n " );
43
+
44
+ free (p_sync, q);
45
+ return passed ? 0 : 1 ;
46
+ }
0 commit comments