Skip to content

Execute graph using handler #21

@EwanC

Description

@EwanC

Spun off from - #4 (comment)

Rather than the event submit(command_graph<graph_state::executable> graph); function to run the executable graph, an alternative API would be to use the handler to add a new function exec_graph(command_graph<graph_state::executable> graph).

auto ev = q.submit([&](handler& cgh){
  cgh.depends_on(some_other_event);
  // Not sure of the most appropriate name here
  cgh.exec_graph(g);
});

The advantages for this are 1) that it is more in keeping with the existing SYCL API, and 2) allows a graph execution to depend on an arbitrary event. This would make it easier for users to write the following code without have to block on host waits:

auto ev1 = q.submit([&](handler& cgh){
cgh.exec_graph(g);
});

// dest is some input to graph `g`
auto ev2 = q.memcpy(dest, src, numBytes,  ev1);

auto ev3 = q.submit([&](handler& cgh){
  cgh.depends_on(ev2);
  cgh.exec_graph(g);
});

We could also add a queue shortcut function(s)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions