You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Graph is a class that represents a directed acyclic graph of nodes.
102
101
A graph can have different states, can be nested, can have multiple root nodes that are scheduled for execution first and multiple leaf nodes that are scheduled for execution last. The execution of a graph has been completed when all leaf node tasks have been completed.
103
-
Member functions as listed in Table 2 and 3 can be used to add nodes to a graph.
102
+
Member functions as listed in Table 3 to 6 can be used to add nodes to a graph.
@@ -133,46 +143,209 @@ A `graph` object in `graph_state::executable` represents a user generated device
133
143
The structure of such a `graph` object in this state is immutable and cannot be changed, so are the tasks assigned with each node.
134
144
Support of submitting a graph for execution, before a previous execution has been completed is backend specific. The runtime may throw an error.
135
145
146
+
=== Graph member and helper functions
147
+
136
148
Table 3. Constructor of the `graph` class.
149
+
[cols="2a,a"]
137
150
|===
138
151
|Constructor|Description
139
152
140
-
|`graph()`
141
-
|Creates a `graph` object. It's default state is `graph_state::modifiable`.
153
+
|
154
+
[source,c++]
155
+
----
156
+
/* available only when graph_state == modifiable */`
157
+
graph();
158
+
----
159
+
|Creates a `graph` object.
142
160
143
161
|===
144
162
145
163
Table 4. Member functions of the `graph` class.
164
+
[cols="2a,a"]
146
165
|===
147
166
|Member function|Description
148
167
149
-
|`node add_node(const std::vector<node>& dep = {});`
168
+
|
169
+
[source,c++]
170
+
----
171
+
node add_node(const std::vector<node>& dep = {});
172
+
----
150
173
|This creates an empty node which is associated to no task. Its intended use is either a connection point inside a graph between groups of nodes, and can significantly reduce the number of edges ( O(n) vs. O(n^2) ). Another use-case is building the structure of a graph first and adding tasks later.
151
174
152
-
|`template<typename T>
153
-
node add_node(T cgf, const std::vector<node>& dep = {});`
175
+
|
176
+
[source,c++]
177
+
----
178
+
template<typename T>
179
+
node add_node(T cgf, const std::vector<node>& dep = {});
180
+
----
154
181
|This node captures a command group function object containing host task which is scheduled by the SYCL runtime or a SYCL function for invoking kernels with all restrictions that apply as described in the spec.
155
182
156
183
|===
157
184
185
+
Memory that is allocated by the following functions is owned by the specific graph. When freed inside the graph, the memory is only accessible before the `free` node is executed and after the `malloc` node is executed.
186
+
158
187
Table 5. Member functions of the `graph` class (memory operations).
0 commit comments