File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
source/adapters/level_zero Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -679,6 +679,11 @@ ur_result_t ur_context_handle_t_::getAvailableCommandList(
679679 if (Queue->hasOpenCommandList (UseCopyEngine)) {
680680 if (AllowBatching) {
681681 bool batchingAllowed = true ;
682+ if (ForcedCmdQueue &&
683+ CommandBatch.OpenCommandList ->second .ZeQueue != *ForcedCmdQueue) {
684+ // Current open batch doesn't match the forced command queue
685+ batchingAllowed = false ;
686+ }
682687 if (!UrL0OutOfOrderIntegratedSignalEvent &&
683688 Queue->Device ->isIntegrated ()) {
684689 batchingAllowed = eventCanBeBatched (Queue, UseCopyEngine,
Original file line number Diff line number Diff line change @@ -368,8 +368,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier(
368368 }
369369
370370 // Execute each command list so the barriers can be encountered.
371- for (ur_command_list_ptr_t &CmdList : CmdLists)
371+ for (ur_command_list_ptr_t &CmdList : CmdLists) {
372+ bool IsCopy =
373+ CmdList->second .isCopy (reinterpret_cast <ur_queue_handle_t >(Queue));
374+ const auto &CommandBatch =
375+ (IsCopy) ? Queue->CopyCommandBatch : Queue->ComputeCommandBatch ;
376+ // Only batch if the matching CmdList is already open.
377+ OkToBatch = CommandBatch.OpenCommandList == CmdList;
378+
372379 UR_CALL (Queue->executeCommandList (CmdList, false , OkToBatch));
380+ }
373381
374382 UR_CALL (Queue->ActiveBarriers .clear ());
375383 auto UREvent = reinterpret_cast <ur_event_handle_t >(*Event);
You can’t perform that action at this time.
0 commit comments