diff --git a/projects/hip/CONTRIBUTING.md b/projects/hip/CONTRIBUTING.md index 6adf73bdf5..7858ef58eb 100644 --- a/projects/hip/CONTRIBUTING.md +++ b/projects/hip/CONTRIBUTING.md @@ -121,6 +121,8 @@ Differences or limitations of HIP APIs as compared to CUDA APIs should be clearl - HIP_INIT_API() should be placed at the start of each top-level HIP API. This function will make sure the HIP runtime is initialized, and also constructs an appropriate API string for tracing and CodeXL marker tracing. The arguments to HIP_INIT_API should match those of the parent fucntion. +- ihipLogStatus should only be called from top-level HIP APIs,and should be called to log and return the error code. The error code + is used by the GetLastError and PeekLastError functions - if a HIP API simply returns, then the error will not be logged correctly. #### Presubmit Testing: diff --git a/projects/hip/include/hcc_detail/hip_hcc.h b/projects/hip/include/hcc_detail/hip_hcc.h index 216e81c67f..3ad1efddeb 100644 --- a/projects/hip/include/hcc_detail/hip_hcc.h +++ b/projects/hip/include/hcc_detail/hip_hcc.h @@ -683,7 +683,7 @@ extern const char *ihipErrorString(hipError_t); extern ihipCtx_t *ihipGetTlsDefaultCtx(); extern void ihipSetTlsDefaultCtx(ihipCtx_t *ctx); extern hipError_t ihipSynchronize(void); -extern hipError_t ihipCtxStackUpdate(); +extern void ihipCtxStackUpdate(); extern ihipDevice_t *ihipGetDevice(int); ihipCtx_t * ihipGetPrimaryCtx(unsigned deviceIndex); diff --git a/projects/hip/src/hip_context.cpp b/projects/hip/src/hip_context.cpp index 4bf28ad191..dc0a30bd86 100644 --- a/projects/hip/src/hip_context.cpp +++ b/projects/hip/src/hip_context.cpp @@ -29,16 +29,11 @@ THE SOFTWARE. // Stack of contexts thread_local std::stack tls_ctxStack; -hipError_t ihipCtxStackUpdate() +void ihipCtxStackUpdate() { - //HIP_INIT_API(); - hipError_t e = hipSuccess; - if(tls_ctxStack.empty()) { - tls_ctxStack.push(ihipGetTlsDefaultCtx()); + tls_ctxStack.push(ihipGetTlsDefaultCtx()); } - - return ihipLogStatus(e); } hipError_t hipInit(unsigned int flags) diff --git a/projects/hip/src/hip_device.cpp b/projects/hip/src/hip_device.cpp index c3acbadbff..72c92ac76f 100644 --- a/projects/hip/src/hip_device.cpp +++ b/projects/hip/src/hip_device.cpp @@ -160,7 +160,7 @@ hipError_t hipSetDevice(int deviceId) */ hipError_t hipDeviceSynchronize(void) { - HIP_INIT_API(1); + HIP_INIT_API(); return ihipSynchronize(); } diff --git a/projects/hip/src/hip_hcc.cpp b/projects/hip/src/hip_hcc.cpp index 1854e3d8c7..cb47dafc7d 100644 --- a/projects/hip/src/hip_hcc.cpp +++ b/projects/hip/src/hip_hcc.cpp @@ -162,7 +162,7 @@ hipError_t ihipSynchronize(void) { ihipGetTlsDefaultCtx()->locked_waitAllStreams(); // ignores non-blocking streams, this waits for all activity to finish. - return ihipLogStatus(hipSuccess); + return (hipSuccess); } //=================================================================================================