@@ -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