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 @@ -1545,8 +1545,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetGlobalTimestamps(
15451545) {
15461546 const uint64_t &ZeTimerResolution =
15471547 Device->ZeDeviceProperties ->timerResolution ;
1548- const uint64_t TimestampMaxCount =
1549- ((1ULL << Device->ZeDeviceProperties ->kernelTimestampValidBits ) - 1ULL );
1548+ const uint64_t TimestampMaxCount = Device->getTimestampMask ();
15501549 uint64_t DeviceClockCount, Dummy;
15511550
15521551 ZE2UR_CALL (zeDeviceGetGlobalTimestamps,
Original file line number Diff line number Diff line change @@ -186,6 +186,12 @@ struct ur_device_handle_t_ : _ur_object {
186186 .ZeIndex >= 0 ;
187187 }
188188
189+ uint64_t getTimestampMask () {
190+ auto ValidBits = ZeDeviceProperties->kernelTimestampValidBits ;
191+ assert (ValidBits <= 64 );
192+ return ValidBits == 64 ? ~0ULL : (1ULL << ValidBits) - 1ULL ;
193+ }
194+
189195 // Cache of the immutable device properties.
190196 ZeCache<ZeStruct<ze_device_properties_t >> ZeDeviceProperties;
191197 ZeCache<ZeStruct<ze_device_compute_properties_t >> ZeDeviceComputeProperties;
Original file line number Diff line number Diff line change @@ -493,8 +493,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventGetProfilingInfo(
493493 : Event->Context ->Devices [0 ];
494494
495495 uint64_t ZeTimerResolution = Device->ZeDeviceProperties ->timerResolution ;
496- const uint64_t TimestampMaxValue =
497- ((1ULL << Device->ZeDeviceProperties ->kernelTimestampValidBits ) - 1ULL );
496+ const uint64_t TimestampMaxValue = Device->getTimestampMask ();
498497
499498 UrReturnHelper ReturnValue (PropValueSize, PropValue, PropValueSizeRet);
500499
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