45 #ifndef KOKKOS_ROCM_HPP
46 #define KOKKOS_ROCM_HPP
48 #include <Kokkos_Core_fwd.hpp>
50 #if defined(KOKKOS_ENABLE_ROCM)
55 dim3(
int _x,
int _y,
int _z) : x(_x), y(_y), z(_z){};
58 #include <ROCm/hc_math_std.hpp>
64 #include <Kokkos_HostSpace.hpp>
65 #include <Kokkos_ROCmSpace.hpp>
66 #include <ROCm/Kokkos_ROCm_Exec.hpp>
67 #include <Kokkos_ScratchSpace.hpp>
70 #include <impl/Kokkos_Tags.hpp>
78 #if defined(__HCC_ACCELERATOR__)
80 using namespace ::Concurrency::precise_math;
95 namespace Experimental {
105 typedef ROCm execution_space;
106 typedef ROCmSpace memory_space;
107 typedef Kokkos::Device<execution_space, memory_space> device_type;
109 typedef LayoutLeft array_layout;
110 typedef HostSpace::size_type size_type;
112 typedef ScratchMemorySpace<ROCm> scratch_memory_space;
118 ROCm(ROCm&&) =
default;
119 ROCm(
const ROCm&) =
default;
120 ROCm& operator=(ROCm&&) =
default;
121 ROCm& operator=(
const ROCm&) =
default;
128 KOKKOS_INLINE_FUNCTION
static int in_parallel() {
129 #if defined(__HCC_ACCELERATOR__)
143 static void impl_static_fence();
145 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
160 struct SelectDevice {
162 SelectDevice() : rocm_device_id(1) {}
163 explicit SelectDevice(
int id) : rocm_device_id(id + 1) {}
166 int rocm_device()
const {
return m_device; }
168 bool isAPU(
int device);
170 static void initialize(
const SelectDevice = SelectDevice());
172 static int is_initialized();
178 static int concurrency();
179 static const char* name();
191 struct MemorySpaceAccess<Kokkos::Experimental::ROCmSpace,
192 Kokkos::Experimental::ROCm::scratch_memory_space> {
193 enum { assignable =
false };
194 enum { accessible =
true };
195 enum { deepcopy =
false };
199 struct VerifyExecutionCanAccessMemorySpace<
200 Kokkos::Experimental::ROCm::memory_space,
201 Kokkos::Experimental::ROCm::scratch_memory_space> {
202 enum { value =
true };
203 KOKKOS_INLINE_FUNCTION
static void verify(
void) {}
204 KOKKOS_INLINE_FUNCTION
static void verify(
const void*) {}
208 struct VerifyExecutionCanAccessMemorySpace<
209 Kokkos::HostSpace, Kokkos::Experimental::ROCm::scratch_memory_space> {
210 enum { value =
false };
211 inline static void verify(
void) {
212 Kokkos::Experimental::ROCmSpace::access_error();
214 inline static void verify(
const void* p) {
215 Kokkos::Experimental::ROCmSpace::access_error(p);
222 #define threadIdx_x (hc_get_workitem_id(0))
223 #define threadIdx_y (hc_get_workitem_id(1))
224 #define threadIdx_z (hc_get_workitem_id(2))
226 #define blockIdx_x (hc_get_group_id(0))
227 #define blockIdx_y (hc_get_group_id(1))
228 #define blockIdx_z (hc_get_group_id(2))
230 #define blockDim_x (hc_get_group_size(0))
231 #define blockDim_y (hc_get_group_size(1))
232 #define blockDim_z (hc_get_group_size(2))
234 #define gridDim_x (hc_get_num_groups(0))
235 #define gridDim_y (hc_get_num_groups(1))
236 #define gridDim_z (hc_get_num_groups(2))
238 #include <ROCm/Kokkos_ROCm_Parallel.hpp>
239 #include <ROCm/Kokkos_ROCm_Task.hpp>
void print_configuration(std::ostream &, const bool detail=false)
Print "Bill of Materials".
Declaration of various MemoryLayout options.
Declaration of parallel operators.
void finalize()
Finalize the spaces that were initialized via Kokkos::initialize.