@@ -79,11 +79,11 @@ class TimeFrameGPU : public TimeFrame
7979class GPUDebugTiming
8080{
8181 public:
82- GPUDebugTiming (bool d, void ** t, hipStream_t* s, GPUReconstruction::krnlSetup& x, GPUReconstructionHIPBackend* r = nullptr ) : mDeviceTimers (t), mStreams (s), mXYZ (x), mRec (r), mDo (d)
82+ GPUDebugTiming (bool d, void ** t, hipStream_t* s, GPUReconstruction::krnlSetup& x, GPUReconstructionHIPBackend* r) : mDeviceTimers (t), mStreams (s), mXYZ (x), mRec (r), mDo (d)
8383 {
8484 if (mDo ) {
8585 if (mDeviceTimers ) {
86- GPUFailedMsg (hipEventRecord ((hipEvent_t)mDeviceTimers [0 ], mStreams [mXYZ .x .stream ]));
86+ mRec -> GPUFailedMsg (hipEventRecord ((hipEvent_t)mDeviceTimers [0 ], mStreams [mXYZ .x .stream ]));
8787 } else {
8888 mTimer .ResetStart ();
8989 }
@@ -93,13 +93,13 @@ class GPUDebugTiming
9393 {
9494 if (mDo ) {
9595 if (mDeviceTimers ) {
96- GPUFailedMsg (hipEventRecord ((hipEvent_t)mDeviceTimers [1 ], mStreams [mXYZ .x .stream ]));
97- GPUFailedMsg (hipEventSynchronize ((hipEvent_t)mDeviceTimers [1 ]));
96+ mRec -> GPUFailedMsg (hipEventRecord ((hipEvent_t)mDeviceTimers [1 ], mStreams [mXYZ .x .stream ]));
97+ mRec -> GPUFailedMsg (hipEventSynchronize ((hipEvent_t)mDeviceTimers [1 ]));
9898 float v;
99- GPUFailedMsg (hipEventElapsedTime (&v, (hipEvent_t)mDeviceTimers [0 ], (hipEvent_t)mDeviceTimers [1 ]));
99+ mRec -> GPUFailedMsg (hipEventElapsedTime (&v, (hipEvent_t)mDeviceTimers [0 ], (hipEvent_t)mDeviceTimers [1 ]));
100100 mXYZ .t = v * 1 .e -3 ;
101101 } else {
102- GPUFailedMsg (hipStreamSynchronize (mStreams [mXYZ .x .stream ]));
102+ mRec -> GPUFailedMsg (hipStreamSynchronize (mStreams [mXYZ .x .stream ]));
103103 mXYZ .t = mTimer .GetCurrentElapsedTime ();
104104 }
105105 }
@@ -211,6 +211,28 @@ GPUReconstructionHIPBackend::~GPUReconstructionHIPBackend()
211211 }
212212}
213213
214+ int GPUReconstructionHIPBackend::GPUFailedMsgAI (const long long int error, const char * file, int line)
215+ {
216+ // Check for HIP Error and in the case of an error display the corresponding error string
217+ if (error == hipSuccess) {
218+ return (0 );
219+ }
220+ GPUError (" HIP Error: %lld / %s (%s:%d)" , error, hipGetErrorString ((hipError_t)error), file, line);
221+ return 1 ;
222+ }
223+
224+ void GPUReconstructionHIPBackend::GPUFailedMsgA (const long long int error, const char * file, int line)
225+ {
226+ if (GPUFailedMsgAI (error, file, line)) {
227+ static bool runningCallbacks = false ;
228+ if (IsInitialized () && runningCallbacks == false ) {
229+ runningCallbacks = true ;
230+ CheckErrorCodes (false , true );
231+ }
232+ throw std::runtime_error (" HIP Failure" );
233+ }
234+ }
235+
214236GPUReconstruction* GPUReconstruction_Create_HIP (const GPUSettingsDeviceBackend& cfg) { return new GPUReconstructionHIP (cfg); }
215237
216238void GPUReconstructionHIPBackend::GetITSTraits (std::unique_ptr<o2::its::TrackerTraits>* trackerTraits, std::unique_ptr<o2::its::VertexerTraits>* vertexerTraits)
0 commit comments