diff --git a/CMakeLists.txt b/CMakeLists.txt index 03768fc7e8..b82a58a4ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR) -project(unified-runtime VERSION 0.9.7) +project(unified-runtime VERSION 0.9.8) include(GNUInstallDirs) include(CheckCXXSourceCompiles) diff --git a/source/adapters/level_zero/device.cpp b/source/adapters/level_zero/device.cpp index b0a5f3fefa..6817c6f2ab 100644 --- a/source/adapters/level_zero/device.cpp +++ b/source/adapters/level_zero/device.cpp @@ -1514,8 +1514,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetGlobalTimestamps( ) { const uint64_t &ZeTimerResolution = Device->ZeDeviceProperties->timerResolution; - const uint64_t TimestampMaxCount = - ((1ULL << Device->ZeDeviceProperties->kernelTimestampValidBits) - 1ULL); + const uint64_t TimestampMaxCount = Device->getTimestampMask(); uint64_t DeviceClockCount, Dummy; ZE2UR_CALL(zeDeviceGetGlobalTimestamps, diff --git a/source/adapters/level_zero/device.hpp b/source/adapters/level_zero/device.hpp index 3cdfcbce7e..08589d74a4 100644 --- a/source/adapters/level_zero/device.hpp +++ b/source/adapters/level_zero/device.hpp @@ -186,6 +186,12 @@ struct ur_device_handle_t_ : _ur_object { .ZeIndex >= 0; } + uint64_t getTimestampMask() { + auto ValidBits = ZeDeviceProperties->kernelTimestampValidBits; + assert(ValidBits <= 64); + return ValidBits == 64 ? ~0ULL : (1ULL << ValidBits) - 1ULL; + } + // Cache of the immutable device properties. ZeCache> ZeDeviceProperties; ZeCache> ZeDeviceComputeProperties; diff --git a/source/adapters/level_zero/event.cpp b/source/adapters/level_zero/event.cpp index 8ce798aa2d..0619b5b9fc 100644 --- a/source/adapters/level_zero/event.cpp +++ b/source/adapters/level_zero/event.cpp @@ -486,8 +486,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventGetProfilingInfo( Event->UrQueue ? Event->UrQueue->Device : Event->Context->Devices[0]; uint64_t ZeTimerResolution = Device->ZeDeviceProperties->timerResolution; - const uint64_t TimestampMaxValue = - ((1ULL << Device->ZeDeviceProperties->kernelTimestampValidBits) - 1ULL); + const uint64_t TimestampMaxValue = Device->getTimestampMask(); UrReturnHelper ReturnValue(PropValueSize, PropValue, PropValueSizeRet);