Skip to content

Commit

Permalink
Merge pull request #1835 from nrspruit/fix_timestamp_0_8_x
Browse files Browse the repository at this point in the history
Candidate for the v0.8.15 release tag
  • Loading branch information
kbenzie authored Jul 9, 2024
2 parents 05bb895 + 8672794 commit 14d4fba
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions source/adapters/level_zero/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions source/adapters/level_zero/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ZeStruct<ze_device_properties_t>> ZeDeviceProperties;
ZeCache<ZeStruct<ze_device_compute_properties_t>> ZeDeviceComputeProperties;
Expand Down
3 changes: 1 addition & 2 deletions source/adapters/level_zero/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 14d4fba

Please sign in to comment.