Skip to content

Commit c8a787a

Browse files
authored
Merge pull request #2452 from winstonzhang-intel/urlza-414
[L0] Fixed event leak when outevent is given and is completed
2 parents 721dfa9 + 3be3918 commit c8a787a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

source/adapters/level_zero/event.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ ur_result_t urEnqueueEventsWait(
145145
std::unique_lock<ur_shared_mutex> Lock(Queue->Mutex);
146146
resetCommandLists(Queue);
147147
}
148+
if (OutEvent && (*OutEvent)->Completed) {
149+
UR_CALL(CleanupCompletedEvent((*OutEvent), false, false));
150+
UR_CALL(urEventReleaseInternal((*OutEvent)));
151+
}
148152

149153
return UR_RESULT_SUCCESS;
150154
}
@@ -955,7 +959,6 @@ ur_result_t urEventCreateWithNativeHandle(
955959
UREvent = new ur_event_handle_t_(ZeEvent, nullptr /* ZeEventPool */,
956960
Context, UR_EXT_COMMAND_TYPE_USER,
957961
Properties->isNativeHandleOwned);
958-
959962
UREvent->RefCountExternal++;
960963

961964
} catch (const std::bad_alloc &) {

0 commit comments

Comments
 (0)