[SYCL][Graph] Allow capturing restricted host tasks in native recording mode#22143
Conversation
25ba6de to
1e41cd9
Compare
…d commands Move EnqueueHostTaskData and NativeHostTask from the anonymous namespace in commands.cpp into host_task.hpp so both the native recording path in handler.cpp and the scheduler path in commands.cpp use the same type and callback rather than duplicating the pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5cfa113 to
e1b75fd
Compare
mmichel11
left a comment
There was a problem hiding this comment.
Small feedback about proper handling with older driver versions.
slawekptak
left a comment
There was a problem hiding this comment.
Please note this PR: #22518 . It changes the implementation of native host tasks (new command type). I think it is not an issue, and depending on which PR is merged first, the other one just needs to be updated, but I'm sharing it just in case. It would be great if you could take a look at that one and make sure there are no issues. Thanks.
|
One more question - is recording of restricted host tasks (enqueue_functions) supported today, but for a non-native graph recording mode? |
Yes, this PR introduces two tests for restricted host tasks: one for native recording mode and one for the original command buffer mode. |
Thanks for sharing this. I took a look and your PR is a nice cleanup and I agree that making a native host task its own node type is a nice way to organize it. It looks like our PRs touch a lot of the same things and while don't think it will be a problem to incorporate these two PRs conceptually, I anticipate that it would be a problem in terms of actually reconciling the text diffs. But overall I think your PR is a good rework of the native host task feature. |
There was a problem hiding this comment.
Pull request overview
This PR enables SYCL Graph native recording mode to capture restricted host tasks submitted via the sycl_ext_oneapi_enqueue_functions extension, aligning native recording behavior with the newer enqueue-functions host task API. It does so by bypassing the scheduler for eligible host tasks during recording and directly enqueueing the backend host-task callback into the native graph capture.
Changes:
- Allow restricted host tasks to be recorded in native recording mode by enqueueing
urEnqueueHostTaskExpfromhandler::finalize()and retaining callback lifetime viagraph_impl. - Centralize native host-task callback plumbing (
EnqueueHostTaskData,NativeHostTask<>, and host-task functor extraction) indetail/host_task.hpp, and update scheduler host-task dispatch to use it. - Add E2E coverage for both command-buffer and native-recording record/replay paths, and update the Graph extension documentation to reflect the new support.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| sycl/test-e2e/Graph/RecordReplay/NativeRecording/enqueue_func_host_task.cpp | Adds a native-recording-specific E2E test wrapper enabling native recording for the shared test logic. |
| sycl/test-e2e/Graph/RecordReplay/Inputs/enqueue_func_host_task.cpp | Shared E2E test logic validating restricted host task recording/replay semantics across two replays. |
| sycl/test-e2e/Graph/RecordReplay/enqueue_func_host_task.cpp | Adds command-buffer-path E2E coverage for restricted host task recording via the Record & Replay path. |
| sycl/source/handler.cpp | Implements native-recording host-task capture path: validates restricted host task + backend support, stores callback data in the graph, enqueues UR host task, and returns a completed host event during recording. |
| sycl/source/detail/scheduler/commands.cpp | Removes local native-host-task callback helpers and switches to the shared detail/host_task.hpp implementation. |
| sycl/source/detail/host_task.hpp | Introduces shared native-host-task callback data + callback function template, and exposes host-task functor extraction via HandlerAccess. |
| sycl/source/detail/graph/graph_impl.hpp | Adds API and storage to own callback data for host tasks recorded in native recording mode. |
| sycl/source/detail/graph/graph_impl.cpp | Implements graph_impl::addNativeHostTaskCallback() to retain native host-task callback payloads for UR. |
| sycl/include/sycl/handler.hpp | Declares HandlerAccess::getHostTaskFunc() to support internal extraction of host-task functors. |
| sycl/doc/extensions/experimental/sycl_ext_oneapi_graph.asciidoc | Documents the native-recording limitation for handler::host_task and the supported restricted host-task path via enqueue-functions. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ifetime needs to be managed by graph)
|
@intel/llvm-gatekeepers Please consider merging :) |
This PR allows SYCL Graph native recording mode to capture the new restricted host task defined in the
sycl_ext_oneapi_enqueue_functionsextension.