DPC++ Runtime
Runtime libraries for oneAPI DPC++
atomic_fence.hpp
Go to the documentation of this file.
1 //==---- atomic_fence.hpp - SYCL_ONEAPI_extended_atomics atomic_fence ------==//
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 <CL/sycl/detail/spirv.hpp>
14 
15 #ifndef __SYCL_DEVICE_ONLY__
16 #include <atomic>
17 #endif
18 
20 namespace sycl {
21 namespace ext {
22 namespace oneapi {
23 namespace detail {
24 using namespace cl::sycl::detail;
25 }
26 
27 __SYCL2020_DEPRECATED("use sycl::atomic_fence instead")
28 static inline void atomic_fence(memory_order order, memory_scope scope) {
29 #ifdef __SYCL_DEVICE_ONLY__
30  auto SPIRVOrder = detail::spirv::getMemorySemanticsMask(order);
31  auto SPIRVScope = detail::spirv::getScope(scope);
32  __spirv_MemoryBarrier(SPIRVScope, static_cast<uint32_t>(SPIRVOrder));
33 #else
34  (void)scope;
35  auto StdOrder = detail::getStdMemoryOrder(order);
36  atomic_thread_fence(StdOrder);
37 #endif
38 }
39 
40 } // namespace oneapi
41 } // namespace ext
42 
43 } // namespace sycl
44 } // __SYCL_INLINE_NAMESPACE(cl)
spirv_ops.hpp
cl::sycl::memory_order
memory_order
Definition: memory_enums.hpp:16
__SYCL2020_DEPRECATED
#define __SYCL2020_DEPRECATED(message)
Definition: defines_elementary.hpp:56
cl::sycl::ext::oneapi::atomic_fence
static void atomic_fence(memory_order order, memory_scope scope)
Definition: atomic_fence.hpp:28
sycl
Definition: invoke_simd.hpp:68
cl::sycl::memory_scope
memory_scope
Definition: memory_enums.hpp:26
cl::sycl::detail::getStdMemoryOrder
static std::memory_order getStdMemoryOrder(__spv::MemorySemanticsMask::Flag)
Definition: atomic.hpp:81
atomic_enums.hpp
spirv.hpp
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
__spirv_MemoryBarrier
__SYCL_CONVERGENT__ SYCL_EXTERNAL void __spirv_MemoryBarrier(__spv::Scope Memory, uint32_t Semantics) noexcept
Definition: spirv_ops.cpp:36
cl::sycl::detail
Definition: access.hpp:100
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12