Skip to content

Commit 3815670

Browse files
authored
Fix issue when kernelTimestampValidBits is 64 (intel#54)
Signed-off-by: Yao, Yi <[email protected]>
1 parent 9563f1e commit 3815670

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

sdk/src/utils/ze_utils.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,8 @@ inline uint64_t GetDeviceTimestampMask(ze_device_handle_t device) {
510510
o_api_string.c_str());
511511
};
512512
PTI_ASSERT(status == ZE_RESULT_SUCCESS);
513-
return (1ull << props.kernelTimestampValidBits) - 1ull;
513+
return ((props.kernelTimestampValidBits == 64) ? std::numeric_limits<uint64_t>::max()
514+
: ((1ull << props.kernelTimestampValidBits) - 1ull));
514515
}
515516

516517
inline uint64_t GetMetricTimestampMask(ze_device_handle_t device) {
@@ -532,7 +533,8 @@ inline uint64_t GetMetricTimestampMask(ze_device_handle_t device) {
532533
if ((devicemask == 0x5600) || (devicemask == 0x4F00) || (devicemask == 0x0B00)) {
533534
return (1ull << (props.kernelTimestampValidBits - 1)) - 1ull;
534535
} else {
535-
return (1ull << props.kernelTimestampValidBits) - 1ull;
536+
return ((props.kernelTimestampValidBits == 64) ? std::numeric_limits<uint64_t>::max()
537+
: ((1ull << props.kernelTimestampValidBits) - 1ull));
536538
}
537539
#endif
538540
}

utils/ze_utils.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ inline uint64_t GetDeviceTimestampMask(ze_device_handle_t device) {
356356
ze_device_properties_t props{ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2, };
357357
ze_result_t status = zeDeviceGetProperties(device, &props);
358358
PTI_ASSERT(status == ZE_RESULT_SUCCESS);
359-
return (1ull << props.kernelTimestampValidBits) - 1ull;
359+
return ((props.kernelTimestampValidBits == 64) ? std::numeric_limits<uint64_t>::max()
360+
: ((1ull << props.kernelTimestampValidBits) - 1ull));
360361
}
361362

362363
inline uint64_t GetMetricTimestampMask(ze_device_handle_t device) {
@@ -371,7 +372,8 @@ inline uint64_t GetMetricTimestampMask(ze_device_handle_t device) {
371372
return (1ull << (props.kernelTimestampValidBits - 1)) - 1ull;
372373
}
373374
else {
374-
return (1ull << props.kernelTimestampValidBits) - 1ull;
375+
return ((props.kernelTimestampValidBits == 64) ? std::numeric_limits<uint64_t>::max()
376+
: ((1ull << props.kernelTimestampValidBits) - 1ull));
375377
}
376378
#endif
377379
}

0 commit comments

Comments
 (0)