@@ -581,8 +581,7 @@ ur_result_t urEventGetProfilingInfo(
581
581
582
582
// End time needs to be adjusted for resolution and valid bits.
583
583
uint64_t ContextEndTime =
584
- (EndTimeRecording.RecordEventEndTimestamp & TimestampMaxValue) *
585
- ZeTimerResolution;
584
+ (EndTimeRecording & TimestampMaxValue) * ZeTimerResolution;
586
585
587
586
// If the result is 0, we have not yet gotten results back and so we just
588
587
// return it.
@@ -755,20 +754,20 @@ ur_result_t urEnqueueTimestampRecordingExp(
755
754
ze_event_handle_t ZeEvent = (*OutEvent)->ZeEvent ;
756
755
(*OutEvent)->WaitList = TmpWaitList;
757
756
757
+ // Reset the end timestamp, in case it has been previously used.
758
+ (*OutEvent)->RecordEventEndTimestamp = 0 ;
759
+
758
760
uint64_t DeviceStartTimestamp = 0 ;
759
761
UR_CALL (ur::level_zero::urDeviceGetGlobalTimestamps (
760
762
Device, &DeviceStartTimestamp, nullptr ));
761
763
(*OutEvent)->RecordEventStartTimestamp = DeviceStartTimestamp;
762
764
763
765
// Create a new entry in the queue's recordings.
764
- Queue->EndTimeRecordings [*OutEvent] =
765
- ur_queue_handle_t_::end_time_recording{};
766
+ Queue->EndTimeRecordings [*OutEvent] = 0 ;
766
767
767
768
ZE2UR_CALL (zeCommandListAppendWriteGlobalTimestamp,
768
- (CommandList->first ,
769
- &Queue->EndTimeRecordings [*OutEvent].RecordEventEndTimestamp ,
770
- ZeEvent, (*OutEvent)->WaitList .Length ,
771
- (*OutEvent)->WaitList .ZeEventList ));
769
+ (CommandList->first , &Queue->EndTimeRecordings [*OutEvent], ZeEvent,
770
+ (*OutEvent)->WaitList .Length , (*OutEvent)->WaitList .ZeEventList ));
772
771
773
772
UR_CALL (
774
773
Queue->executeCommandList (CommandList, Blocking, false /* OkToBatch */ ));
@@ -1096,10 +1095,11 @@ ur_result_t urEventReleaseInternal(ur_event_handle_t Event) {
1096
1095
auto Entry = Queue->EndTimeRecordings .find (Event);
1097
1096
if (Entry != Queue->EndTimeRecordings .end ()) {
1098
1097
auto &EndTimeRecording = Entry->second ;
1099
- if (EndTimeRecording. RecordEventEndTimestamp == 0 ) {
1098
+ if (EndTimeRecording == 0 ) {
1100
1099
// If the end time recording has not finished, we tell the queue that
1101
1100
// the event is no longer alive to avoid invalid write-backs.
1102
- EndTimeRecording.EventHasDied = true ;
1101
+ Queue->EvictedEndTimeRecordings .insert (
1102
+ Queue->EndTimeRecordings .extract (Entry));
1103
1103
} else {
1104
1104
// Otherwise we evict the entry.
1105
1105
Queue->EndTimeRecordings .erase (Entry);
0 commit comments