@@ -114,35 +114,33 @@ ur_result_t urEnqueueEventsWait(
114114 false /* OKToBatchCommand*/ );
115115 }
116116
117- {
118- // If wait-list is empty, then this particular command should wait until
119- // all previous enqueued commands to the command-queue have completed.
120- //
121- // TODO: find a way to do that without blocking the host.
117+ // If wait-list is empty, then this particular command should wait until
118+ // all previous enqueued commands to the command-queue have completed.
119+ //
120+ // TODO: find a way to do that without blocking the host.
122121
123- // Lock automatically releases when this goes out of scope.
124- std::scoped_lock<ur_shared_mutex> lock (Queue->Mutex );
122+ // Lock automatically releases when this goes out of scope.
123+ std::scoped_lock<ur_shared_mutex> lock (Queue->Mutex );
125124
126- if (OutEvent) {
127- UR_CALL (createEventAndAssociateQueue (Queue, OutEvent,
128- UR_COMMAND_EVENTS_WAIT,
129- Queue->CommandListMap .end (), false ,
130- /* IsInternal */ false ));
131- }
125+ if (OutEvent) {
126+ UR_CALL (createEventAndAssociateQueue (Queue, OutEvent,
127+ UR_COMMAND_EVENTS_WAIT,
128+ Queue->CommandListMap .end (), false ,
129+ /* IsInternal */ false ));
130+ }
132131
133- UR_CALL (Queue->synchronize ());
132+ UR_CALL (Queue->executeAllOpenCommandLists ());
133+ UR_CALL (Queue->synchronize ());
134134
135- if (OutEvent) {
136- Queue->LastCommandEvent = reinterpret_cast <ur_event_handle_t >(*OutEvent);
135+ if (OutEvent) {
136+ Queue->LastCommandEvent = reinterpret_cast <ur_event_handle_t >(*OutEvent);
137137
138- if (!(*OutEvent)->CounterBasedEventsEnabled )
139- ZE2UR_CALL (zeEventHostSignal, ((*OutEvent)->ZeEvent ));
140- (*OutEvent)->Completed = true ;
141- }
138+ if (!(*OutEvent)->CounterBasedEventsEnabled )
139+ ZE2UR_CALL (zeEventHostSignal, ((*OutEvent)->ZeEvent ));
140+ (*OutEvent)->Completed = true ;
142141 }
143142
144143 if (!Queue->UsingImmCmdLists ) {
145- std::unique_lock<ur_shared_mutex> Lock (Queue->Mutex );
146144 resetCommandLists (Queue);
147145 }
148146
0 commit comments