Repository navigation
Follow Base when accumulating along a dimension beyond the array's - #841
Merged
Merged
Conversation
With no elements to process, `map!` returned `nothing` instead of `dest`. `map` of arguments with different lengths goes through `map!` and returned `nothing` too, e.g. `map(+, empty, nonempty)`.
JuliaLang/julia#64233 (Julia 1.15.0-DEV.147, marked for backport to 1.14) made `accumulate` treat a `dims` beyond `ndims(A)` as a trailing singleton dimension: each element now starts a scan of its own, combined with `init` or passed through `reduce_first`, instead of being copied. GPUArrays still copied, so the testsuite's comparisons against Base fail on Julia nightly for every back-end. Detect which behavior Base has rather than checking `VERSION`, because the change will also reach a 1.14 release.
maleadt
force-pushed
the
tb/accumulate-beyond-ndims
branch
from
October 27, 2026 14:01
f9efe4c to
529e9dd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JuliaLang/julia#64233 (1.15.0-DEV.147, marked for backport to 1.14) changed what
accumulatedoes with adimsbeyondndims(A). Base used to copy the array and ignoreinit. Now it treats the extra dimension as a trailing singleton, so each element starts a scan of its own: it is combined withinit, or passed throughreduce_firstwhen noinitis given.GPUArrays still copied, so the testsuite's
accumulatecomparisons against Base fail on Julia nightly for every back-end, e.g. OpenCL.jl (log). JLArrays runs Base's scans on the host, so its tests never reach this code path and stay green.This PR checks once at load time which behavior Base has, instead of comparing
VERSION, because the change will also reach a 1.14 release. On older versions GPUArrays keeps copying. The testsuite gets a case with a tupleinitand a non-commutative operator, which catches swapped operands and broadcasting overinit, and one with an empty input.