Skip to content

Commit 480d181

Browse files
Various tweaks to enable Wave32 for Radeon cards with HIP.
1 parent 345baee commit 480d181

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ endif()
171171

172172
if(RAJA_ENABLE_HIP)
173173
message(STATUS "HIP version: ${hip_VERSION}")
174+
set(RAJA_DEFAULT_WAVESIZE "64" CACHE STRING "Default wave size for GPU architecture. E.g. MI200/MI300 this is 64.")
174175
if("${hip_VERSION}" VERSION_LESS "3.5")
175176
message(FATAL_ERROR "Trying to use HIP/ROCm version ${hip_VERSION}. RAJA requires HIP/ROCm version 3.5 or newer. ")
176177
endif()

include/RAJA/config.hpp.in

+2
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ static_assert(RAJA_HAS_SOME_CXX14,
182182
#cmakedefine RAJA_ENABLE_NV_TOOLS_EXT
183183
#cmakedefine RAJA_ENABLE_ROCTX
184184

185+
#cmakedefine RAJA_DEFAULT_WAVESIZE @RAJA_DEFAULT_WAVESIZE@
186+
185187
/*!
186188
******************************************************************************
187189
*

include/RAJA/pattern/kernel/InitLocalMem.hpp

+1-8
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,16 @@ struct StatementExecutor<statement::InitLocalMem<RAJA::cpu_tile_mem,camp::idx_se
7777
using varType = typename camp::tuple_element_t<Pos, typename camp::decay<Data>::param_tuple_t>::value_type;
7878

7979
// Initialize memory
80-
#ifdef RAJA_COMPILER_MSVC
81-
// MSVC doesn't like taking a pointer to stack allocated data?!?!
8280
varType *ptr = new varType[camp::get<Pos>(data.param_tuple).size()];
8381
camp::get<Pos>(data.param_tuple).set_data(ptr);
84-
#else
85-
varType Array[camp::get<Pos>(data.param_tuple).size()];
86-
camp::get<Pos>(data.param_tuple).set_data(&Array[0]);
87-
#endif
82+
8883

8984
// Initialize others and execute
9085
exec_expanded<others...>(data);
9186

9287
// Cleanup and return
9388
camp::get<Pos>(data.param_tuple).set_data(nullptr);
94-
#ifdef RAJA_COMPILER_MSVC
9589
delete[] ptr;
96-
#endif
9790
}
9891

9992

include/RAJA/policy/hip/policy.hpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,9 @@ struct DeviceConstants
324324
// values for HIP warp size and max block size.
325325
//
326326
#if defined(__HIP_PLATFORM_AMD__)
327-
#if defined(RAJA_HIP_WAVE64)
328-
constexpr DeviceConstants device_constants(RAJA_HIP_WAVESIZE, 1024, 64); // MI300A
329-
// constexpr DeviceConstants device_constants(64, 1024, 128); // MI250X
330-
#else
331-
constexpr DeviceConstants device_constants(32, 1024, 64); // Radeon cards (e.g. gfx1100)
332-
#endif
327+
constexpr DeviceConstants device_constants(RAJA_DEFAULT_WAVESIZE, 1024, 64); // MI300A
328+
// constexpr DeviceConstants device_constants(RAJA_DEFAULT_WAVESIZE, 1024, 128); // MI250X
329+
333330
#elif defined(__HIP_PLATFORM_NVIDIA__)
334331
constexpr DeviceConstants device_constants(32, 1024, 32); // V100
335332
#endif

0 commit comments

Comments
 (0)