From cdfe431facb738aad2d00a6d7f7039b3013f8a4a Mon Sep 17 00:00:00 2001 From: "Yao, Yi" Date: Thu, 25 Jan 2024 07:10:01 +0000 Subject: [PATCH] Fix issue when kernelTimestampValidBits is 64 Signed-off-by: Yao, Yi --- utils/ze_utils.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/ze_utils.h b/utils/ze_utils.h index e324903..50f983b 100644 --- a/utils/ze_utils.h +++ b/utils/ze_utils.h @@ -356,7 +356,8 @@ inline uint64_t GetDeviceTimestampMask(ze_device_handle_t device) { ze_device_properties_t props{ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2, }; ze_result_t status = zeDeviceGetProperties(device, &props); PTI_ASSERT(status == ZE_RESULT_SUCCESS); - return (1ull << props.kernelTimestampValidBits) - 1ull; + return ((props.kernelTimestampValidBits == 64) ? std::numeric_limits::max() + : ((1ull << props.kernelTimestampValidBits) - 1ull)); } inline uint64_t GetMetricTimestampMask(ze_device_handle_t device) { @@ -371,7 +372,8 @@ inline uint64_t GetMetricTimestampMask(ze_device_handle_t device) { return (1ull << (props.kernelTimestampValidBits - 1)) - 1ull; } else { - return (1ull << props.kernelTimestampValidBits) - 1ull; + return ((props.kernelTimestampValidBits == 64) ? std::numeric_limits::max() + : ((1ull << props.kernelTimestampValidBits) - 1ull)); } #endif }