Skip to content

[JLArrays] Support KA 0.10 - #826

Open
christiangnrd wants to merge 6 commits into
diagcopyfrom
jlka0.10
Open

christiangnrd wants to merge 6 commits into
diagcopyfrom
jlka0.10

Conversation

@christiangnrd

@christiangnrd christiangnrd commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

JLArrays, the CPU reference back-end used to test GPUArrays and downstream packages without a GPU, still targets KernelAbstractions 0.9. The vendor back-ends (CUDA, AMDGPU, Metal, oneAPI, OpenCL) have moved to KernelAbstractions 0.10, which builds on KernelInterface, so a test environment using JLArrays can't move along with them.

This ports JLArrays to KernelAbstractions 0.10 and drops 0.9. JLBackend becomes a KernelInterface back-end in the same shape as the vendor ports: it converts arguments to POCL device arrays and forwards compilation, launches and device queries to KernelAbstractions' POCL back-end, which is what runs KA 0.10 kernels on the CPU. The KernelAbstractions and KernelInterface testsuites now run on JLArrays, skipping the same POCL-only tests the vendor back-ends skip.

Along the way:

  • convert.(T, ::JLArray) failed to compile, because JLArrays wrapped Refs before POCL could recognize a Ref of a type. JLArrays now converts only what the Ref holds.
  • JLArray kernels compute indices in Int like POCL's own, instead of the Int32 KernelAbstractions uses on GPUs, which keeps LLVM from vectorizing over work-items (~7% on a 2048×2048 element-wise kernel).
  • Arguments are converted without allocating per launch (c .= a .+ b goes from 1344 to 480 bytes).

This is breaking, hence JLArrays 0.5: JLBackend(; static) is gone, since KA 0.10's CPU back-end has no static scheduling, and so is JLDeviceArray (JLArrays are POCL CLDeviceArrays in kernels). POCL's SPIR-V back-end cannot lower 128-bit integers, so Int128 is no longer tested with JLArrays.

The two testsuites add a few minutes to CI, and the macOS runners, which run tests one at a time, were already close to the 60-minute job limit, so the limit is raised to 90 minutes.

Stacked on #829.

@christiangnrd

christiangnrd commented Oct 21, 2026 •

Copy link
Copy Markdown
Member Author

I bumped CI timeout to 90 minutes since the POCL backend of KA 0.10 increases testsuite runtime and the macOS runners with only 1 job were right on the edge (either side)

I cancelled the latest Buildkite run since the GHA timeout increase was the only change since the last successful run.

christiangnrd and others added 6 commits October 27, 2026 15:05
With KernelAbstractions 0.10, JLArray kernels run on its POCL back-end.
Drop the KA 0.9 code paths, including JLDeviceArray, and convert
JLArrays to POCL device arrays. Leave `Ref`s to POCL's conversion after
converting their contents, so that `Ref`s of types, as passed by
`convert.(T, A)`, are handled too. POCL's SPIR-V back-end cannot lower
128-bit integers, so stop testing Int128 with JLArrays.
Make JLBackend a KernelInterface back-end, like the GPU back-ends that
moved to KernelAbstractions 0.10: it converts arguments to POCL's and
forwards compilation, launches and device queries to the POCL back-end.
Run the KernelAbstractions and KernelInterface testsuites on it, skipping
the dense-to-sparse test, which JLArrays don't support, and the tests
that only exercise KernelAbstractions' own CPU back-end.

KA 0.10's CPU back-end has no static scheduling anymore, so this removes
the `static` option of JLBackend.
KernelAbstractions narrows `@index` computations to Int32 on every
back-end but POCL, because on POCL the narrowing keeps LLVM from
vectorizing the loops over work-items. JLArray kernels run on POCL, but
JLBackend isn't a POCLBackend, so they got Int32 indices. Using Int
speeds up a 2048x2048 element-wise kernel by about 7%.
A JLArray was converted to a POCL device array by wrapping its memory in
an Array and adapting that with a fresh KernelAdaptor, allocating both on
every conversion, which happens several times per argument per launch.
Construct the device array from the JLArray's pointer instead. This
reduces the allocations of `c .= a .+ b` from 1344 to 480 bytes.

Keep rejecting isbits-union element types, which the wrapping used to
reject: POCL's device arrays read their type tags after the data, where
JLArrays don't store any.

This branch has not been deployed

No deployments
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