From 854d3103dd36167fc3ddf9a67f0072263d746fd4 Mon Sep 17 00:00:00 2001 From: saleelk Date: Tue, 4 Feb 2020 06:07:57 -0800 Subject: [PATCH] Implement __hipPushCallConfiguration/__hipPopCallConfiguration for hip_clang (#1845) This is needed so that the right symbols are present if we want to use hip-clang with hip/hcc runtime --- hipamd/src/hip_clang.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/hipamd/src/hip_clang.cpp b/hipamd/src/hip_clang.cpp index 4e36b9323a..f17d2673c7 100644 --- a/hipamd/src/hip_clang.cpp +++ b/hipamd/src/hip_clang.cpp @@ -189,6 +189,44 @@ hipError_t hipConfigureCall( return hipSuccess; } + +extern "C" hipError_t __hipPushCallConfiguration( + dim3 gridDim, + dim3 blockDim, + size_t sharedMem, + hipStream_t stream) +{ + GET_TLS(); + auto ctx = ihipGetTlsDefaultCtx(); + LockedAccessor_CtxCrit_t crit(ctx->criticalData()); + + crit->_execStack.push(ihipExec_t{gridDim, blockDim, sharedMem, stream}); + return hipSuccess; +} + +extern "C" hipError_t __hipPopCallConfiguration( + dim3 *gridDim, + dim3 *blockDim, + size_t *sharedMem, + hipStream_t *stream) +{ + GET_TLS(); + auto ctx = ihipGetTlsDefaultCtx(); + LockedAccessor_CtxCrit_t crit(ctx->criticalData()); + + ihipExec_t exec; + exec = std::move(crit->_execStack.top()); + crit->_execStack.pop(); + + *gridDim = exec._gridDim; + *blockDim = exec._blockDim; + *sharedMem = exec._sharedMem; + *stream = exec._hStream; + + return hipSuccess; +} + + hipError_t hipSetupArgument( const void *arg, size_t size,