From d88f0358b02df49d09e279ccc78bffbd3a903afd Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Thu, 27 Apr 2023 16:02:44 +0100 Subject: [PATCH] SWDEV-397356: Move HIP_API_PRINT after HIP_INIT so that the begin function call gets printed Change-Id: I99b655596741c19bc483647794ae8b4f6e6f2843 --- hipamd/src/hip_internal.hpp | 10 +++++++--- hipamd/src/hiprtc/hiprtcInternal.hpp | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hipamd/src/hip_internal.hpp b/hipamd/src/hip_internal.hpp index 6973340a0d..c7d51b95d4 100644 --- a/hipamd/src/hip_internal.hpp +++ b/hipamd/src/hip_internal.hpp @@ -108,12 +108,16 @@ extern amd::Monitor g_hipInitlock; __func__, ihipGetErrorName(err), ToString( __VA_ARGS__ ).c_str()); #define HIP_INIT_API_INTERNAL(noReturn, cid, ...) \ - HIP_API_PRINT(__VA_ARGS__) \ amd::Thread* thread = amd::Thread::current(); \ - if (!VDI_CHECK_THREAD(thread) && !noReturn) { \ - HIP_RETURN(hipErrorOutOfMemory); \ + if (!VDI_CHECK_THREAD(thread)) { \ + ClPrint(amd::LOG_NONE, amd::LOG_ALWAYS, "An internal error has occurred." \ + " This may be due to insufficient memory."); \ + if (!noReturn) { \ + return hipErrorOutOfMemory; \ + } \ } \ HIP_INIT(noReturn) \ + HIP_API_PRINT(__VA_ARGS__) \ HIP_CB_SPAWNER_OBJECT(cid); // This macro should be called at the beginning of every HIP API. diff --git a/hipamd/src/hiprtc/hiprtcInternal.hpp b/hipamd/src/hiprtc/hiprtcInternal.hpp index 04d9c63dd7..d246348660 100644 --- a/hipamd/src/hiprtc/hiprtcInternal.hpp +++ b/hipamd/src/hiprtc/hiprtcInternal.hpp @@ -66,7 +66,8 @@ static amd::Monitor g_hiprtcInitlock{"hiprtcInit lock"}; #define HIPRTC_INIT_API_INTERNAL(...) \ amd::Thread* thread = amd::Thread::current(); \ if (!VDI_CHECK_THREAD(thread)) { \ - ClPrint(amd::LOG_INFO, amd::LOG_API, "Failed to create thread"); \ + ClPrint(amd::LOG_NONE, amd::LOG_ALWAYS, "An internal error has occurred." \ + " This may be due to insufficient memory."); \ HIPRTC_RETURN(HIPRTC_ERROR_INTERNAL_ERROR); \ } \ amd::ScopedLock lock(g_hiprtcInitlock); \