DPC++ Runtime
Runtime libraries for oneAPI DPC++
atomic_enums.hpp
Go to the documentation of this file.
1 //==--------------- atomic_enums.hpp - SYCL_ONEAPI_extended_atomics enums --==//
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 
9 #pragma once
10 
11 #include <CL/__spirv/spirv_ops.hpp>
12 #include <sycl/access/access.hpp>
13 #include <sycl/detail/defines.hpp>
14 #include <sycl/detail/helpers.hpp>
15 #include <sycl/memory_enums.hpp>
16 
17 #ifndef __SYCL_DEVICE_ONLY__
18 #include <atomic>
19 #endif
20 #include <type_traits>
21 
22 namespace sycl {
24 namespace ext::oneapi {
25 
26 using memory_order __SYCL2020_DEPRECATED("use 'sycl::memory_order' instead") =
29  "use 'sycl::memory_order_relaxed' instead") = memory_order::relaxed;
31  "use 'sycl::memory_order_acquire' instead") = memory_order::acquire;
33  "use 'sycl::memory_order_release' instead") = memory_order::release;
35  "use 'sycl::memory_order_acq_rel' instead") = memory_order::acq_rel;
37  "use 'sycl::memory_order_seq_cst' instead") = memory_order::seq_cst;
38 
39 using memory_scope __SYCL2020_DEPRECATED("use 'sycl::memory_scope' instead") =
42  "use 'sycl::memory_scope_work_item' instead") = memory_scope::work_item;
44  "use 'sycl::memory_scope_sub_group' instead") = memory_scope::sub_group;
46  "use 'sycl::memory_scope_work_group' instead") = memory_scope::work_group;
48  "use 'sycl::memory_scope_device' instead") = memory_scope::device;
50  "use 'sycl::memory_scope_system' instead") = memory_scope::system;
51 
52 #ifndef __SYCL_DEVICE_ONLY__
53 namespace detail {
54 
56  "use 'sycl::detail::getStdMemoryOrder(sycl::memory_order)' instead")
57 static inline constexpr std::memory_order
58 getStdMemoryOrder(::sycl::ext::oneapi::memory_order order) {
59  switch (order) {
60  case memory_order::relaxed:
62  case memory_order::__consume_unsupported:
63  return std::memory_order_consume;
64  case memory_order::acquire:
66  case memory_order::release:
68  case memory_order::acq_rel:
70  case memory_order::seq_cst:
72  }
73 }
74 
75 } // namespace detail
76 #endif // __SYCL_DEVICE_ONLY__
77 
78 } // namespace ext::oneapi
79 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
80 } // namespace sycl
#define __SYCL_INLINE_VER_NAMESPACE(X)
#define __SYCL2020_DEPRECATED(message)
static std::memory_order getStdMemoryOrder(__spv::MemorySemanticsMask::Flag)
Definition: atomic.hpp:84
sycl::ext::oneapi::memory_order memory_order
Definition: atomic_ref.hpp:32
constexpr auto memory_scope_work_group
constexpr auto memory_scope_sub_group
constexpr auto memory_order_release
constexpr auto memory_order_relaxed
constexpr auto memory_order_acq_rel
constexpr auto memory_scope_system
constexpr auto memory_scope_device
constexpr auto memory_order_seq_cst
constexpr auto memory_order_acquire
constexpr auto memory_scope_work_item
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14