Skip to content

Commit fad5a4b

Browse files
committed
GPU: launch bound helpers for Metal
Metal has no launch bounds, so the thread and warp count helpers pass the value through rather than deriving it from a kernel attribute. Metal also lacks variadic arguments for C functions, so one need to implement that using templates.
1 parent 0ca3db4 commit fad5a4b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

GPU/GPUTracking/Definitions/GPUDefParametersWrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
namespace o2::gpu
2929
{
3030
#if defined(GPUCA_GPUCODE) && !defined(GPUCA_GPUCODE_NO_LAUNCH_BOUNDS)
31-
GPUhdi() static constexpr uint32_t GPUCA_GET_THREAD_COUNT(uint32_t val, ...) { return val; }
32-
GPUhdi() static constexpr uint32_t GPUCA_GET_WARP_COUNT(uint32_t val, ...) { return val / GPUCA_WARP_SIZE; }
31+
template <typename... Args> GPUhdi() static constexpr uint32_t GPUCA_GET_THREAD_COUNT(uint32_t val, Args...) { return val; }
32+
template <typename... Args> GPUhdi() static constexpr uint32_t GPUCA_GET_WARP_COUNT(uint32_t val, Args...) { return val / GPUCA_WARP_SIZE; }
3333
#else
3434
static constexpr uint32_t GPUCA_WARP_SIZE = 1; // On the host, a thread is a block is a warp, and we run 1 "device thread" per block.
3535
#define GPUCA_GET_THREAD_COUNT(...) 1 // This must be a define not a constexpr function

0 commit comments

Comments
 (0)