Skip to content

[SYCL][Graph] Finalize Graph for single device #11565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 19, 2023
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
22 changes: 10 additions & 12 deletions sycl/source/detail/graph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,22 +865,20 @@ void executable_command_graph::finalizeImpl() {
// Create PI command-buffers for each device in the finalized context
impl->schedule();

auto Context = impl->getContext();
for (const auto &Device : Context.get_devices()) {
bool CmdBufSupport =
Device.get_info<
ext::oneapi::experimental::info::device::graph_support>() ==
graph_support_level::native;
auto Device = impl->getGraphImpl()->getDevice();
bool CmdBufSupport =
Device
.get_info<ext::oneapi::experimental::info::device::graph_support>() ==
graph_support_level::native;

#if FORCE_EMULATION_MODE
// Above query should still succeed in emulation mode, but ignore the
// result and use emulation.
CmdBufSupport = false;
// Above query should still succeed in emulation mode, but ignore the
// result and use emulation.
CmdBufSupport = false;
#endif

if (CmdBufSupport) {
impl->createCommandBuffers(Device);
}
if (CmdBufSupport) {
impl->createCommandBuffers(Device);
}
}

Expand Down
5 changes: 5 additions & 0 deletions sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2641,6 +2641,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