23 #include <type_traits>
27 inline namespace _V1 {
34 namespace experimental {
65 case UGF::sycl_reductions:
67 case UGF::sycl_specialization_constants:
68 return "Specialization Constants";
69 case UGF::sycl_kernel_bundle:
70 return "Kernel Bundles";
71 case UGF::sycl_ext_oneapi_kernel_properties:
72 return "sycl_ext_oneapi_kernel_properties";
73 case UGF::sycl_ext_oneapi_enqueue_barrier:
74 return "sycl_ext_oneapi_enqueue_barrier";
75 case UGF::sycl_ext_oneapi_memcpy2d:
76 return "sycl_ext_oneapi_memcpy2d";
77 case UGF::sycl_ext_oneapi_device_global:
78 return "sycl_ext_oneapi_device_global";
79 case UGF::sycl_ext_oneapi_bindless_images:
80 return "sycl_ext_oneapi_bindless_images";
81 case UGF::sycl_ext_oneapi_experimental_cuda_cluster_launch:
82 return "sycl_ext_oneapi_experimental_cuda_cluster_launch";
83 case UGF::sycl_ext_codeplay_enqueue_native_command:
84 return "sycl_ext_codeplay_enqueue_native_command";
87 assert(
false &&
"Unhandled graphs feature");
93 class exec_graph_impl;
94 class dynamic_parameter_impl;
119 std::vector<node> get_predecessors()
const;
122 std::vector<node> get_successors()
const;
126 static node get_node_from_event(
event nodeEvent);
129 template <
int Dimensions>
136 node(
const std::shared_ptr<detail::node_impl> &Impl) : impl(Impl) {}
139 friend const decltype(Obj::impl) &
144 std::shared_ptr<detail::node_impl> impl;
153 ::sycl::detail::GraphNoCycleCheck> {
163 :
public ::sycl::detail::DataLessProperty<
164 ::sycl::detail::GraphAssumeBufferOutlivesGraph> {
172 :
public ::sycl::detail::DataLessProperty<::sycl::detail::GraphUpdatable> {
180 ::sycl::detail::GraphEnableProfiling> {
191 ::sycl::detail::GraphNodeDependencies> {
193 template <
typename... NodeTN>
depends_on(NodeTN... nodes) : MDeps{nodes...} {}
195 const std::vector<::sycl::ext::oneapi::experimental::node> &
201 const std::vector<::sycl::ext::oneapi::experimental::node> MDeps;
207 ::sycl::detail::GraphDependOnAllLeaves> {
238 node Node = addImpl(Deps.get_dependencies());
240 addGraphLeafDependencies(Node);
244 node Node = addImpl({});
245 if (PropList.has_property<property::node::depends_on_all_leaves>()) {
246 addGraphLeafDependencies(Node);
258 node Node = addImpl(CGF, Deps.get_dependencies());
260 addGraphLeafDependencies(Node);
264 node Node = addImpl(CGF, {});
265 if (PropList.has_property<property::node::depends_on_all_leaves>()) {
266 addGraphLeafDependencies(Node);
274 void make_edge(node &Src, node &Dest);
279 command_graph<graph_state::executable>
299 void end_recording();
303 void end_recording(
queue &RecordingQueue);
308 void end_recording(
const std::vector<queue> &RecordingQueues);
316 void print_graph(
const std::string path,
bool verbose =
false)
const;
319 std::vector<node> get_nodes()
const;
322 std::vector<node> get_root_nodes()
const;
335 const std::vector<node> &Dep);
340 node addImpl(
const std::vector<node> &Dep);
345 void addGraphLeafDependencies(
node Node);
348 friend const decltype(Obj::impl) &
353 std::shared_ptr<detail::graph_impl>
impl;
369 void update(
const node &Node);
374 void update(
const std::vector<node> &Nodes);
386 friend const decltype(Obj::impl) &
392 std::shared_ptr<detail::exec_graph_impl>
impl;
397 template <graph_state State = graph_state::modifiable>
417 command_graph(
const std::shared_ptr<detail::graph_impl> &Impl)
439 size_t ParamSize,
const void *Data);
442 void updateValue(
const void *NewValue,
size_t Size);
444 void updateAccessor(
const sycl::detail::AccessorBaseHost *Acc);
445 std::shared_ptr<dynamic_parameter_impl>
impl;
448 friend const decltype(Obj::impl) &
453 template <
typename ValueT>
455 static constexpr
bool IsAccessor =
456 std::is_base_of_v<sycl::detail::AccessorBaseHost, ValueT>;
458 IsAccessor ? sycl::detail::kernel_param_kind_t::kind_accessor
459 : std::is_pointer_v<ValueT>
460 ? sycl::detail::kernel_param_kind_t::kind_pointer
461 : sycl::detail::kernel_param_kind_t::kind_std_layout;
474 if constexpr (IsAccessor) {
483 template <
typename ValueT>
486 template <graph_state State = graph_state::modifiable>
495 struct is_property<ext::oneapi::experimental::property::graph::no_cycle_check>
499 struct is_property<ext::oneapi::experimental::property::node::depends_on>
504 ext::oneapi::experimental::property::graph::no_cycle_check,
506 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)
dynamic_parameter_base(sycl::ext::oneapi::experimental::command_graph< graph_state::modifiable > Graph, size_t ParamSize, const void *Data)
std::shared_ptr< dynamic_parameter_impl > impl
void updateValue(const void *NewValue, size_t Size)
std::shared_ptr< detail::exec_graph_impl > impl
executable_command_graph()=delete
An executable command-graph is not user constructable.
std::shared_ptr< detail::graph_impl > impl
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 used to enable executable graph profiling.
enable_profiling()=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) const & getSyclObjImpl(const Obj &SyclObject)
T createSyclObjFromImpl(decltype(T::impl) ImplObj)
@ sycl_ext_oneapi_experimental_cuda_cluster_launch
@ sycl_ext_oneapi_kernel_properties
@ sycl_ext_oneapi_memcpy2d
@ sycl_ext_codeplay_enqueue_native_command
@ 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.