Skip to content

Prepare the GPUArrays 12 release - #804

Merged
maleadt merged 12 commits into
mainfrom
tb/gpuarrays-12-prep
Oct 7, 2026
Merged

maleadt merged 12 commits into
mainfrom
tb/gpuarrays-12-prep

Conversation

@maleadt

@maleadt maleadt commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Preparation for tagging GPUArrays 12.0.0 (after #790), and for the back-end ports that have to follow it.

  • Adapt 4.7.2. findfirst(>(0.5f0), ::CuArray) and findlast failed to compile on real GPUs: they reduce a Broadcasted over a closure capturing a Base.Fix2, and Adapt's closure rule made that uninferable when KernelAbstractions' @Const adapts it in device code (AcceleratedKernels' reduction kernel takes @Const(src)). Adapt Fix1 and Fix2 with their own rules Adapt.jl#123 fixed that and is released as 4.7.2. KernelAbstractions is raised to 0.9.43, which AK 0.5 already needs.
  • src/deprecated.jl is removed: the old RNG constructors and the GPUArrays.default_rng stub, which only existed so back-ends extending it kept loading. They need a new release for 12 anyway.
  • A scan test with a non-commutative operator (composing affine maps), at sizes that use several blocks, with init and dims. CUDA.jl's own scan got this wrong (accumulate gives wrong results for non-commutative operators CUDA.jl#3339). AK's scan is correct on CUDA; this makes every back-end check it.
  • JLArrays goes back to 0.4.0. The 0.4.0 registration for GPUArrays 11 (New version: JLArrays v0.4.0 JuliaRegistries/General#166221) never merged and will be closed, so the release that needs GPUArrays 12 takes that number.
  • NEWS.md for back-end authors, listing what they must and may delete. Also README and docs fixes: what dense array support needs, the obsolete sortperm requirement for findnz, and links to CUDA.jl's moved sources.
  • Fixes from running the testsuite on the back-ends (CUDA, AMDGPU, oneAPI, OpenCL):
    • Tests for out-of-range dims in sorting.
    • Base.mapreducedim! into a GPU array from an Adjoint/Transpose matrix was ambiguous with LinearAlgebra's methods. Fixes Problem with Base.mapreducedim! #521.
    • findfirst/findlast tests with predicates that have fields (!isnan, Fix2(>, x) ∘ abs, a closure capturing a value). They catch Adapt bugs that JLArrays can't; the remaining ones are fixed in Adapt 4.7.3, which this now requires.
    • A reduction test no longer requires Float64, which the Iris Xe doesn't support.
  • CI: developing the back-end package now happens inside the try, so a back-end whose main doesn't resolve soft-fails instead of failing the build. The OpenCL job on GitHub Actions still passes when OpenCL.jl can't be installed, but now adds a warning to the run.

JLArrays testsuite passes on Julia 1.13. The back-end jobs here will keep soft-failing until the back-end ports land; these are JuliaGPU/CUDA.jl#3356, JuliaGPU/AMDGPU.jl#1145, JuliaGPU/oneAPI.jl#665 and JuliaGPU/OpenCL.jl#541 (Metal.jl to follow), all tested against this branch.

Adapt 4.7.2 adapts Base.Fix1/Fix2 field-wise. Before, a closure capturing one
did not infer when adapted in device code, which is what KernelAbstractions'
@const does, so findfirst/findlast with a Fix2 predicate failed to compile in
AcceleratedKernels' reduction kernel on real GPUs. AcceleratedKernels 0.5 already
needs KernelAbstractions 0.9.43.
The stub only existed so back-ends extending it kept loading; they need a new
release for GPUArrays 12 anyway.
Composing affine maps is exact and catches swapped operands, including where
block aggregates are combined, as in CUDA.jl#3339 for CUDA's own scan.
0.4.0 was never registered, so the release that requires GPUArrays 12 can
take that number.
Add a NEWS.md listing what back-ends have to change and may delete, describe
what a back-end needs for dense arrays, drop the outdated sortperm requirement
for findnz, and fix the links to CUDA.jl's and AMDGPU.jl's array types.
Developing the back-end package was outside the try block, so a back-end whose
main branch did not resolve failed the job instead of soft-failing it. Also
annotate the GitHub Actions run when OpenCL.jl is skipped, since that job
reports success.
Base throws a BoundsError there (from size(A, dims)), AcceleratedKernels an
ArgumentError. Found by AMDGPU.jl's tests, which expect Base's error; the
testsuite now compares against Base for out-of-range dims.
findfirst/findlast reduce with a closure capturing the predicate, which
KernelAbstractions' @const adapts in device code. Adapt failed to infer that for
captured Fix2 and ComposedFunction predicates (fixed in Adapt 4.7.2 and
JuliaGPU/Adapt.jl#124), which JLArrays can't detect but GPU back-ends running
the testsuite can.
Iris Xe and other devices without Float64 can't run it; a Float32 init tests
the same rule.
LinearAlgebra defines Base.mapreducedim! for Adjoint and Transpose sources
with specific operators, which was ambiguous with GPUArrays' method for a GPU
destination (#521). The extra methods send those calls to AcceleratedKernels
like any other source.
Adapt 4.7.3 also adapts closures capturing a ComposedFunction (e.g. a !f
predicate, as in cholesky(::Diagonal)) inferably, and on Julia 1.10 closures
capturing closures.
Base's error there is incidental and differs between versions (a BoundsError
from size(A, 0), or an ErrorException from arraysize), so matching it is not
worth an extra check; an ArgumentError is what out-of-range dims give
everywhere else (sortperm, dims > ndims). Test only those consistent cases.
@maleadt
maleadt merged commit 2a63d90 into main Oct 7, 2026
17 of 18 checks passed
@maleadt
maleadt deleted the tb/gpuarrays-12-prep branch October 7, 2026 14:04
@maleadt maleadt mentioned this pull request Oct 7, 2026
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.

Problem with Base.mapreducedim!

1 participant