AIRUNTIME-32 - Add try/catch around all HIP API calls (#2822)
This commit is contained in:
committed by
GitHub
orang tua
340f3aa887
melakukan
2b1b41f4da
File diff ditekan karena terlalu besar
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user