Skip to content

Commit 1db8fbf

Browse files
mfrancepilloiskbenzie
authored andcommitted
Fixes event leak
1 parent bd25d68 commit 1db8fbf

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

source/adapters/level_zero/command_buffer.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp(
939939
// Create a command-list to signal RetEvent on completion
940940
ur_command_list_ptr_t SignalCommandList{};
941941
if (Event) {
942-
ur_event_handle_t SyncEvent = CommandBuffer->SignalEvent;
943942
UR_CALL(Queue->Context->getAvailableCommandList(Queue, SignalCommandList,
944943
false, false));
945944

@@ -954,9 +953,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp(
954953
// before completing the command buffer execution, and then attach this
955954
// memory to the event returned to users to allow to allow the profiling
956955
// engine to recover these timestamps.
957-
UR_CALL(createEventAndAssociateQueue(
958-
Queue, &SyncEvent, UR_COMMAND_USM_MEMCPY, SignalCommandList, false));
959-
960956
command_buffer_profiling_t *Profiling = new command_buffer_profiling_t();
961957

962958
Profiling->NumEvents = WaitEventList.size();
@@ -966,15 +962,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp(
966962
ZE2UR_CALL(zeCommandListAppendQueryKernelTimestamps,
967963
(SignalCommandList->first, WaitEventList.size(),
968964
WaitEventList.data(), (void *)Profiling->Timestamps, 0,
969-
SyncEvent->ZeEvent, 1,
965+
RetEvent->ZeEvent, 1,
970966
&(CommandBuffer->SignalEvent->ZeEvent)));
971967

972968
RetEvent->CommandData = static_cast<void *>(Profiling);
969+
} else {
970+
ZE2UR_CALL(zeCommandListAppendBarrier,
971+
(SignalCommandList->first, RetEvent->ZeEvent, 1,
972+
&(CommandBuffer->SignalEvent->ZeEvent)));
973973
}
974-
975-
ZE2UR_CALL(zeCommandListAppendBarrier,
976-
(SignalCommandList->first, RetEvent->ZeEvent, 1,
977-
&(SyncEvent->ZeEvent)));
978974
}
979975

980976
// Execution our command-lists asynchronously

0 commit comments

Comments
 (0)