From 005535c8f69a8bcfb66f71867d4e72d52d7e896e Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 30 Oct 2019 01:19:24 -0400 Subject: [PATCH] P4 to Git Change 2021608 by michliao@hliao-dev-00-hip.rocm-workspace on 2019/10/30 01:13:58 SWDEV-145570 - [HIP] Fix occupancy API prototype. - They need to be C API, i.e. extern "C". - Follow the current API and use `uint32_t` instead of `int`. + TODO: We need to revert them back once that APIs are changed to be compatible with CUDA. Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#46 edit [ROCm/hip commit: a0f8995e3a6d43e9218b41b201c2a6af36853ebc] --- projects/hip/api/hip/hip_platform.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/projects/hip/api/hip/hip_platform.cpp b/projects/hip/api/hip/hip_platform.cpp index 9773251bb0..777a710b11 100644 --- a/projects/hip/api/hip/hip_platform.cpp +++ b/projects/hip/api/hip/hip_platform.cpp @@ -615,21 +615,31 @@ hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, } } -hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, +extern "C" { +// FIXME: Need to replace `uint32_t` with `int` finally. +hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(uint32_t* numBlocks, hipFunction_t f, - int blockSize, + uint32_t blockSize, size_t dynamicSMemSize) { - HIP_RETURN(hip_impl::ihipOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, f, blockSize, dynamicSMemSize)); + int NB; + hipError_t Ret = hip_impl::ihipOccupancyMaxActiveBlocksPerMultiprocessor(&NB, f, blockSize, dynamicSMemSize); + *numBlocks = NB; + HIP_RETURN(Ret); } -hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, +// FIXME: Need to replace `uint32_t` with `int` finally. +hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(uint32_t* numBlocks, hipFunction_t f, - int blockSize, + uint32_t blockSize, size_t dynamicSMemSize, unsigned int flags) { - HIP_RETURN(hip_impl::ihipOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, f, blockSize, dynamicSMemSize)); + int NB; + hipError_t Ret = hip_impl::ihipOccupancyMaxActiveBlocksPerMultiprocessor(&NB, f, blockSize, dynamicSMemSize); + *numBlocks = NB; + HIP_RETURN(Ret); +} }