From 9e9a93e10a5ffde6a027ef5ee9ba79cdc34e1a9b Mon Sep 17 00:00:00 2001 From: Yaxun Sam Liu Date: Fri, 7 Sep 2018 16:20:00 -0400 Subject: [PATCH] Use template for hipLaunchKernelGGL for hip-clang --- include/hip/hcc_detail/hip_runtime.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/include/hip/hcc_detail/hip_runtime.h b/include/hip/hcc_detail/hip_runtime.h index 41710e4165..e0ad6befdd 100644 --- a/include/hip/hcc_detail/hip_runtime.h +++ b/include/hip/hcc_detail/hip_runtime.h @@ -346,15 +346,18 @@ extern void ihipPostLaunchKernel(const char* kernelName, hipStream_t stream, gri typedef int hipLaunchParm; -#define hipLaunchKernel(kernelName, numblocks, numthreads, memperblock, streamId, ...) \ - do { \ - kernelName<<>>(0, ##__VA_ARGS__); \ - } while (0) +template +inline void hipLaunchKernelGGL(F kernelName, const dim3& numblocks, const dim3& numthreads, + unsigned memperblock, hipStream_t streamId, Args... args) { + kernelName<<>>(args...); +} -#define hipLaunchKernelGGL(kernelName, numblocks, numthreads, memperblock, streamId, ...) \ - do { \ - kernelName<<>>(__VA_ARGS__); \ - } while (0) +template +inline void hipLaunchKernel(F kernel, const dim3& numBlocks, const dim3& dimBlocks, + std::uint32_t groupMemBytes, hipStream_t stream, Args... args) { + hipLaunchKernelGGL(kernel, numBlocks, dimBlocks, groupMemBytes, stream, hipLaunchParm{}, + std::move(args)...); +} #include