From 064df73e37d83f22b4388ed6164472b460912fc0 Mon Sep 17 00:00:00 2001 From: CompatHelper Julia Date: Fri, 2 Oct 2026 03:36:52 +0000 Subject: [PATCH 1/2] CompatHelper: bump compat for AcceleratedKernels to 0.5, (keep existing compat) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 2a992247..1b76d948 100644 --- a/Project.toml +++ b/Project.toml @@ -34,7 +34,7 @@ oneAPI_Support_jll = "b049733a-a71d-5ed3-8eba-7d323ac00b36" [compat] AbstractFFTs = "1.5.0" -AcceleratedKernels = "0.3.1, 0.4" +AcceleratedKernels = "0.3.1, 0.4, 0.5" Adapt = "4" CEnum = "0.4, 0.5" ExprTools = "0.1" From 782a97d45b7d2922484f80cdb445b21b1a89005f Mon Sep 17 00:00:00 2001 From: Michel Schanen Date: Fri, 2 Oct 2026 09:09:59 -0500 Subject: [PATCH 2/2] Adapt to the AcceleratedKernels 0.5 host API AcceleratedKernels 0.5 redesigned its host API: the backend is derived from the arrays (or passed as a keyword) instead of positionally, and launch settings such as `block_size` moved into algorithm values passed as `alg`. Update the accumulate wrappers accordingly, keeping the reduced block size of 64 through `ScanPrefixes`/`SliceScan`, and require 0.5 since the old calls no longer resolve. The sorting wrappers already use keyword-only calls and need no change. --- Project.toml | 2 +- src/accumulate.jl | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Project.toml b/Project.toml index 1b76d948..63ac73c4 100644 --- a/Project.toml +++ b/Project.toml @@ -34,7 +34,7 @@ oneAPI_Support_jll = "b049733a-a71d-5ed3-8eba-7d323ac00b36" [compat] AbstractFFTs = "1.5.0" -AcceleratedKernels = "0.3.1, 0.4, 0.5" +AcceleratedKernels = "0.5" Adapt = "4" CEnum = "0.4, 0.5" ExprTools = "0.1" diff --git a/src/accumulate.jl b/src/accumulate.jl index d3647faa..193a0cb0 100644 --- a/src/accumulate.jl +++ b/src/accumulate.jl @@ -3,19 +3,23 @@ import oneAPI: oneArray, oneAPIBackend import AcceleratedKernels as AK # Use a smaller block size on Intel GPUs to work around a scan correctness issue -# with the Blelloch parallel prefix sum at larger block sizes (>=128). +# with the parallel prefix sum at larger block sizes (>=128). const _ACCUMULATE_BLOCK_SIZE = 64 +# The scan algorithm for the given `dims`: whole-array scans and scans along a dimension +# use different algorithms, so pick the one AcceleratedKernels' `Auto()` would, with our +# block size. +_scan_alg(dims) = dims === nothing ? AK.ScanPrefixes(block_size = _ACCUMULATE_BLOCK_SIZE) : + AK.SliceScan(block_size = _ACCUMULATE_BLOCK_SIZE) + # Accumulate operations using AcceleratedKernels -Base.accumulate!(op, B::oneArray, A::oneArray; init = zero(eltype(A)), - block_size = _ACCUMULATE_BLOCK_SIZE, kwargs...) = - AK.accumulate!(op, B, A, oneAPIBackend(); init, block_size, kwargs...) +Base.accumulate!(op, B::oneArray, A::oneArray; dims = nothing, alg = _scan_alg(dims), kwargs...) = + AK.accumulate!(op, B, A; dims, alg, kwargs...) -Base.accumulate(op, A::oneArray; init = zero(eltype(A)), - block_size = _ACCUMULATE_BLOCK_SIZE, kwargs...) = - AK.accumulate(op, A, oneAPIBackend(); init, block_size, kwargs...) +Base.accumulate(op, A::oneArray; dims = nothing, alg = _scan_alg(dims), kwargs...) = + AK.accumulate(op, A; dims, alg, kwargs...) -Base.cumsum(src::oneArray; block_size = _ACCUMULATE_BLOCK_SIZE, kwargs...) = - AK.cumsum(src, oneAPIBackend(); block_size, kwargs...) -Base.cumprod(src::oneArray; block_size = _ACCUMULATE_BLOCK_SIZE, kwargs...) = - AK.cumprod(src, oneAPIBackend(); block_size, kwargs...) +Base.cumsum(src::oneArray; dims = nothing, alg = _scan_alg(dims), kwargs...) = + AK.cumsum(src; dims, alg, kwargs...) +Base.cumprod(src::oneArray; dims = nothing, alg = _scan_alg(dims), kwargs...) = + AK.cumprod(src; dims, alg, kwargs...)