Skip to content

Commit b487b62

Browse files
authored
Merge pull request oneapi-src#2612 from nrspruit/destroy_wait_always
[L0]: fix missing destroy of event given enqueue wait out event
2 parents af4f331 + 21bf4be commit b487b62

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

source/adapters/level_zero/event.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,14 @@ ur_result_t
887887

888888
urEventRelease(/** [in] handle of the event object */ ur_event_handle_t Event) {
889889
Event->RefCountExternal--;
890+
bool isEventsWaitCompleted =
891+
Event->CommandType == UR_COMMAND_EVENTS_WAIT && Event->Completed;
890892
UR_CALL(urEventReleaseInternal(Event));
893+
// If this is a Completed Event Wait Out Event, then we need to cleanup the
894+
// event at user release and not at the time of completion.
895+
if (isEventsWaitCompleted) {
896+
UR_CALL(CleanupCompletedEvent((Event), false, false));
897+
}
891898

892899
return UR_RESULT_SUCCESS;
893900
}

0 commit comments

Comments
 (0)