Skip to content

Commit 668c5e5

Browse files
committed
[L0] Fix Multi Device Event handling and remove unhandled events from in order wait list
- fix multi device event creation to be enqueued as a barrier waiting on the original event keeping the multi device event valid. - Avoid wait on events on a multi device event given driver in order due to p2p errors for driver in order lists. Barrier from multi device event creation will guarantee in order execution. Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
1 parent 2ad3268 commit 668c5e5

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

source/adapters/level_zero/event.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,13 @@ ur_result_t urEnqueueEventsWaitWithBarrier(
196196
//
197197
if (Queue->isInOrderQueue() && InOrderBarrierBySignal &&
198198
!Queue->isProfilingEnabled()) {
199-
// If we are using driver in order lists, then append wait on events
200-
// is unnecessary IF the cmdlists match.
201199
if (EventWaitList.Length) {
202200
if (CmdList->second.IsInOrderList) {
203-
for (unsigned i = EventWaitList.Length; i-- < 0;) {
204-
// if the events is from the same cmdlist, we can remove it
205-
// from the waitlist.
206-
if (EventWaitList.UrEventList[i]->CommandList == CmdList) {
201+
for (unsigned i = EventWaitList.Length; i-- > 0;) {
202+
// If the event is a multidevice event, then given driver in order
203+
// lists, we cannot include this into the wait event list due to
204+
// driver limitations.
205+
if (EventWaitList.UrEventList[i]->IsMultiDevice) {
207206
EventWaitList.Length--;
208207
if (EventWaitList.Length != i) {
209208
std::swap(EventWaitList.UrEventList[i],
@@ -1562,16 +1561,11 @@ ur_result_t _ur_ze_event_list_t::createAndRetainUrZeEventList(
15621561
const auto &ZeCommandList = CommandList->first;
15631562
EventList[I]->RefCount.increment();
15641563

1565-
ZE2UR_CALL(zeCommandListAppendWaitOnEvents,
1566-
(ZeCommandList, 1u, &EventList[I]->ZeEvent));
1567-
if (!MultiDeviceEvent->CounterBasedEventsEnabled) {
1568-
ZE2UR_CALL(zeEventHostSignal, (MultiDeviceZeEvent));
1569-
} else {
1570-
ZE2UR_CALL(zeCommandListAppendSignalEvent,
1571-
(ZeCommandList, MultiDeviceZeEvent));
1572-
}
1573-
MultiDeviceEvent->Completed = true;
1574-
1564+
// Append a Barrier to wait on the original event while signalling the
1565+
// new multi device event.
1566+
ZE2UR_CALL(
1567+
zeCommandListAppendBarrier,
1568+
(ZeCommandList, MultiDeviceZeEvent, 1u, &EventList[I]->ZeEvent));
15751569
UR_CALL(Queue->executeCommandList(CommandList, /* IsBlocking */ false,
15761570
/* OkToBatchCommand */ true));
15771571

0 commit comments

Comments
 (0)