23 #include <type_traits>
27 inline namespace _V1 {
34 namespace experimental {
66 case UGF::sycl_reductions:
68 case UGF::sycl_specialization_constants:
69 return "Specialization Constants";
70 case UGF::sycl_kernel_bundle:
71 return "Kernel Bundles";
72 case UGF::sycl_ext_oneapi_kernel_properties:
73 return "sycl_ext_oneapi_kernel_properties";
74 case UGF::sycl_ext_oneapi_enqueue_barrier:
75 return "sycl_ext_oneapi_enqueue_barrier";
76 case UGF::sycl_ext_oneapi_memcpy2d:
77 return "sycl_ext_oneapi_memcpy2d";
78 case UGF::sycl_ext_oneapi_device_global:
79 return "sycl_ext_oneapi_device_global";
80 case UGF::sycl_ext_oneapi_bindless_images:
81 return "sycl_ext_oneapi_bindless_images";
82 case UGF::sycl_ext_oneapi_experimental_cuda_cluster_launch:
83 return "sycl_ext_oneapi_experimental_cuda_cluster_launch";
84 case UGF::sycl_ext_codeplay_enqueue_native_command:
85 return "sycl_ext_codeplay_enqueue_native_command";
88 assert(
false &&
"Unhandled graphs feature");
94 class exec_graph_impl;
95 class dynamic_parameter_impl;
120 std::vector<node> get_predecessors()
const;
123 std::vector<node> get_successors()
const;
127 static node get_node_from_event(
event nodeEvent);
130 template <
int Dimensions>
137 node(
const std::shared_ptr<detail::node_impl> &Impl) : impl(Impl) {}
140 friend const decltype(Obj::impl) &
145 std::shared_ptr<detail::node_impl> impl;
154 ::sycl::detail::GraphNoCycleCheck> {
164 :
public ::sycl::detail::DataLessProperty<
165 ::sycl::detail::GraphAssumeBufferOutlivesGraph> {
173 :
public ::sycl::detail::DataLessProperty<::sycl::detail::GraphUpdatable> {
181 ::sycl::detail::GraphEnableProfiling> {
192 ::sycl::detail::GraphNodeDependencies> {
194 template <
typename... NodeTN>
depends_on(NodeTN... nodes) : MDeps{nodes...} {}
196 const std::vector<::sycl::ext::oneapi::experimental::node> &
202 const std::vector<::sycl::ext::oneapi::experimental::node> MDeps;
208 ::sycl::detail::GraphDependOnAllLeaves> {
239 node Node = addImpl(Deps.get_dependencies());
241 addGraphLeafDependencies(Node);
245 node Node = addImpl({});
246 if (PropList.has_property<property::node::depends_on_all_leaves>()) {
247 addGraphLeafDependencies(Node);
259 node Node = addImpl(CGF, Deps.get_dependencies());
261 addGraphLeafDependencies(Node);
265 node Node = addImpl(CGF, {});
266 if (PropList.has_property<property::node::depends_on_all_leaves>()) {
267 addGraphLeafDependencies(Node);
275 void make_edge(node &Src, node &Dest);
280 command_graph<graph_state::executable>
300 void end_recording();
304 void end_recording(
queue &RecordingQueue);
309 void end_recording(
const std::vector<queue> &RecordingQueues);
317 void print_graph(
const std::string path,
bool verbose =
false)
const;
320 std::vector<node> get_nodes()
const;
323 std::vector<node> get_root_nodes()
const;
336 const std::vector<node> &Dep);
341 node addImpl(
const std::vector<node> &Dep);
346 void addGraphLeafDependencies(
node Node);
349 friend const decltype(Obj::impl) &
354 std::shared_ptr<detail::graph_impl>
impl;
370 void update(
const node &Node);
375 void update(
const std::vector<node> &Nodes);
387 friend const decltype(Obj::impl) &
393 std::shared_ptr<detail::exec_graph_impl>
impl;
398 template <graph_state State = graph_state::modifiable>
418 command_graph(
const std::shared_ptr<detail::graph_impl> &Impl)
440 size_t ParamSize,
const void *Data);
443 void updateValue(
const void *NewValue,
size_t Size);
450 void updateAccessor(
const sycl::detail::AccessorBaseHost *Acc);
451 std::shared_ptr<dynamic_parameter_impl>
impl;
454 friend const decltype(Obj::impl) &
459 template <
typename ValueT>
461 static constexpr
bool IsAccessor =
462 std::is_base_of_v<sycl::detail::AccessorBaseHost, ValueT>;
464 IsAccessor ? sycl::detail::kernel_param_kind_t::kind_accessor
465 : std::is_pointer_v<ValueT>
466 ? sycl::detail::kernel_param_kind_t::kind_pointer
467 : sycl::detail::kernel_param_kind_t::kind_std_layout;
480 if constexpr (IsAccessor) {
489 template <
typename ValueT>
492 template <graph_state State = graph_state::modifiable>
501 struct is_property<ext::oneapi::experimental::property::graph::no_cycle_check>
505 struct is_property<ext::oneapi::experimental::property::node::depends_on>
510 ext::oneapi::experimental::property::graph::no_cycle_check,
512 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.