@@ -114,35 +114,33 @@ ur_result_t urEnqueueEventsWait(
114
114
false /* OKToBatchCommand*/ );
115
115
}
116
116
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.
122
121
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 );
125
124
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
+ }
132
131
133
- UR_CALL (Queue->synchronize ());
132
+ UR_CALL (Queue->executeAllOpenCommandLists ());
133
+ UR_CALL (Queue->synchronize ());
134
134
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);
137
137
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 ;
142
141
}
143
142
144
143
if (!Queue->UsingImmCmdLists ) {
145
- std::unique_lock<ur_shared_mutex> Lock (Queue->Mutex );
146
144
resetCommandLists (Queue);
147
145
}
148
146
0 commit comments