Skip to content

Commit

Permalink
Merge pull request #1834 from nrspruit/fix_timestamp_0_9_x
Browse files Browse the repository at this point in the history
Candidate for the v0.9.8 release tag
  • Loading branch information
kbenzie authored Jul 9, 2024
2 parents 3ade8aa + 394bdaa commit 17566f5
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.9.7)
project(unified-runtime VERSION 0.9.8)

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 @@ -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,
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 @@ -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<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 @@ -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);

Expand Down

0 comments on commit 17566f5

Please sign in to comment.