Skip to content

Add kernel launch support#9

Merged
bratpiorka merged 33 commits into
oneapi-src:mainfrom
szymon-zadworny:kernel_launch
Jul 27, 2026
Merged

Add kernel launch support#9
bratpiorka merged 33 commits into
oneapi-src:mainfrom
szymon-zadworny:kernel_launch

Conversation

@szymon-zadworny

Copy link
Copy Markdown
Contributor

This PR adds:

  • support for launching 1, 2 and 3 dimensional kernels
  • NdRange reimplementation
  • a set of traits for defining valid SYCL kernel arguments
  • a kernel launch example

Note: The argument passing syntax is not final. This PR mainly provides scaffolding for future macro-related work.

@bratpiorka
bratpiorka requested a review from Copilot July 27, 2026 07:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/Range and queue-side launch APIs for 1D/2D/3D kernel dispatch.
  • Extend oneapi-rs-sys C++/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.

Comment thread oneapi-rs-sys/src/context.cpp
Comment thread oneapi-rs-sys/src/kernel-bundle.cpp
Comment thread oneapi-rs/src/queue.rs Outdated
Comment thread oneapi-rs/src/buffer.rs
Comment thread oneapi-rs/src/range.rs
Comment thread oneapi-rs/src/range.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>,

Comment thread oneapi-rs/src/range.rs
@bratpiorka
bratpiorka merged commit 43f9081 into oneapi-src:main Jul 27, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants