Skip to content

Commit 8ccf75a

Browse files
committed
[L0] Queue Sync given event wait on inner batched event
Signed-off-by: Neil R. Spruit <[email protected]>
1 parent ccd73c7 commit 8ccf75a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

source/adapters/level_zero/event.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,14 @@ 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-
ZE2UR_CALL(zeHostSynchronize, (ZeEvent));
694+
// If this event was an inner batched event, then lock and sync with
695+
// the Queue instead of waiting on the event.
696+
if (HostVisibleEvent->IsInnerBatchedEvent && Event->UrQueue) {
697+
std::scoped_lock<ur_shared_mutex> Lock(Event->UrQueue->Mutex);
698+
UR_CALL(Event->UrQueue->synchronize());
699+
} else {
700+
ZE2UR_CALL(zeHostSynchronize, (ZeEvent));
701+
}
695702
Event->Completed = true;
696703
}
697704
}

0 commit comments

Comments
 (0)