alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
MemoryOrderHip.hpp
Go to the documentation of this file.
1/* Copyright 2025 Tapish Narwal
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
8
9#include <concepts>
10
11#ifdef ALPAKA_ACC_GPU_HIP_ENABLED
12
13namespace alpaka
14{
15 struct MemOrderHip
16 {
17 template<MemoryOrder TMemOrder>
18 static constexpr auto get(TMemOrder)
19 {
20 if constexpr(std::same_as<TMemOrder, mem_order::SeqCst>)
21 {
22 return __ATOMIC_SEQ_CST;
23 }
24 if constexpr(std::same_as<TMemOrder, mem_order::AcqRel>)
25 {
26 return __ATOMIC_ACQ_REL;
27 }
28 if constexpr(std::same_as<TMemOrder, mem_order::Release>)
29 {
30 return __ATOMIC_RELEASE;
31 }
32 if constexpr(std::same_as<TMemOrder, mem_order::Acquire>)
33 {
34 return __ATOMIC_ACQUIRE;
35 }
36 if constexpr(std::same_as<TMemOrder, mem_order::Relaxed>)
37 {
38 return __ATOMIC_RELAXED;
39 }
40 }
41 };
42
43} // namespace alpaka
44
45#endif
The alpaka accelerator library.