File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed
source/adapters/level_zero Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -1555,8 +1555,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetGlobalTimestamps(
15551555) {
15561556 const uint64_t &ZeTimerResolution =
15571557 Device->ZeDeviceProperties ->timerResolution ;
1558- const uint64_t TimestampMaxCount =
1559- ((1ULL << Device->ZeDeviceProperties ->kernelTimestampValidBits ) - 1ULL );
1558+ const uint64_t TimestampMaxCount = Device->getTimestampMask ();
15601559 uint64_t DeviceClockCount, Dummy;
15611560
15621561 ZE2UR_CALL (zeDeviceGetGlobalTimestamps,
Original file line number Diff line number Diff line change @@ -198,6 +198,12 @@ struct ur_device_handle_t_ : _ur_object {
198198 .ZeIndex >= 0 ;
199199 }
200200
201+ uint64_t getTimestampMask () {
202+ auto ValidBits = ZeDeviceProperties->kernelTimestampValidBits ;
203+ assert (ValidBits <= 64 );
204+ return ValidBits == 64 ? ~0ULL : (1ULL << ValidBits) - 1ULL ;
205+ }
206+
201207 // Cache of the immutable device properties.
202208 ZeCache<ZeStruct<ze_device_properties_t >> ZeDeviceProperties;
203209 ZeCache<ZeStruct<ze_device_compute_properties_t >> ZeDeviceComputeProperties;
Original file line number Diff line number Diff line change @@ -494,8 +494,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventGetProfilingInfo(
494494 : Event->Context ->Devices [0 ];
495495
496496 uint64_t ZeTimerResolution = Device->ZeDeviceProperties ->timerResolution ;
497- const uint64_t TimestampMaxValue =
498- ((1ULL << Device->ZeDeviceProperties ->kernelTimestampValidBits ) - 1ULL );
497+ const uint64_t TimestampMaxValue = Device->getTimestampMask ();
499498
500499 UrReturnHelper ReturnValue (PropValueSize, PropValue, PropValueSizeRet);
501500
Original file line number Diff line number Diff line change @@ -1550,8 +1550,7 @@ ur_result_t ur_queue_handle_legacy_t_::active_barriers::clear() {
15501550
15511551void ur_queue_handle_legacy_t_::clearEndTimeRecordings () {
15521552 uint64_t ZeTimerResolution = Device->ZeDeviceProperties ->timerResolution ;
1553- const uint64_t TimestampMaxValue =
1554- ((1ULL << Device->ZeDeviceProperties ->kernelTimestampValidBits ) - 1ULL );
1553+ const uint64_t TimestampMaxValue = Device->getTimestampMask ();
15551554
15561555 for (auto Entry : EndTimeRecordings) {
15571556 auto &Event = Entry.first ;
You can’t perform that action at this time.
0 commit comments