Repository navigation
Respect destination dimensions in VectorOfArray broadcasting - #685
Draft
ChrisRackauckas wants to merge 1 commit into
Draft
ChrisRackauckas wants to merge 1 commit into
ChrisRackauckas wants to merge 1 commit into
Conversation
Slice operands using the destination dimension and preserve lower-dimensional arguments across inner arrays. Expand each inner broadcast to its destination axes, including static arrays and FastBroadcast extension paths. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Codex <noreply@openai.com> Agent-Harness: Codex CLI 0.162.1 Agent-Model: gpt-6.1-sol Agent-Session: 01a14bd6-bd53-7dd2-94c0-6f6613286f91
This branch has not been deployed
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.
In-place
VectorOfArraybroadcasting slices array arguments along the destination's outer dimension. Lower-dimensional arguments broadcast across inner arrays, and singleton outer dimensions reuse their sole slice. Inner broadcasts use the destination axes for expansion, including immutable StaticArrays, StructArrays storage, and serial/Polyester FastBroadcast.Fixes #680
Keep this draft out of merge consideration until a maintainer has reviewed it. No public signatures or dependencies change.
Reproduction and regression evidence
Reproduced on default-branch commit
214fb8d556b24581e65015bdeb340102aa33a76d(package version 4.5.5) and the latest registered release, 4.5.5, with Julia 1.12.7. Both produce[11.0 24.0; 12.0 25.0; 13.0 26.0]for the issue's vector-addition example instead of dense-array broadcasting's[11.0 14.0; 22.0 25.0; 33.0 36.0].The new regression file compares against Base dense-array broadcasting for mutable vectors, SVectors, MVectors, StructArray storage, matrix inner arrays, zero-dimensional operands, singleton dimensions, and full-dimensional operands. It exercises serial and threaded FastBroadcast on SVector storage.
With the implementation fix stashed, running the regression file in a local environment that develops the checkout:
JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4 timeout 3600 julia --project=tmp/main -e 'using RecursiveArrayTools, StaticArrays; v=VectorOfArray([SVector(1.,2.), SVector(3.,4.)]); f(v)=(v .= v .+ v); f(v); @show @allocated f(v); include("RecursiveArrayTools.jl/test/Core/voa_broadcast_dimensions.jl")'Relevant output (stack traces omitted):
After restoring the fix, the same regression file:
JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4 timeout 3600 julia --project=tmp/main -e 'include("RecursiveArrayTools.jl/test/Core/voa_broadcast_dimensions.jl")'Validation
All Julia commands use
JULIA_NUM_THREADS=4,JULIA_NUM_PRECOMPILE_TASKS=4, andtimeout 3600.GROUP=Core julia --project=RecursiveArrayTools.jl -e 'using Pkg; Pkg.test()':Testing RecursiveArrayTools tests passed; includes all 130 new checks and the existing zero-allocation assertions.GROUP=QA julia --project=RecursiveArrayTools.jl -e 'using Pkg; Pkg.test()': 20/20 passed.julia --project=@runic -m Runic --inplaceon all six changed Julia files: passed.typos tmp/diff.patchon the complete diff, including the new test file, andgit diff --check: passed.Range-only FastBroadcast expressions can simplify to a range assignment before reaching these broadcast methods. A separate
@.. v = x + 1check with an SVector-backed destination andx = 10.:10.:30.fails on the unmodified default branch withsetindex!(::SVector{3, Float64}, value, ::Int) is not defined.That assignment path is outside this fix; the tests cover lower-dimensional ranges through Base broadcasting.Risk assessment
🤖 Posted by an AI agent — harness: Codex CLI 0.162.1 · model: gpt-6.1-sol
Conversation: Codex exec session 01a14bd6-bd53-7dd2-94c0-6f6613286f91 (no session URL)