From a0d58cc32878f1f7d4ffc0c85cdf9c036650780b Mon Sep 17 00:00:00 2001 From: Ben Tracy Date: Wed, 12 Jun 2024 14:06:27 +0100 Subject: [PATCH] Allow passing dynamic events for depends_on/barrier --- .../sycl_ext_oneapi_graph.asciidoc | 51 ++++++++++++++++--- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc b/sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc index 45f4a10f75c6..b379cd94d149 100644 --- a/sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc +++ b/sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc @@ -580,17 +580,17 @@ be passed here. `depends_on` may be used in two ways: * Passing nodes from the same `command_graph` which will create dependencies and graph edges between those nodes and the node being added. -* Passing SYCL events. If an event represents a recorded node in the same graph, -then a graph edge is created between this node and the other node. Passing an -event from a recorded submission to another graph is an error (see -<> for more information). For events -obtained from another graph via +* Passing SYCL events, including <>. If an event +represents a recorded node in the same graph, then a graph edge is created +between this node and the other node. Passing an event from a recorded +submission to another graph is an error (see <> for more information). For events obtained from another graph via `command_graph::get_event()` or normal SYCL operations, a runtime dependency is created between this node and the command that is associated with the event. -The only permitted types for `NodeTN` and `EventTN` are `node` and `event` -respectively. +The only permitted types for `NodeTN` and `EventTN` are `node` and +`event`/`dynamic_event` respectively. ==== Depends-On-All-Leaves Property [source,c++] @@ -1358,7 +1358,7 @@ Exceptions: |=== -=== Queue Class Modifications +=== Queue Class Modifications [[queue-class-modifications]] [source, c++] ---- @@ -1389,6 +1389,10 @@ public: event depEvent); event ext_oneapi_graph(command_graph& graph, const std::vector& depEvents); + + // Overload of ext_oneapi_barrier which takes dynamic events + event ext_oneapi_barrier(const std::vector& waitList); + }; } // namespace sycl ---- @@ -1551,6 +1555,19 @@ all the nodes have finished execution. The queue should be associated with a device and context that are the same as the device and context used on creation of the graph. + +| +[source,c++] +---- +event +queue::ext_oneapi_barrier(const std::vector& waitList); +---- + +|Queue shortcut function for enqueuing a barrier which takes a list of +<> that all following commands must wait on. + +This function has the same semantics as `ext_oneapi_barrier(const +std::vector&)`. |=== ==== New Handler Member Functions @@ -1642,6 +1659,18 @@ a normal SYCL command-group submission. associated with the graph node resulting from this command-group submission is different from the one with which the dynamic_parameter was created. +| +[source,c++] +---- +void handler::ext_oneapi_barrier(const std::vector& waitList); +---- + +|Overload of `ext_oneapi_barrier` that takes a list of dynamic events to wait +on. + +This function has the same semantics as `ext_oneapi_barrier(const +std::vector&)`. + |=== === Dynamic Events [[dynamic-events]] @@ -1903,6 +1932,12 @@ wait list parameter, the semantics are that the barrier node being added to will depend on all the existing graph leaf nodes, not only the leaf nodes that were added from the queue being recorded. +These barrier functions have also been extended to allow passing +<> which allows these dependencies to be updated +using <>. Overloads for these +methods are detailed in the section on <>. + A synchronous exception will be thrown with error code `invalid` if a user tries to add them to a graph using the Explicit API. Empty nodes created with the `node::depends_on_all_leaves` property can be used instead of barriers when