@@ -581,8 +581,7 @@ ur_result_t urEventGetProfilingInfo(
581581
582582 // End time needs to be adjusted for resolution and valid bits.
583583 uint64_t ContextEndTime =
584- (EndTimeRecording.RecordEventEndTimestamp & TimestampMaxValue) *
585- ZeTimerResolution;
584+ (EndTimeRecording & TimestampMaxValue) * ZeTimerResolution;
586585
587586 // If the result is 0, we have not yet gotten results back and so we just
588587 // return it.
@@ -755,20 +754,20 @@ ur_result_t urEnqueueTimestampRecordingExp(
755754 ze_event_handle_t ZeEvent = (*OutEvent)->ZeEvent ;
756755 (*OutEvent)->WaitList = TmpWaitList;
757756
757+ // Reset the end timestamp, in case it has been previously used.
758+ (*OutEvent)->RecordEventEndTimestamp = 0 ;
759+
758760 uint64_t DeviceStartTimestamp = 0 ;
759761 UR_CALL (ur::level_zero::urDeviceGetGlobalTimestamps (
760762 Device, &DeviceStartTimestamp, nullptr ));
761763 (*OutEvent)->RecordEventStartTimestamp = DeviceStartTimestamp;
762764
763765 // 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 ;
766767
767768 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 ));
772771
773772 UR_CALL (
774773 Queue->executeCommandList (CommandList, Blocking, false /* OkToBatch */ ));
@@ -1096,10 +1095,11 @@ ur_result_t urEventReleaseInternal(ur_event_handle_t Event) {
10961095 auto Entry = Queue->EndTimeRecordings .find (Event);
10971096 if (Entry != Queue->EndTimeRecordings .end ()) {
10981097 auto &EndTimeRecording = Entry->second ;
1099- if (EndTimeRecording. RecordEventEndTimestamp == 0 ) {
1098+ if (EndTimeRecording == 0 ) {
11001099 // If the end time recording has not finished, we tell the queue that
11011100 // the event is no longer alive to avoid invalid write-backs.
1102- EndTimeRecording.EventHasDied = true ;
1101+ Queue->EvictedEndTimeRecordings .insert (
1102+ Queue->EndTimeRecordings .extract (Entry));
11031103 } else {
11041104 // Otherwise we evict the entry.
11051105 Queue->EndTimeRecordings .erase (Entry);
0 commit comments