Run tests with JULIA_NUM_THREADS=2 so #570 regression test is covered#571
Merged
ChrisRackauckas merged 1 commit intoSciML:masterfrom Apr 5, 2026
Conversation
…ciML#570 The regression test added in SciML#564 for `@.. thread=true` on `VectorOfArray{SArray}` only triggers the bug path when `Threads.nthreads() >= 2`. FastBroadcast's Polyester-backed threaded materialize splits work along the last axis via `view(dst, :, r)`; with a single thread that split is a no-op, so the `setindex!` loop that originally blew up on the immutable `SVector` element in issue SciML#570 is never reached. CI was delegating to SciML/.github's reusable tests workflow with no thread configuration, meaning `Threads.nthreads() == 1` in CI and the regression test was silently passing without actually exercising the regression. Inline the previously-reusable test job and set `JULIA_NUM_THREADS: "2"` on the `julia-actions/julia-runtest` step, mirroring SciML/OrdinaryDiffEq.jl's SublibraryCI.yml. No changes to the test file are needed. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
adffd1e to
65a3b35
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.
Summary
VectorOfArrayofSVectors is broken on RecursiveArrayTools.jl version 4 #570 reported@.. thread=trueonVectorOfArray{SArray}blew up on v4.0.1. PRs Multithreading withRecursiveArrayTools.VectorOfArrayis broken #564/Add Polyester threading extension for FastBroadcast VectorOfArray #567 already fixed the dispatch path on master (base-ext::Threadedfallback →Serial, plus a Polyester ext for<:AbstractVector{<:SArray}storage), and master does handle Ranocha's reproducer correctly — verified locally against aPkg.develop'd master.RecursiveArrayTools.VectorOfArrayis broken #564 (test/interface_tests.jl"Threaded @.. with VectorOfArray{SArray}") only triggers the failing code path whenThreads.nthreads() >= 2. FastBroadcast's Polyester-backed threaded materialize splits work along the last axis viaview(dst, :, r); with a single thread that split is a no-op and the bad scalarsetindex!loop is never reached..github/workflows/Tests.ymldelegated toSciML/.github/.github/workflows/tests.yml@v1, which does not accept a thread-count input and does not setJULIA_NUM_THREADS, so CI ran withThreads.nthreads() == 1and the regression test silently passed without covering the bug.JULIA_NUM_THREADS: "2"as env on thejulia-actions/julia-runtest@v1step. MirrorsSciML/OrdinaryDiffEq.jl'sSublibraryCI.yml, which passesJULIA_NUM_THREADS: ${{ matrix.num_threads }}the same way. No test-file changes needed.Root cause (for context, already fixed on master)
@.. thread=true v = v + uonVectorOfArray{Float64,2,Matrix{SVector{2,Float64}}}dispatches toFastBroadcast.fast_materialize!(::Threaded, dst, bc).::Threadedmethod forVectorOfArrayin the RAT extension, so dispatch fell through to the fully genericFastBroadcast.jl:215fallback → Polyester batches work by takingview(dst, :, r), producing aSubArraywrapping the VoA.__fast_materialize!scalar loop →subview[i,j] = value→VectorOfArray.setindex!(VA, v, I::Int...)atsrc/vector_of_array.jl:904→VA.u[col][inner_I...] = v→setindex!(::SVector, …)which throws on the immutableSVector.RecursiveArrayTools.VectorOfArrayis broken #564/Add Polyester threading extension for FastBroadcast VectorOfArray #567 added a base-extfast_materialize!(::Threaded, ::AbstractVectorOfArray, ::Broadcasted)fallback that shunts toSerial(), avoiding the view-splitting path, plus a Polyester ext that genuinely threads<:AbstractVector{<:SArray}storage. TheMatrix{<:SArray}case from Ranocha's reproducer still only runs serially (the type alias is<:AbstractVector{<:SArray}), but the fallback keeps it correct.Test plan
test/interface_tests.jlwithJULIA_NUM_THREADS=2against aPkg.develop'd master →Threaded @.. with VectorOfArray{SArray} | 2 pass.VectorOfArrayofSVectors is broken on RecursiveArrayTools.jl version 4 #570 underJULIA_NUM_THREADS=2against master →v = [2.0 2.0 2.0 2.0; 2.0 2.0 2.0 2.0]; againstv4.0.1the same reproducer still throws as reported.{version × group}matrix, now with 2 threads per job.Follow-up (not in this PR)
VectorOfArrayofSVectors is broken on RecursiveArrayTools.jl version 4 #570.🤖 Generated with Claude Code