31#define ALPAKA_DEVICE_GLOBAL_DATA_HOST(attributes, dataType, name, ...) \
32 namespace alpaka_onHost \
34 [[maybe_unused]] attributes alpaka::onAcc::internal::GlobalDeviceMemoryDataWrapper< \
35 ALPAKA_PP_REMOVE_BRACKETS(dataType)> name __VA_OPT__({__VA_ARGS__}); \
39#define ALPAKA_DEVICE_GLOBAL_DATA_HOST_EXTERN(attributes, dataType, name) \
40 namespace alpaka_onHost \
42 extern attributes alpaka::onAcc::internal::GlobalDeviceMemoryDataWrapper<ALPAKA_PP_REMOVE_BRACKETS(dataType)> \
46#if ALPAKA_LANG_CUDA || ALPAKA_LANG_HIP
48# define ALPAKA_DEVICE_GLOBAL_DATA_CUDA_HIP(attributes, dataType, name, ...) \
49 namespace alpaka_onAccCudaHip \
51 __device__ attributes \
52 alpaka::onAcc::internal::GlobalDeviceMemoryDataWrapper<ALPAKA_PP_REMOVE_BRACKETS(dataType)> \
53 name __VA_OPT__({__VA_ARGS__}); \
57# define ALPAKA_DEVICE_GLOBAL_GET_CUDA_HIP(attributes, dataType, name, ...) \
58 template<typename T_Api> \
59 requires(std::is_same_v<alpaka::api::Cuda, T_Api> || std::is_same_v<alpaka::api::Hip, T_Api>) \
60 constexpr auto& get(T_Api) const \
62 return alpaka_onAccCudaHip::name.value; \
64 template<typename T_Api> \
65 requires(std::is_same_v<alpaka::api::Cuda, T_Api> || std::is_same_v<alpaka::api::Hip, T_Api>) \
66 constexpr auto& getHandle(T_Api) const \
68 return alpaka_onAccCudaHip::name.value; \
72# define ALPAKA_DEVICE_GLOBAL_DATA_CUDA_HIP(attributes, dataType, name, ...)
73# define ALPAKA_DEVICE_GLOBAL_GET_CUDA_HIP(attributes, dataType, name, ...)
76#if ALPAKA_LANG_CUDA || ALPAKA_LANG_HIP
81# if defined(__CUDACC_RDC__) || defined(__CLANG_RDC__)
82# define ALPAKA_DEVICE_GLOBAL_DATA_CUDA_HIP_EXTERN(attributes, dataType, name) \
83 namespace alpaka_onAccCudaHip \
85 extern __device__ attributes \
86 alpaka::onAcc::internal::GlobalDeviceMemoryDataWrapper<ALPAKA_PP_REMOVE_BRACKETS(dataType)> \
91# define ALPAKA_DEVICE_GLOBAL_DATA_CUDA_HIP_EXTERN(attributes, dataType, name)
94# define ALPAKA_DEVICE_GLOBAL_DATA_CUDA_HIP_EXTERN(attributes, dataType, name)
99# define ALPAKA_DEVICE_GLOBAL_DATA_ONEAPI(attributes, dataType, name, ...) \
100 namespace alpaka_onAccOneAPI \
102 [[maybe_unused]] attributes sycl::ext::oneapi::experimental::device_global< \
103 alpaka::onAcc::internal::GlobalDeviceMemoryDataWrapper<ALPAKA_PP_REMOVE_BRACKETS(dataType)>> name \
105 {alpaka::onAcc::internal::GlobalDeviceMemoryDataWrapper<ALPAKA_PP_REMOVE_BRACKETS(dataType)>{ \
110# define ALPAKA_DEVICE_GLOBAL_DATA_ONEAPI_EXTERN(attributes, dataType, name) \
111 namespace alpaka_onAccOneAPI \
113 extern attributes sycl::ext::oneapi::experimental::device_global< \
114 alpaka::onAcc::internal::GlobalDeviceMemoryDataWrapper<ALPAKA_PP_REMOVE_BRACKETS(dataType)>> \
119# define ALPAKA_DEVICE_GLOBAL_GET_ONEAPI(attributes, dataType, name, ...) \
120 template<typename T_Api> \
121 requires(std::is_same_v<alpaka::api::OneApi, T_Api>) \
122 constexpr auto& get(T_Api) const \
124 return alpaka_onAccOneAPI::name.get().value; \
126 template<typename T_Api> \
127 requires(std::is_same_v<alpaka::api::OneApi, T_Api>) \
128 constexpr auto& getHandle(T_Api) const \
130 return alpaka_onAccOneAPI::name; \
133# define ALPAKA_DEVICE_GLOBAL_DATA_ONEAPI(attributes, dataType, name, ...)
134# define ALPAKA_DEVICE_GLOBAL_DATA_ONEAPI_EXTERN(attributes, dataType, name)
135# define ALPAKA_DEVICE_GLOBAL_GET_ONEAPI(attributes, dataType, name, ...)
170 template<alpaka::concepts::CStaticArray T>
188 template<
typename T_Storage,
typename T_Type>
200 template<alpaka::concepts::Api T_Api>
203 return T_Storage::getHandle(
api);
209 constexpr decltype(
auto)
get()
const
211 return T_Storage::get(
thisApi());
214 constexpr decltype(
auto)
get()
const requires(std::is_array_v<type>)
222 return T_Storage::get(
thisApi());
225 constexpr operator type const&()
const
227 return T_Storage::get(
thisApi());
#define ALPAKA_FORWARD(instance)
Perfectly forward an instance as argument.
constexpr auto thisApi()
provides the API used during the execution of the current code path
value_type const * data() const
std::remove_all_extents_t< T > value_type
constexpr GlobalDeviceMemoryDataWrapper(auto const &... args)
Helper class to provide access to device global memory variables.
constexpr decltype(auto) get() const
constexpr decltype(auto) get() const
constexpr decltype(auto) getHandle(T_Api api) const
Get the handle to call native API specific memcopy for global device memory operation.