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(
1555
1555
) {
1556
1556
const uint64_t &ZeTimerResolution =
1557
1557
Device->ZeDeviceProperties ->timerResolution ;
1558
- const uint64_t TimestampMaxCount =
1559
- ((1ULL << Device->ZeDeviceProperties ->kernelTimestampValidBits ) - 1ULL );
1558
+ const uint64_t TimestampMaxCount = Device->getTimestampMask ();
1560
1559
uint64_t DeviceClockCount, Dummy;
1561
1560
1562
1561
ZE2UR_CALL (zeDeviceGetGlobalTimestamps,
Original file line number Diff line number Diff line change @@ -198,6 +198,12 @@ struct ur_device_handle_t_ : _ur_object {
198
198
.ZeIndex >= 0 ;
199
199
}
200
200
201
+ uint64_t getTimestampMask () {
202
+ auto ValidBits = ZeDeviceProperties->kernelTimestampValidBits ;
203
+ assert (ValidBits <= 64 );
204
+ return ValidBits == 64 ? ~0ULL : (1ULL << ValidBits) - 1ULL ;
205
+ }
206
+
201
207
// Cache of the immutable device properties.
202
208
ZeCache<ZeStruct<ze_device_properties_t >> ZeDeviceProperties;
203
209
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(
494
494
: Event->Context ->Devices [0 ];
495
495
496
496
uint64_t ZeTimerResolution = Device->ZeDeviceProperties ->timerResolution ;
497
- const uint64_t TimestampMaxValue =
498
- ((1ULL << Device->ZeDeviceProperties ->kernelTimestampValidBits ) - 1ULL );
497
+ const uint64_t TimestampMaxValue = Device->getTimestampMask ();
499
498
500
499
UrReturnHelper ReturnValue (PropValueSize, PropValue, PropValueSizeRet);
501
500
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