Add kernel launch support#9
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a first pass at SYCL kernel launch support in the oneapi-rs Rust wrapper by adding ND-range abstractions, kernel bundle/kernel types, and the FFI plumbing needed to build kernels from source and launch them with raw argument passing.
Changes:
- Add
Context, kernel bundle, and kernel abstractions, plus an example that compiles source and launches a kernel. - Introduce
NdRange/Rangeand queue-side launch APIs for 1D/2D/3D kernel dispatch. - Extend
oneapi-rs-sysC++/cxx bridge types and queue/context/kernel-bundle shims to support the new functionality.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| oneapi-rs/src/range.rs | Adds Range/NdRange plus dimension-specific launch plumbing. |
| oneapi-rs/src/queue.rs | Exposes Queue::get_context and a Queue::launch API. |
| oneapi-rs/src/lib.rs | Exports new context, kernel, and range modules. |
| oneapi-rs/src/kernel.rs | Adds kernel bundle/kernel wrappers and kernel-argument traits. |
| oneapi-rs/src/device.rs | Adds From<UniquePtr<_>> and Clone support for Device. |
| oneapi-rs/src/context.rs | Adds Context wrapper and kernel-bundle creation from source. |
| oneapi-rs/src/buffer.rs | Implements KernelArgument for Buffer (passing USM pointer). |
| oneapi-rs/examples/kernel_launch.rs | Demonstrates building a kernel from source and launching it. |
| oneapi-rs-sys/src/types-sys.rs | Extends bridged types (Context/Kernel bundles) and adds Range{1,2,3} POD structs. |
| oneapi-rs-sys/src/queue.cpp | Adds context getter and ND-range kernel launch shims. |
| oneapi-rs-sys/src/queue-sys.rs | Exposes new queue FFI: context getter + 1D/2D/3D launch functions. |
| oneapi-rs-sys/src/lib.rs | Registers new context and kernel_bundle bridge modules. |
| oneapi-rs-sys/src/kernel-bundle.cpp | Implements kernel bundle creation/build and kernel lookup shims. |
| oneapi-rs-sys/src/kernel-bundle-sys.rs | Adds cxx bridge for kernel bundle operations. |
| oneapi-rs-sys/src/device.cpp | Adds a device clone shim for ownership transfer patterns. |
| oneapi-rs-sys/src/device-sys.rs | Exposes device clone via cxx bridge. |
| oneapi-rs-sys/src/context.cpp | Implements context creation from a list of devices. |
| oneapi-rs-sys/src/context-sys.rs | Adds cxx bridge for context creation. |
| oneapi-rs-sys/include/types.hpp | Adds SYCL aliases for Context/Kernel and kernel bundle types. |
| oneapi-rs-sys/include/queue.hpp | Extends queue shim header with context getter + launch declarations. |
| oneapi-rs-sys/include/kernel-bundle.hpp | Adds header for kernel bundle shim declarations. |
| oneapi-rs-sys/include/device.hpp | Extends device shim header with clone declaration. |
| oneapi-rs-sys/include/context.hpp | Adds header for context shim declarations. |
| oneapi-rs-sys/build.rs | Registers new bridge sources/headers for build. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (3)
oneapi-rs/src/range.rs:57
- Trait impl method still uses
args: impl KernelArgumentList<ARGC>, which won’t match the corrected trait signature and is also not permitted for trait method parameters on stable Rust. Update the signature to use a generic type parameter.
unsafe fn launch<const ARGC: usize>(
&self,
queue: &mut Queue,
kernel: &Kernel,
args: impl KernelArgumentList<ARGC>,
oneapi-rs/src/range.rs:82
- Trait impl method still uses
args: impl KernelArgumentList<ARGC>, which won’t match the corrected trait signature and is also not permitted for trait method parameters on stable Rust. Update the signature to use a generic type parameter.
unsafe fn launch<const ARGC: usize>(
&self,
queue: &mut Queue,
kernel: &Kernel,
args: impl KernelArgumentList<ARGC>,
oneapi-rs/src/range.rs:107
- Trait impl method still uses
args: impl KernelArgumentList<ARGC>, which won’t match the corrected trait signature and is also not permitted for trait method parameters on stable Rust. Update the signature to use a generic type parameter.
unsafe fn launch<const ARGC: usize>(
&self,
queue: &mut Queue,
kernel: &Kernel,
args: impl KernelArgumentList<ARGC>,
bratpiorka
approved these changes
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds:
NdRangereimplementationNote: The argument passing syntax is not final. This PR mainly provides scaffolding for future macro-related work.