Skip to content

Commit

Permalink
[SYCL][Graph] Wait for deps when adding commands to a command graph
Browse files Browse the repository at this point in the history
- Commands which enqueue to a command graph now correctly respect their dependencies by waiting on them.
- Prevents issues where allocation commands with dependent copies could be delayed due to device being busy and execute in an incorrect order with regards to future command graph executions.
  • Loading branch information
Bensuo committed Oct 5, 2023
1 parent d25c153 commit 9b984e3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2627,6 +2627,11 @@ pi_int32 ExecCGCommand::enqueueImpCommandBuffer() {
auto RawEvents = getPiEvents(EventImpls);
flushCrossQueueDeps(EventImpls, getWorkerQueue());

// Any non-allocation dependencies need to be waited on here since subsequent
// submissions of the command buffer itself will not receive dependencies on
// them, e.g. initial copies from host to device
waitForEvents(MQueue, MPreparedDepsEvents, MEvent->getHandleRef());

sycl::detail::pi::PiEvent *Event =
(MQueue->has_discard_events_support() &&
MCommandGroup->getRequirements().size() == 0)
Expand Down

0 comments on commit 9b984e3

Please sign in to comment.