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(
1545
1545
) {
1546
1546
const uint64_t &ZeTimerResolution =
1547
1547
Device->ZeDeviceProperties ->timerResolution ;
1548
- const uint64_t TimestampMaxCount =
1549
- ((1ULL << Device->ZeDeviceProperties ->kernelTimestampValidBits ) - 1ULL );
1548
+ const uint64_t TimestampMaxCount = Device->getTimestampMask ();
1550
1549
uint64_t DeviceClockCount, Dummy;
1551
1550
1552
1551
ZE2UR_CALL (zeDeviceGetGlobalTimestamps,
Original file line number Diff line number Diff line change @@ -186,6 +186,12 @@ struct ur_device_handle_t_ : _ur_object {
186
186
.ZeIndex >= 0 ;
187
187
}
188
188
189
+ uint64_t getTimestampMask () {
190
+ auto ValidBits = ZeDeviceProperties->kernelTimestampValidBits ;
191
+ assert (ValidBits <= 64 );
192
+ return ValidBits == 64 ? ~0ULL : (1ULL << ValidBits) - 1ULL ;
193
+ }
194
+
189
195
// Cache of the immutable device properties.
190
196
ZeCache<ZeStruct<ze_device_properties_t >> ZeDeviceProperties;
191
197
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(
493
493
: Event->Context ->Devices [0 ];
494
494
495
495
uint64_t ZeTimerResolution = Device->ZeDeviceProperties ->timerResolution ;
496
- const uint64_t TimestampMaxValue =
497
- ((1ULL << Device->ZeDeviceProperties ->kernelTimestampValidBits ) - 1ULL );
496
+ const uint64_t TimestampMaxValue = Device->getTimestampMask ();
498
497
499
498
UrReturnHelper ReturnValue (PropValueSize, PropValue, PropValueSizeRet);
500
499
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() {
1550
1550
1551
1551
void ur_queue_handle_legacy_t_::clearEndTimeRecordings () {
1552
1552
uint64_t ZeTimerResolution = Device->ZeDeviceProperties ->timerResolution ;
1553
- const uint64_t TimestampMaxValue =
1554
- ((1ULL << Device->ZeDeviceProperties ->kernelTimestampValidBits ) - 1ULL );
1553
+ const uint64_t TimestampMaxValue = Device->getTimestampMask ();
1555
1554
1556
1555
for (auto Entry : EndTimeRecordings) {
1557
1556
auto &Event = Entry.first ;
You can’t perform that action at this time.
0 commit comments