@@ -5355,9 +5355,18 @@ static OmptKernelTimingArgsAsyncTy *getOmptTimingsArgs(void *Data) {
5355
5355
static std::pair<uint64_t , uint64_t >
5356
5356
getKernelStartAndEndTime (const OmptKernelTimingArgsAsyncTy *Args) {
5357
5357
assert (Args->Signal && " Invalid AMDGPUSignal Pointer in OMPT profiling" );
5358
- hsa_amd_profiling_dispatch_time_t TimeRec;
5359
- hsa_amd_profiling_get_dispatch_time (Args->Agent , Args->Signal ->get (),
5360
- &TimeRec);
5358
+ hsa_amd_profiling_dispatch_time_t TimeRec{0 , 0 };
5359
+ hsa_status_t Status = hsa_amd_profiling_get_dispatch_time (
5360
+ Args->Agent , Args->Signal ->get (), &TimeRec);
5361
+ if (auto Err = Plugin::check (
5362
+ Status,
5363
+ " WARNING Could not retrieve kernel dispatch timestamps: %s" )) {
5364
+ MESSAGE0 (toString (std::move (Err)).data ());
5365
+ static BoolEnvar OMPX_StrictSanityChecks{" OMPX_STRICT_SANITY_CHECKS" ,
5366
+ false };
5367
+ if (OMPX_StrictSanityChecks)
5368
+ llvm_unreachable (" User-requested hard stop on sanity check errors." );
5369
+ }
5361
5370
5362
5371
uint64_t StartTime = TimeRec.start * Args->TicksToTime ;
5363
5372
uint64_t EndTime = TimeRec.end * Args->TicksToTime ;
@@ -5368,8 +5377,18 @@ getKernelStartAndEndTime(const OmptKernelTimingArgsAsyncTy *Args) {
5368
5377
static std::pair<uint64_t , uint64_t >
5369
5378
getCopyStartAndEndTime (const OmptKernelTimingArgsAsyncTy *Args) {
5370
5379
assert (Args->Signal && " Invalid AMDGPUSignal Pointer in OMPT profiling" );
5371
- hsa_amd_profiling_async_copy_time_t TimeRec;
5372
- hsa_amd_profiling_get_async_copy_time (Args->Signal ->get (), &TimeRec);
5380
+ hsa_amd_profiling_async_copy_time_t TimeRec{0 , 0 };
5381
+ hsa_status_t Status =
5382
+ hsa_amd_profiling_get_async_copy_time (Args->Signal ->get (), &TimeRec);
5383
+ if (auto Err = Plugin::check (
5384
+ Status, " WARNING Could not retrieve data-copy timestamps: %s" )) {
5385
+ MESSAGE0 (toString (std::move (Err)).data ());
5386
+ static BoolEnvar OMPX_StrictSanityChecks{" OMPX_STRICT_SANITY_CHECKS" ,
5387
+ false };
5388
+ if (OMPX_StrictSanityChecks)
5389
+ llvm_unreachable (" User-requested hard stop on sanity check errors." );
5390
+ }
5391
+
5373
5392
uint64_t StartTime = TimeRec.start * Args->TicksToTime ;
5374
5393
uint64_t EndTime = TimeRec.end * Args->TicksToTime ;
5375
5394
0 commit comments