Skip to content

Commit 33bf61c

Browse files
committed
[L0] fix Append Barrier to only occur when at least one inner event exists
Signed-off-by: Neil R. Spruit <[email protected]>
1 parent 6812c82 commit 33bf61c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

source/adapters/level_zero/event.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventWait(
691691

692692
ze_event_handle_t ZeEvent = HostVisibleEvent->ZeEvent;
693693
logger::debug("ZeEvent = {}", ur_cast<std::uintptr_t>(ZeEvent));
694-
// If this event was an inner batched event, then lock and sync with
694+
// If this event was an inner batched event, then sync with
695695
// the Queue instead of waiting on the event.
696696
if (HostVisibleEvent->IsInnerBatchedEvent && Event->ZeBatchedQueue) {
697697
ZE2UR_CALL(zeHostSynchronize, (Event->ZeBatchedQueue));

source/adapters/level_zero/queue.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,12 +1406,13 @@ ur_queue_handle_t_::executeCommandList(ur_command_list_ptr_t CommandList,
14061406
this->signalEventFromCmdListIfLastEventDiscarded(CommandList);
14071407
}
14081408
// Append Signalling of the inner events at the end of the batch
1409-
if (CommandList->second.EventList.size() > 0 && AppendBarrierNeeded) {
1410-
ZE2UR_CALL(zeCommandListAppendBarrier,
1411-
(CommandList->first, nullptr, 0, nullptr));
1412-
}
14131409
for (auto &Event : CommandList->second.EventList) {
14141410
if (Event->IsInnerBatchedEvent) {
1411+
if (AppendBarrierNeeded) {
1412+
ZE2UR_CALL(zeCommandListAppendBarrier,
1413+
(CommandList->first, nullptr, 0, nullptr));
1414+
AppendBarrierNeeded = false;
1415+
}
14151416
ZE2UR_CALL(zeCommandListAppendSignalEvent,
14161417
(CommandList->first, Event->ZeEvent));
14171418
}

0 commit comments

Comments
 (0)