AIRUNTIME-32 - Add try/catch around all HIP API calls (#2822)

This commit is contained in:
German Andryeyev
2026-01-23 14:53:20 -05:00
committed by GitHub
szülő 340f3aa887
commit 2b1b41f4da
2 fájl változott, egészen pontosan 1112 új sor hozzáadva és 11 régi sor törölve
A különbségek nem kerülnek megjelenítésre, mivel a fájl túl nagy Load Diff
@@ -24,6 +24,8 @@ namespace hip {
const HipDispatchTable* GetHipDispatchTable();
const HipCompilerDispatchTable* GetHipCompilerDispatchTable();
const HipToolsDispatchTable* GetHipToolsDispatchTable();
template <typename T> T HandleException();
template <> hipError_t HandleException<hipError_t>();
} // namespace hip
#ifdef _WIN32
@@ -32,6 +34,9 @@ const HipToolsDispatchTable* GetHipToolsDispatchTable();
#define DllExport extern "C"
#endif // !_WIN32
#define TRY try {
#define CATCH } catch(...) { return hip::HandleException<hipError_t>(); }
DllExport hipError_t hipExtModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ,
uint32_t localWorkSizeX, uint32_t localWorkSizeY,
@@ -39,9 +44,11 @@ DllExport hipError_t hipExtModuleLaunchKernel(hipFunction_t f, uint32_t globalWo
hipStream_t hStream, void** kernelParams,
void** extra, hipEvent_t startEvent,
hipEvent_t stopEvent, uint32_t flags) {
TRY;
return hip::GetHipDispatchTable()->hipExtModuleLaunchKernel_fn(
f, globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ, localWorkSizeX, localWorkSizeY,
localWorkSizeZ, sharedMemBytes, hStream, kernelParams, extra, startEvent, stopEvent, flags);
CATCH;
}
DllExport hipError_t hipHccModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ,
@@ -50,7 +57,9 @@ DllExport hipError_t hipHccModuleLaunchKernel(hipFunction_t f, uint32_t globalWo
hipStream_t hStream, void** kernelParams,
void** extra, hipEvent_t startEvent,
hipEvent_t stopEvent) {
TRY;
return hip::GetHipDispatchTable()->hipHccModuleLaunchKernel_fn(
f, globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ, localWorkSizeX, localWorkSizeY,
localWorkSizeZ, sharedMemBytes, hStream, kernelParams, extra, startEvent, stopEvent);
CATCH;
}