23 #include <type_traits>
27 inline namespace _V1 {
34 namespace experimental {
63 case UGF::sycl_reductions:
65 case UGF::sycl_specialization_constants:
66 return "Specialization Constants";
67 case UGF::sycl_kernel_bundle:
68 return "Kernel Bundles";
69 case UGF::sycl_ext_oneapi_kernel_properties:
70 return "sycl_ext_oneapi_kernel_properties";
71 case UGF::sycl_ext_oneapi_enqueue_barrier:
72 return "sycl_ext_oneapi_enqueue_barrier";
73 case UGF::sycl_ext_oneapi_memcpy2d:
74 return "sycl_ext_oneapi_memcpy2d";
75 case UGF::sycl_ext_oneapi_device_global:
76 return "sycl_ext_oneapi_device_global";
77 case UGF::sycl_ext_oneapi_bindless_images:
78 return "sycl_ext_oneapi_bindless_images";
81 assert(
false &&
"Unhandled graphs feature");
87 class exec_graph_impl;
88 class dynamic_parameter_impl;
113 std::vector<node> get_predecessors()
const;
116 std::vector<node> get_successors()
const;
120 static node get_node_from_event(
event nodeEvent);
123 template <
int Dimensions>
130 node(
const std::shared_ptr<detail::node_impl> &Impl) : impl(Impl) {}
133 friend decltype(Obj::impl)
138 std::shared_ptr<detail::node_impl> impl;
147 ::sycl::detail::GraphNoCycleCheck> {
157 :
public ::sycl::detail::DataLessProperty<
158 ::sycl::detail::GraphAssumeBufferOutlivesGraph> {
166 :
public ::sycl::detail::DataLessProperty<::sycl::detail::GraphUpdatable> {
177 ::sycl::detail::GraphNodeDependencies> {
179 template <
typename... NodeTN>
depends_on(NodeTN... nodes) : MDeps{nodes...} {}
181 const std::vector<::sycl::ext::oneapi::experimental::node> &
187 const std::vector<::sycl::ext::oneapi::experimental::node> MDeps;
193 ::sycl::detail::GraphDependOnAllLeaves> {
226 node Node = addImpl(Deps.get_dependencies());
228 addGraphLeafDependencies(Node);
232 node Node = addImpl({});
233 if (PropList.has_property<property::node::depends_on_all_leaves>()) {
234 addGraphLeafDependencies(Node);
246 node Node = addImpl(CGF, Deps.get_dependencies());
248 addGraphLeafDependencies(Node);
252 node Node = addImpl(CGF, {});
253 if (PropList.has_property<property::node::depends_on_all_leaves>()) {
254 addGraphLeafDependencies(Node);
262 void make_edge(node &Src, node &Dest);
267 command_graph<graph_state::executable>
287 void end_recording();
291 void end_recording(
queue &RecordingQueue);
296 void end_recording(
const std::vector<queue> &RecordingQueues);
304 void print_graph(
const std::string path,
bool verbose =
false)
const;
307 std::vector<node> get_nodes()
const;
310 std::vector<node> get_root_nodes()
const;
323 const std::vector<node> &Dep);
328 node addImpl(
const std::vector<node> &Dep);
333 void addGraphLeafDependencies(
node Node);
336 friend decltype(Obj::impl)
357 void update(
const node &Node);
362 void update(
const std::vector<node> &Nodes);
374 friend decltype(Obj::impl)
394 : modifiable_command_graph(SyclContext, SyclDevice, PropList) {}
400 : modifiable_command_graph(SyclQueue, PropList) {}
405 command_graph(
const std::shared_ptr<detail::graph_impl> &Impl)
406 : modifiable_command_graph(Impl) {}
427 size_t ParamSize,
const void *Data);
430 void updateValue(
const void *NewValue,
size_t Size);
432 void updateAccessor(
const sycl::detail::AccessorBaseHost *Acc);
433 std::shared_ptr<dynamic_parameter_impl>
impl;
436 friend decltype(Obj::impl)
441 template <typename ValueT>
443 static constexpr
bool IsAccessor =
444 std::is_base_of_v<sycl::detail::AccessorBaseHost, ValueT>;
446 IsAccessor ? sycl::detail::kernel_param_kind_t::kind_accessor
447 : std::is_pointer_v<ValueT>
448 ? sycl::detail::kernel_param_kind_t::kind_pointer
449 : sycl::detail::kernel_param_kind_t::kind_std_layout;
457 : detail::dynamic_parameter_base(Graph, sizeof(ValueT), &Param) {}
462 if constexpr (IsAccessor) {
471 template <
typename ValueT>
474 template <graph_state State = graph_state::modifiable>
483 struct is_property<ext::oneapi::experimental::property::graph::no_cycle_check>
487 struct is_property<ext::oneapi::experimental::property::node::depends_on>
492 ext::oneapi::experimental::property::graph::no_cycle_check,
494 ext::oneapi::experimental::graph_state::modifiable>> : std::true_type {
The file contains implementations of accessor class.
The context class represents a SYCL context on which kernel functions may be executed.
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
Graph in the modifiable state.
command_graph(const queue &SyclQueue, const property_list &PropList={})
Constructor.
command_graph(const context &SyclContext, const device &SyclDevice, const property_list &PropList={})
Constructor.
void updateAccessor(const sycl::detail::AccessorBaseHost *Acc)
std::shared_ptr< dynamic_parameter_impl > impl
void updateValue(const void *NewValue, size_t Size)
Class representing the implementation of command_graph<executable>.
executable_command_graph()=delete
An executable command-graph is not user constructable.
Implementation details of command_graph<modifiable>.
command_graph< graph_state::executable > finalize(const property_list &PropList={}) const
Finalize modifiable graph into an executable graph.
void begin_recording(queue &RecordingQueue, const property_list &PropList={})
Change the state of a queue to be recording and associate this graph with it.
void begin_recording(const std::vector< queue > &RecordingQueues, const property_list &PropList={})
Change the state of multiple queues to be recording and associate this graph with each of them.
modifiable_command_graph(const std::shared_ptr< detail::graph_impl > &Impl)
Constructor used internally by the runtime.
node add(const property_list &PropList={})
Add an empty node to the graph.
modifiable_command_graph(const context &SyclContext, const device &SyclDevice, const property_list &PropList={})
Constructor.
modifiable_command_graph(const queue &SyclQueue, const property_list &PropList={})
Constructor.
node add(T CGF, const property_list &PropList={})
Add a command-group node to the graph.
void update(const ValueT &NewValue)
Updates this dynamic parameter and all registered nodes with a new value.
dynamic_parameter(experimental::command_graph< graph_state::modifiable > Graph, const ValueT &Param)
Constructs a new dynamic parameter.
Class representing a node in the graph, returned by command_graph::add().
void update_nd_range(nd_range< Dimensions > executionRange)
Update the ND-Range of this node if it is a kernel execution node.
void update_range(range< Dimensions > executionRange)
Update the Range of this node if it is a kernel execution node.
Property passed to command_graph constructor to allow buffers to be used with graphs.
assume_buffer_outlives_graph()=default
Property passed to command_graph constructor to disable checking for cycles.
Property passed to command_graph<graph_state::modifiable>::finalize() to mark the resulting executabl...
Property used to to add all previous graph leaves as dependencies when creating a new node with comma...
depends_on_all_leaves()=default
Property used to define dependent nodes when creating a new node with command_graph::add().
depends_on(NodeTN... nodes)
const std::vector<::sycl::ext::oneapi::experimental::node > & get_dependencies() const
Command group handler class.
Provides an abstraction of a SYCL kernel.
Defines the iteration domain of both the work-groups and the overall dispatch.
Objects of the property_list class are containers for the SYCL properties.
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject)
T createSyclObjFromImpl(decltype(T::impl) ImplObj)
@ sycl_ext_oneapi_kernel_properties
@ sycl_ext_oneapi_memcpy2d
@ sycl_specialization_constants
@ sycl_ext_oneapi_enqueue_barrier
@ sycl_ext_oneapi_device_global
@ sycl_ext_oneapi_bindless_images
const char * UnsupportedFeatureToString(UnsupportedGraphFeatures Feature)
graph_state
State to template the command_graph class on.
@ modifiable
In modifiable state, commands can be added to graph.
@ executable
In executable state, the graph is ready to execute.
command_graph(const context &SyclContext, const device &SyclDevice, const property_list &PropList) -> command_graph< State >
dynamic_parameter(experimental::command_graph< graph_state::modifiable > Graph, const ValueT &Param) -> dynamic_parameter< ValueT >
Additional CTAD deduction guides.