Skip to content

Commit

Permalink
Allow passing dynamic events for depends_on/barrier
Browse files Browse the repository at this point in the history
  • Loading branch information
Bensuo committed Jun 12, 2024
1 parent 5ff8558 commit a0d58cc
Showing 1 changed file with 43 additions and 8 deletions.
51 changes: 43 additions & 8 deletions sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
<<event-limitations, Event Limitations>> for more information). For events
obtained from another graph via
* Passing SYCL events, including <<dynamic-event, Dynamic 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 <<event-limitations, Event
Limitations>> for more information). For events obtained from another graph via
`command_graph<graph_state::executable>::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++]
Expand Down Expand Up @@ -1358,7 +1358,7 @@ Exceptions:

|===

=== Queue Class Modifications
=== Queue Class Modifications [[queue-class-modifications]]

[source, c++]
----
Expand Down Expand Up @@ -1389,6 +1389,10 @@ public:
event depEvent);
event ext_oneapi_graph(command_graph<graph_state::executable>& graph,
const std::vector<event>& depEvents);
// Overload of ext_oneapi_barrier which takes dynamic events
event ext_oneapi_barrier(const std::vector<dynamic_event>& waitList);
};
} // namespace sycl
----
Expand Down Expand Up @@ -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<dynamic_event>& waitList);
----

|Queue shortcut function for enqueuing a barrier which takes a list of
<<dynamic-event, Dynamic Events>> that all following commands must wait on.

This function has the same semantics as `ext_oneapi_barrier(const
std::vector<event>&)`.
|===

==== New Handler Member Functions
Expand Down Expand Up @@ -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<dynamic_event>& 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<event>&)`.

|===

=== Dynamic Events [[dynamic-events]]
Expand Down Expand Up @@ -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
<<dynamic-events, Dynamic Events>> which allows these dependencies to be updated
using <<executable-graph-update, Executable Graph Update>>. Overloads for these
methods are detailed in the section on <<queue-class-modifications, queue class
modifications>>.

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
Expand Down

0 comments on commit a0d58cc

Please sign in to comment.