Skip to content

Commit

Permalink
Add some more external event examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Bensuo committed Apr 22, 2024
1 parent 75f8c14 commit 35788b5
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,19 @@ for(int i = 0 ; i < Iterations, i++) {
}
----

[source,c++]
----
// Explicit API usage snippet
// Add an external event node to Graph A
auto ExtEventNode = GraphA.add_external_event();
...
// Add a wait external event node in GraphB
auto ExtWaitNode = GraphB.add_wait_external_event({ExtEventNode.get_external_event()});
----

==== Normal SYCL Events

Normal SYCL events from queue submissions outside of a `command_graph` may be
Expand All @@ -1851,6 +1864,29 @@ passed to `handler::depends_on()` for nodes added explicitly to a
operations that do not need to run on every graph execution but must be executed
before the main graph commands, such as warm-ups or initialization.

[source,c++]
----
// Normal submission to a queue
auto NormalEvent = Queue.submit(...);
Graph.begin_recording(Queue);
auto GraphEvent = Queue.submit([&](handler& CGH){
// OK! This node will depend on NormalEvent
CGH.depends_on(NormalEvent);
CGH.parallel_for(...);
});
Graph.end_recording(Queue);
auto ExecGraph = Graph.finalize();
// The node associated with GraphEvent will be correctly ordered with respect to
// NormalEvent
Queue.ext_oneapi_graph(ExecGraph);
----

=== Thread Safety

The new functions in this extension are thread-safe, the same as member
Expand Down

0 comments on commit 35788b5

Please sign in to comment.