Skip to content

Commit d3445ef

Browse files
committed
Fix command-buffer dependencies on the legacy adapter when immediate command lists are disabled
1 parent 0241111 commit d3445ef

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

unified-runtime/source/adapters/level_zero/command_buffer.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,25 @@ ur_result_t waitForDependencies(ur_exp_command_buffer_handle_t CommandBuffer,
14891489
std::scoped_lock<ur_shared_mutex> Guard(CommandBuffer->Mutex);
14901490
const bool UseCopyEngine = false;
14911491
bool MustSignalWaitEvent = true;
1492+
1493+
// Level-zero does not allow in-order queue when immediate command-lists are
1494+
// not used. For that reason, if the UR queue is in-order, we need to emulate,
1495+
// its in-order properties by adding an event dependency on the last command
1496+
// executed by the queue.
1497+
std::vector<ur_event_handle_t> WaitList;
1498+
if (Queue->isInOrderQueue() && Queue->LastCommandEvent) {
1499+
WaitList.reserve(NumEventsInWaitList + 1);
1500+
1501+
if (NumEventsInWaitList) {
1502+
WaitList.insert(WaitList.end(), EventWaitList,
1503+
EventWaitList + NumEventsInWaitList);
1504+
}
1505+
WaitList.push_back(Queue->LastCommandEvent);
1506+
1507+
++NumEventsInWaitList;
1508+
EventWaitList = WaitList.data();
1509+
}
1510+
14921511
if (NumEventsInWaitList) {
14931512
ur_ze_event_list_t TmpWaitList;
14941513
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(

0 commit comments

Comments
 (0)