Skip to content
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

Fix adding empty nodes to the graph results in two root nodes #237

Merged
merged 5 commits into from
Jun 26, 2023

Conversation

julianmi
Copy link
Collaborator

Fixes an issue revealed in CommandGraphTest.AddNode where an empty node without dependencies would lead to two root nodes being added to the graph. The first is added in the special Graph case in handler::finalize() and the second in graph_impl::add(const std::vector<std::shared_ptr<node_impl>> &Dep). This patch adds a node in handler::finalize() only during queue recording. Explicitly added empty nodes use a new command group with none-type and follow the regular kernel graph_impl::add path. isEmpty() is extended to include command groups with none-type.

This supersedes #236 which lacked support for record and replay mode.

@julianmi julianmi added the bug Something isn't working label Jun 22, 2023
Copy link
Collaborator

@Bensuo Bensuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just some minor comments!

sycl/source/handler.cpp Outdated Show resolved Hide resolved
sycl/source/detail/graph_impl.hpp Outdated Show resolved Hide resolved
@Bensuo Bensuo added the Graph Implementation Related to DPC++ implementation and testing label Jun 22, 2023
sycl/source/detail/graph_impl.hpp Outdated Show resolved Hide resolved
auto EventImpl = std::make_shared<detail::event_impl>();

// Extract relevant data from the handler and pass to graph to create a
// new node representing this command group.
std::shared_ptr<ext::oneapi::experimental::detail::node_impl> NodeImpl =
GraphImpl->add(CGData.MEvents);
QueueGraph->add(CGData.MEvents);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing this code, I'm wondering if empty nodes will work with in-order queues for record & replay because we don't reach the code on lines 428-443.

Created #239 to investigate this, as it shouldn't hold up this PR

Co-authored-by: Ewan Crawford <ewan@codeplay.com>
@julianmi julianmi merged commit a32a813 into sycl-graph-develop Jun 26, 2023
EwanC pushed a commit that referenced this pull request Jun 29, 2023
Fix adding empty nodes to the graph results in two root nodes
@Bensuo Bensuo deleted the julianmi/fix-double-root-nodes branch August 7, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Graph Implementation Related to DPC++ implementation and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants