diff --git a/CMakeLists.txt b/CMakeLists.txt index 54b4473e9e..467ba2eddd 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.8.14) +project(unified-runtime VERSION 0.8.15) include(GNUInstallDirs) include(CheckCXXSourceCompiles) diff --git a/source/adapters/level_zero/device.cpp b/source/adapters/level_zero/device.cpp index 89599fdfe3..75f49bf580 100644 --- a/source/adapters/level_zero/device.cpp +++ b/source/adapters/level_zero/device.cpp @@ -1353,8 +1353,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 94480336c5..60c267f005 100644 --- a/source/adapters/level_zero/device.hpp +++ b/source/adapters/level_zero/device.hpp @@ -179,6 +179,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 ed7412d3d6..f5b78566fc 100644 --- a/source/adapters/level_zero/event.cpp +++ b/source/adapters/level_zero/event.cpp @@ -468,8 +468,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);