Skip to content

Add KernelAbstractions backend - #203

Merged
omlins merged 211 commits into
mainfrom
ka2
Feb 24, 2026
Merged

omlins merged 211 commits into
mainfrom
ka2

Conversation

@omlins

@omlins omlins commented Feb 20, 2026

Copy link
Copy Markdown
Owner

This will enable changing the target hardware for a module (which in an interactive session is the REPL module) during a running session: the main use case is prototyping in the REPL that requires switching hardware.
Furthermore, Intel GPUs are supported by KA and therefore now also by ParallelStencil - through KA.

omlins added 30 commits December 3, 2025 11:35

Copilot AI left a comment

Copy link
Copy Markdown

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 adds a KernelAbstractions-based backend to ParallelStencil/ParallelKernel, enabling runtime switching of the execution target hardware (CPU/CUDA/ROCm/Metal/oneAPI) within a running session (e.g., REPL prototyping), plus associated documentation and test coverage.

Changes:

  • Introduces runtime hardware selection APIs (select_hardware / current_hardware and @select_hardware / @current_hardware) and integrates them into kernel launching and allocation paths for KernelAbstractions.
  • Adds KernelAbstractions kernel wrapping/integration (@ka, @ka_auto, @ka_kernel) and adjusts return/flow constraints for KA kernels.
  • Expands test suite and docs/README to cover KA backend behavior and runtime reselection workflow; adds oneAPI handle plumbing via an extension.

Reviewed changes

Copilot reviewed 57 out of 58 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/ParallelKernel/select_hardware.jl Implements runtime hardware selection/queries and KA handle translation entrypoints.
src/ParallelKernel/parallel.jl Adds KA launch path (@ka, @ka_auto), KA kernel wrapping, and xPU handling alongside GPU paths.
src/ParallelKernel/kernel_language.jl Adds KA implementations for thread/grid primitives and shared memory mapping.
src/ParallelKernel/init_parallel_kernel.jl Adds KA as supported package, introduces per-module hardware metadata, and skips Data/TData generation for multi-arch backends.
src/ParallelKernel/shared.jl Adds KA constants, hardware defaults, helper utilities, and KA-specific return/nested-return handling.
src/ParallelKernel/KernelAbstractionsExt/* Adds KA allocator implementations and KA hardware-symbol→backend-handle mapping.
src/ParallelKernel/*Ext/select_hardware.jl Adds CUDA/AMDGPU/Metal/oneAPI backend handle constructors for KA hardware symbols.
src/select_hardware.jl / src/ParallelStencil.jl Exposes the runtime selection API in the ParallelStencil facade and exports it.
src/memopt.jl / src/shared.jl Extends memopt integer-type selection to KA and adds memopt thread-limit constant.
test/* / test/ParallelKernel/* Adds extensive coverage for runtime reselection, KA launches, allocators, and reset semantics.
README.md Documents runtime hardware selection workflow and updates backend overview.
Project.toml Adds KernelAbstractions + oneAPI as weak deps/extensions and updates compat/targets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/shared.jl
Comment thread test/ParallelKernel/test_reset_parallel_kernel.jl
Comment thread test/test_reset_parallel_stencil.jl
Comment thread test/test_parallel.jl
@omlins

omlins commented Feb 24, 2026

Copy link
Copy Markdown
Owner Author

The AD error shown here has already been fixed the main branch. The error shown with overlap is because it is missing kernel abstraction support. So we will merge first and then add the kernel abstraction support to it.

@omlins
omlins merged commit 7f4f924 into main Feb 24, 2026
1 of 13 checks passed
@omlins
omlins deleted the ka2 branch February 24, 2026 17:24
@omlins
omlins restored the ka2 branch February 25, 2026 18:54
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.

2 participants