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 using execution_space = ROCm;
106 using memory_space = ROCmSpace;
107 using device_type = Kokkos::Device<execution_space, memory_space>;
109 using array_layout = LayoutLeft;
110 using size_type = HostSpace::size_type;
112 using scratch_memory_space = ScratchMemorySpace<ROCm>;
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();
148 static void print_configuration(std::ostream&,
const bool detail =
false);
151 static void finalize();
156 struct SelectDevice {
158 SelectDevice() : rocm_device_id(1) {}
159 explicit SelectDevice(
int id) : rocm_device_id(id + 1) {}
162 int rocm_device()
const {
return m_device; }
164 bool isAPU(
int device);
166 static void initialize(
const SelectDevice = SelectDevice());
168 static int is_initialized();
174 static int concurrency();
175 static const char* name();
187 struct MemorySpaceAccess<Kokkos::Experimental::ROCmSpace,
188 Kokkos::Experimental::ROCm::scratch_memory_space> {
189 enum { assignable =
false };
190 enum { accessible =
true };
191 enum { deepcopy =
false };
195 struct VerifyExecutionCanAccessMemorySpace<
196 Kokkos::Experimental::ROCm::memory_space,
197 Kokkos::Experimental::ROCm::scratch_memory_space> {
198 enum { value =
true };
199 KOKKOS_INLINE_FUNCTION
static void verify(
void) {}
200 KOKKOS_INLINE_FUNCTION
static void verify(
const void*) {}
204 struct VerifyExecutionCanAccessMemorySpace<
205 Kokkos::HostSpace, Kokkos::Experimental::ROCm::scratch_memory_space> {
206 enum { value =
false };
207 inline static void verify(
void) {
208 Kokkos::Experimental::ROCmSpace::access_error();
210 inline static void verify(
const void* p) {
211 Kokkos::Experimental::ROCmSpace::access_error(p);
218 #define threadIdx_x (hc_get_workitem_id(0))
219 #define threadIdx_y (hc_get_workitem_id(1))
220 #define threadIdx_z (hc_get_workitem_id(2))
222 #define blockIdx_x (hc_get_group_id(0))
223 #define blockIdx_y (hc_get_group_id(1))
224 #define blockIdx_z (hc_get_group_id(2))
226 #define blockDim_x (hc_get_group_size(0))
227 #define blockDim_y (hc_get_group_size(1))
228 #define blockDim_z (hc_get_group_size(2))
230 #define gridDim_x (hc_get_num_groups(0))
231 #define gridDim_y (hc_get_num_groups(1))
232 #define gridDim_z (hc_get_num_groups(2))
234 #include <ROCm/Kokkos_ROCm_Parallel.hpp>
235 #include <ROCm/Kokkos_ROCm_Task.hpp>
Declaration of various MemoryLayout options.
Declaration of parallel operators.