Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions source/adapters/level_zero/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,11 @@ ur_result_t ur_context_handle_t_::getAvailableCommandList(
if (Queue->hasOpenCommandList(UseCopyEngine)) {
if (AllowBatching) {
bool batchingAllowed = true;
if (ForcedCmdQueue &&
CommandBatch.OpenCommandList->second.ZeQueue != *ForcedCmdQueue) {
// Current open batch doesn't match the forced command queue
batchingAllowed = false;
}
if (!UrL0OutOfOrderIntegratedSignalEvent &&
Queue->Device->isIntegrated()) {
batchingAllowed = eventCanBeBatched(Queue, UseCopyEngine,
Expand Down
10 changes: 9 additions & 1 deletion source/adapters/level_zero/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier(
}

// Execute each command list so the barriers can be encountered.
for (ur_command_list_ptr_t &CmdList : CmdLists)
for (ur_command_list_ptr_t &CmdList : CmdLists) {
bool IsCopy =
CmdList->second.isCopy(reinterpret_cast<ur_queue_handle_t>(Queue));
const auto &CommandBatch =
(IsCopy) ? Queue->CopyCommandBatch : Queue->ComputeCommandBatch;
// Only batch if the matching CmdList is already open.
OkToBatch = CommandBatch.OpenCommandList == CmdList;

UR_CALL(Queue->executeCommandList(CmdList, false, OkToBatch));
}

UR_CALL(Queue->ActiveBarriers.clear());
auto UREvent = reinterpret_cast<ur_event_handle_t>(*Event);
Expand Down