Skip to content

Commit b42c7ec

Browse files
[SYCL][NFC] Refactoring in GraphProcessor::enqueueCommand
1 parent 6e630ea commit b42c7ec

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

sycl/source/detail/scheduler/graph_processor.cpp

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,30 +63,13 @@ bool Scheduler::GraphProcessor::enqueueCommand(Command *Cmd,
6363
return false;
6464
}
6565

66-
// Indicates whether dependency cannot be enqueued
67-
bool BlockedByDep = false;
68-
66+
// Recursively enqueue all the dependencies first and
67+
// exit immediately if any of the commands cannot be enqueued.
6968
for (DepDesc &Dep : Cmd->MDeps) {
70-
const bool Enqueued =
71-
enqueueCommand(Dep.MDepCommand, EnqueueResult, Blocking);
72-
if (!Enqueued)
73-
switch (EnqueueResult.MResult) {
74-
case EnqueueResultT::SyclEnqueueFailed:
75-
default:
76-
// Exit immediately if a command fails to avoid enqueueing commands
77-
// result of which will be discarded.
78-
return false;
79-
case EnqueueResultT::SyclEnqueueBlocked:
80-
// If some dependency is blocked do not enqueue other deps.
81-
return false;
82-
}
69+
if (!enqueueCommand(Dep.MDepCommand, EnqueueResult, Blocking))
70+
return false;
8371
}
8472

85-
// Exit if some command is blocked from enqueueing, the EnqueueResult is set
86-
// by the latest dependency which was blocked.
87-
if (BlockedByDep)
88-
return false;
89-
9073
return Cmd->enqueue(EnqueueResult, Blocking);
9174
}
9275

0 commit comments

Comments
 (0)