Skip to content

[SYCL][Graph] Fix issues with sycl_ext_oneapi_graph subgraphs #10822

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 9 commits into from
Aug 25, 2023

Conversation

EwanC
Copy link
Contributor

@EwanC EwanC commented Aug 15, 2023

This PR addresses some issues with the sycl_ext_oneapi_graph extension regarding sub-graphs. A sub-graph is when an executable command_graph is added as a node in another graph.

Currently, adding an executable graph object as a subgraph permanently connects the child graph's root nodes to the parent graph. This affects subsequent independent submissions of the executable child graph object and later additions as a subgraph node. This is incorrect behaviour, as the previous uses as a sub-graph should have no effect on the state of the executable graph object.

Fixed in this PR by duplicating the nodes of a subgraph when added to a parent, enabling multiple parents. As a result, nodes of the initial subgraph and the one of the main graph are no longer the exact same (shared_pointer) but two different nodes with similar content.

Authors

Co-authored-by: Maxime France-Pillois [email protected]

* [SYCL][Graph] Duplicate sub-graph nodes

Duplicates the nodes of a sub-graph when added to its parents to enable multiple parents.
As a result nodes of the initial sub-graph and the one of the main graph are no longer
the exact same (shared_pointer) but two different nodes with similar content.
A few unitests have been updated accordingly and an equal operator has been added
to node_impl to ease comparison between nodes.
mfrancepillois and others added 2 commits August 16, 2023 17:03
* [SYCL][Graph] Enable empty nodes in Subgraphs

The implementation uses the list of scheduled nodes to add a subgraph to a main graph.
However, since empty nodes are not scheduled, empty nodes were not listed in this list, resulting in inconsistent graphs when subgraph with empty node(s) were added to a main graph.
This PR fixes this issue by forcing to list empty nodes when creating the list for inserting subgraph.
It also adds unitests to check that subgraphs with empty nodes are correctly added to a main graph.

* [SYCL][Graph] Enable empty nodes in Subgraphs

Changes the definition of MSchedule as it now contains all types of nodes (including empty nodes).
Empty nodes are now filtered out when creating the commandbuffer and/or enqueuing nodes to only keep their dependencies.
This PR updates a few unitests to make them compliant to the new schedule list definition.

* Update sycl/source/detail/graph_impl.cpp

Co-authored-by: Ben Tracy <[email protected]>

---------

Co-authored-by: Ben Tracy <[email protected]>
@EwanC EwanC marked this pull request as ready for review August 16, 2023 16:23
@EwanC EwanC requested review from a team as code owners August 16, 2023 16:23
@EwanC EwanC requested a review from steffenlarsen August 16, 2023 16:23
@EwanC EwanC requested a review from steffenlarsen August 22, 2023 13:41
@reble reble changed the title [SYCL][Graphs] Fix issues with sycl_ext_oneapi_graph subgraphs [SYCL][Graph] Fix issues with sycl_ext_oneapi_graph subgraphs Aug 22, 2023
@EwanC
Copy link
Contributor Author

EwanC commented Aug 24, 2023

CI fail for Extensions/./ExtensionsTests/CommandGraphTest/GetProfilingInfoExceptionCheck is an existing issue fixed by #10954

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

Just a nit, but otherwise LGTM!

@steffenlarsen steffenlarsen merged commit 92ddf8d into intel:sycl Aug 25, 2023
auto Successor = NodesMap[NextNode];
NodeCopy->registerSuccessor(Successor, NodeCopy);
} else {
assert("Node duplication failed. A duplicated node is missing.");
Copy link
Contributor

Choose a reason for hiding this comment

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

This caused MacOS build failure in post commit. Fixing in #10977.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants