@@ -177,15 +177,15 @@ dependencies are satisfied.
177
177
The SYCL command described above completes once all of the native asynchronous
178
178
tasks it contains have completed.
179
179
180
- The call to `interopCallable` is done by the host thread, users should
181
- therefore not perform blocking or synchronization tasks inside
182
- `interopCallable`, as it will defer the host thread returning to SYCL user
183
- code.
184
-
185
180
The call to `interopCallable` must not add tasks to backend objects that underly
186
181
any other queue, aside from the queue that is associated with this handler,
187
182
otherwise, the behavior is undefined.
188
183
184
+ [_Note:_ The function object `interopCallable` is invoked to enqueue commands to a
185
+ native queue or graph and therefore, APIs which block or synchronize could
186
+ prolong or interfere with other commands being enqueued to the backend.
187
+ _{endnote}_]
188
+
189
189
=== SYCL-Graph Interaction
190
190
191
191
This section defines the interaction with the
@@ -202,6 +202,8 @@ that they respect the graph node edges.
202
202
==== Interop Handle Class Modifications
203
203
204
204
```c++
205
+ // Alias is for editorial brevity in the ext_codeplay_get_native_graph
206
+ // definition, and is non-normative.
205
207
using graph = ext::oneapi::experimental::command_graph<
206
208
ext::oneapi::experimental::graph_state::executable>;
207
209
@@ -213,28 +215,6 @@ class interop_handle {
213
215
};
214
216
```
215
217
216
- Table {counter: tableNumber}. Native types for
217
- `template <backend Backend, class T> backend_return_t<Backend, T>` where `T` is
218
- instantiated as `command_graph<graph_state::executable>`.
219
-
220
- [cols="2a,a"]
221
- |===
222
- |Backend|Native graph type
223
-
224
- | `backend::opencl`
225
- | `cl_command_buffer_khr`
226
-
227
- | `backend::ext_oneapi_level_zero`
228
- | `ze_command_list_handle_t`
229
-
230
- | `backend::ext_oneapi_cuda`
231
- | `CUGraph`
232
-
233
- | `backend::ext_oneapi_hip`
234
- | `hipGraph_t`
235
-
236
- |===
237
-
238
218
==== New Interop Handle Member Functions
239
219
240
220
Table {counter: tableNumber}. Additional member functions of the `sycl::interop_handle` class.
@@ -248,11 +228,16 @@ Table {counter: tableNumber}. Additional member functions of the `sycl::interop_
248
228
bool interop_handle::ext_codeplay_has_graph() const;
249
229
----
250
230
251
- | Query if the `interop_handle` object has a native graph object available.
252
- Note that host-task nodes in a `command_graph` will return `false` for this,
253
- as host-task commands are executed by the SYCL runtime rather than the
254
- backend device, so there is no native graph object associated with the
255
- command.
231
+ |
232
+ _Returns_: True if the `interop_handle object` was constructed and passed to
233
+ an enqueue native command function object by `ext_codeplay_enqueue_native_command`,
234
+ that was invoked when adding a graph node, either explicitly or implicitly
235
+ via graph record.
236
+
237
+ [_Note:_ that host-task nodes in a `command_graph` will return `false` from this
238
+ query, as the host-task callable is invoked during graph execution rather than
239
+ graph finalization.
240
+ _{endnote}_]
256
241
257
242
|
258
243
[source,c++]
@@ -262,12 +247,42 @@ backend_return_t<Backend, graph>
262
247
interop_handle::ext_codeplay_get_native_graph() const;
263
248
----
264
249
265
- | Return the native graph object associated with the `interop_handle`.
250
+ |
251
+ _Returns_: The native graph object associated with the `interop_handle`.
252
+
253
+ _Throws_: An exception with the `errc::invalid` error code if
254
+ `ext_codeplay_has_graph()` returns `false`.
255
+
256
+ |===
257
+
258
+ == Implementation Notes
259
+
260
+ When `interop_handle::get_native_queue()` is invoked in a native command
261
+ function object on graph finalize, the queue that is returned to the user is an
262
+ internal queue created by the SYCL runtime, as there is no user provided queue
263
+ at the point of graph finalization. This queue has the same device and context
264
+ as the graph was created with. The only valid usage of this queue is to perform
265
+ stream capture to a graph for backend APIs that provide this functionality.
266
+
267
+ Table {counter: tableNumber}. Native types for
268
+ `template <backend Backend, class T> backend_return_t<Backend, T>` where `T` is
269
+ instantiated as `command_graph<graph_state::executable>`.
270
+
271
+ [cols="2a,a"]
272
+ |===
273
+ |Backend|Native Graph Type
274
+
275
+ | `backend::opencl`
276
+ | `cl_command_buffer_khr`
277
+
278
+ | `backend::ext_oneapi_level_zero`
279
+ | `ze_command_list_handle_t`
266
280
267
- Exceptions:
281
+ | `backend::ext_oneapi_cuda`
282
+ | `CUGraph`
268
283
269
- * Throws with error code `invalid` if `ext_codeplay_has_graph()` returns
270
- `false`.
284
+ | `backend::ext_oneapi_hip`
285
+ | `hipGraph_t`
271
286
272
287
|===
273
288
0 commit comments