From 0051334261c6ad1b01cc3fa0efaf2e2c19c3c9a7 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Thu, 9 Nov 2023 04:30:39 +0000 Subject: [PATCH] SWDEV-388256 - Add support of hipExtGetLastError Change-Id: Ie119d5ea611019996b8a80f7b820ca6a160496a6 [ROCm/clr commit: 92aa9d0fbab94d512a00722c3d527e171b694d18] --- .../hipamd/include/hip/amd_detail/hip_prof_str.h | 15 ++++++++++++++- projects/clr/hipamd/src/amdhip.def | 1 + projects/clr/hipamd/src/hip_error.cpp | 7 +++++++ projects/clr/hipamd/src/hip_hcc.map.in | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/projects/clr/hipamd/include/hip/amd_detail/hip_prof_str.h b/projects/clr/hipamd/include/hip/amd_detail/hip_prof_str.h index 128dc3747e..3c9c09f2ce 100644 --- a/projects/clr/hipamd/include/hip/amd_detail/hip_prof_str.h +++ b/projects/clr/hipamd/include/hip/amd_detail/hip_prof_str.h @@ -396,7 +396,8 @@ enum hip_api_id_t { HIP_API_ID_hipGraphExternalSemaphoresSignalNodeSetParams = 376, HIP_API_ID_hipGraphExternalSemaphoresWaitNodeGetParams = 377, HIP_API_ID_hipGraphExternalSemaphoresWaitNodeSetParams = 378, - HIP_API_ID_LAST = 378, + HIP_API_ID_hipExtGetLastError = 379, + HIP_API_ID_LAST = 379, HIP_API_ID_hipChooseDevice = HIP_API_ID_CONCAT(HIP_API_ID_,hipChooseDevice), HIP_API_ID_hipGetDeviceProperties = HIP_API_ID_CONCAT(HIP_API_ID_,hipGetDeviceProperties), @@ -817,6 +818,7 @@ static inline const char* hip_api_name(const uint32_t id) { case HIP_API_ID_hipUserObjectRelease: return "hipUserObjectRelease"; case HIP_API_ID_hipUserObjectRetain: return "hipUserObjectRetain"; case HIP_API_ID_hipWaitExternalSemaphoresAsync: return "hipWaitExternalSemaphoresAsync"; + case HIP_API_ID_hipExtGetLastError: return "hipExtGetLastError"; }; return "unknown"; }; @@ -1198,6 +1200,7 @@ static inline uint32_t hipApiIdByName(const char* name) { if (strcmp("hipUserObjectRelease", name) == 0) return HIP_API_ID_hipUserObjectRelease; if (strcmp("hipUserObjectRetain", name) == 0) return HIP_API_ID_hipUserObjectRetain; if (strcmp("hipWaitExternalSemaphoresAsync", name) == 0) return HIP_API_ID_hipWaitExternalSemaphoresAsync; + if (strcmp("hipExtGetLastError", name) == 0) return HIP_API_ID_hipExtGetLastError; return HIP_API_ID_NONE; } @@ -5630,6 +5633,9 @@ typedef struct hip_api_data_s { cb_data.args.hipWaitExternalSemaphoresAsync.numExtSems = (unsigned int)numExtSems; \ cb_data.args.hipWaitExternalSemaphoresAsync.stream = (hipStream_t)stream; \ }; +// hipExtGetLastError[] +#define INIT_hipExtGetLastError_CB_ARGS_DATA(cb_data) { \ +}; #define INIT_CB_ARGS_DATA(cb_id, cb_data) INIT_##cb_id##_CB_ARGS_DATA(cb_data) // Macros for non-public API primitives @@ -6119,6 +6125,9 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) { // hipGetLastError[] case HIP_API_ID_hipGetLastError: break; +// hipExtGetLastError[] + case HIP_API_ID_hipExtGetLastError: + break; // hipGetMipmappedArrayLevel[('hipArray_t*', 'levelArray'), ('hipMipmappedArray_const_t', 'mipmappedArray'), ('unsigned int', 'level')] case HIP_API_ID_hipGetMipmappedArrayLevel: if (data->args.hipGetMipmappedArrayLevel.levelArray) data->args.hipGetMipmappedArrayLevel.levelArray__val = *(data->args.hipGetMipmappedArrayLevel.levelArray); @@ -7924,6 +7933,10 @@ static inline const char* hipApiString(hip_api_id_t id, const hip_api_data_t* da oss << "hipGetLastError("; oss << ")"; break; + case HIP_API_ID_hipExtGetLastError: + oss << "hipExtGetLastError("; + oss << ")"; + break; case HIP_API_ID_hipGetMipmappedArrayLevel: oss << "hipGetMipmappedArrayLevel("; if (data->args.hipGetMipmappedArrayLevel.levelArray == NULL) oss << "levelArray=NULL"; diff --git a/projects/clr/hipamd/src/amdhip.def b/projects/clr/hipamd/src/amdhip.def index 4ff72e19b8..0b0b668831 100644 --- a/projects/clr/hipamd/src/amdhip.def +++ b/projects/clr/hipamd/src/amdhip.def @@ -450,3 +450,4 @@ hipGraphAddMemFreeNode hipGraphMemFreeNodeGetParams hipDrvGraphAddMemcpyNode hipDrvGraphAddMemsetNode +hipExtGetLastError diff --git a/projects/clr/hipamd/src/hip_error.cpp b/projects/clr/hipamd/src/hip_error.cpp index 48515c245a..b6a04ffb10 100644 --- a/projects/clr/hipamd/src/hip_error.cpp +++ b/projects/clr/hipamd/src/hip_error.cpp @@ -23,6 +23,13 @@ #include "hip_internal.hpp" namespace hip { +hipError_t hipExtGetLastError() +{ + HIP_INIT_API(hipExtGetLastError); + hipError_t err = hip::tls.last_error_; + hip::tls.last_error_ = hipSuccess; + return err; +} hipError_t hipGetLastError() { diff --git a/projects/clr/hipamd/src/hip_hcc.map.in b/projects/clr/hipamd/src/hip_hcc.map.in index 164fab1bbe..9122f2956b 100644 --- a/projects/clr/hipamd/src/hip_hcc.map.in +++ b/projects/clr/hipamd/src/hip_hcc.map.in @@ -535,6 +535,7 @@ hip_6.0 { global: hipChooseDeviceR0600; hipGetDevicePropertiesR0600; + hipExtGetLastError; local: *; } hip_5.6;