AIRUNTIME-32 - Add try/catch around all HIP API calls (#2822)
Αυτή η υποβολή περιλαμβάνεται σε:
υποβλήθηκε από
GitHub
γονέας
340f3aa887
υποβολή
2b1b41f4da
Το diff αρχείου καταστέλλεται επειδή είναι πολύ μεγάλο
Φόρτωση Διαφορών
@@ -24,6 +24,8 @@ namespace hip {
|
|||||||
const HipDispatchTable* GetHipDispatchTable();
|
const HipDispatchTable* GetHipDispatchTable();
|
||||||
const HipCompilerDispatchTable* GetHipCompilerDispatchTable();
|
const HipCompilerDispatchTable* GetHipCompilerDispatchTable();
|
||||||
const HipToolsDispatchTable* GetHipToolsDispatchTable();
|
const HipToolsDispatchTable* GetHipToolsDispatchTable();
|
||||||
|
template <typename T> T HandleException();
|
||||||
|
template <> hipError_t HandleException<hipError_t>();
|
||||||
} // namespace hip
|
} // namespace hip
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -32,6 +34,9 @@ const HipToolsDispatchTable* GetHipToolsDispatchTable();
|
|||||||
#define DllExport extern "C"
|
#define DllExport extern "C"
|
||||||
#endif // !_WIN32
|
#endif // !_WIN32
|
||||||
|
|
||||||
|
#define TRY try {
|
||||||
|
#define CATCH } catch(...) { return hip::HandleException<hipError_t>(); }
|
||||||
|
|
||||||
DllExport hipError_t hipExtModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
|
DllExport hipError_t hipExtModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
|
||||||
uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ,
|
uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ,
|
||||||
uint32_t localWorkSizeX, uint32_t localWorkSizeY,
|
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,
|
hipStream_t hStream, void** kernelParams,
|
||||||
void** extra, hipEvent_t startEvent,
|
void** extra, hipEvent_t startEvent,
|
||||||
hipEvent_t stopEvent, uint32_t flags) {
|
hipEvent_t stopEvent, uint32_t flags) {
|
||||||
|
TRY;
|
||||||
return hip::GetHipDispatchTable()->hipExtModuleLaunchKernel_fn(
|
return hip::GetHipDispatchTable()->hipExtModuleLaunchKernel_fn(
|
||||||
f, globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ, localWorkSizeX, localWorkSizeY,
|
f, globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ, localWorkSizeX, localWorkSizeY,
|
||||||
localWorkSizeZ, sharedMemBytes, hStream, kernelParams, extra, startEvent, stopEvent, flags);
|
localWorkSizeZ, sharedMemBytes, hStream, kernelParams, extra, startEvent, stopEvent, flags);
|
||||||
|
CATCH;
|
||||||
}
|
}
|
||||||
DllExport hipError_t hipHccModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
|
DllExport hipError_t hipHccModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
|
||||||
uint32_t globalWorkSizeY, uint32_t globalWorkSizeZ,
|
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,
|
hipStream_t hStream, void** kernelParams,
|
||||||
void** extra, hipEvent_t startEvent,
|
void** extra, hipEvent_t startEvent,
|
||||||
hipEvent_t stopEvent) {
|
hipEvent_t stopEvent) {
|
||||||
|
TRY;
|
||||||
return hip::GetHipDispatchTable()->hipHccModuleLaunchKernel_fn(
|
return hip::GetHipDispatchTable()->hipHccModuleLaunchKernel_fn(
|
||||||
f, globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ, localWorkSizeX, localWorkSizeY,
|
f, globalWorkSizeX, globalWorkSizeY, globalWorkSizeZ, localWorkSizeX, localWorkSizeY,
|
||||||
localWorkSizeZ, sharedMemBytes, hStream, kernelParams, extra, startEvent, stopEvent);
|
localWorkSizeZ, sharedMemBytes, hStream, kernelParams, extra, startEvent, stopEvent);
|
||||||
|
CATCH;
|
||||||
}
|
}
|
||||||
|
|||||||
Αναφορά σε νέο ζήτημα
Block a user