Skip to content

Commit dd5a191

Browse files
authored
[SYCL] Fix piEnqueueEventsWaitWithBarrier for in-order queues (#7475)
1 parent 26e2524 commit dd5a191

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6445,7 +6445,11 @@ pi_result piEnqueueEventsWaitWithBarrier(pi_queue Queue,
64456445
// We use the same approach if
64466446
// SYCL_PI_LEVEL_ZERO_USE_MULTIPLE_COMMANDLIST_BARRIERS is not set to a
64476447
// positive value.
6448-
if (NumEventsInWaitList || !UseMultipleCmdlistBarriers) {
6448+
// We use the same approach if we have in-order queue because every command
6449+
// depends on previous one, so we don't need to insert barrier to multiple
6450+
// command lists.
6451+
if (NumEventsInWaitList || !UseMultipleCmdlistBarriers ||
6452+
Queue->isInOrderQueue()) {
64496453
// Retain the events as they will be owned by the result event.
64506454
_pi_ze_event_list_t TmpWaitList;
64516455
if (auto Res = TmpWaitList.createAndRetainPiZeEventList(
@@ -6468,7 +6472,9 @@ pi_result piEnqueueEventsWaitWithBarrier(pi_queue Queue,
64686472
if (auto Res = Queue->executeCommandList(CmdList, false, OkToBatch))
64696473
return Res;
64706474

6471-
if (UseMultipleCmdlistBarriers) {
6475+
// Because of the dependency between commands in the in-order queue we don't
6476+
// need to keep track of any active barriers if we have in-order queue.
6477+
if (UseMultipleCmdlistBarriers && !Queue->isInOrderQueue()) {
64726478
// Retain and save the resulting event for future commands.
64736479
(*Event)->RefCount.increment();
64746480
Queue->ActiveBarriers.push_back(*Event);

0 commit comments

Comments
 (0)