Add Polyester threading extension for FastBroadcast VectorOfArray#567
Merged
ChrisRackauckas merged 5 commits intoSciML:masterfrom Apr 5, 2026
Merged
Conversation
…ay (SciML#564) Replace Base.Threads threading with Polyester @Batch in FastBroadcast VectorOfArray extension. When Polyester is loaded, the 3-way extension RecursiveArrayToolsFastBroadcastPolyesterExt provides threaded broadcasting using Polyester.@Batch. Without Polyester, threaded broadcasting falls back to serial to avoid issues with mixing Polyester and Base threading. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
When Polyester is not loaded and a user requests threaded FastBroadcast
on VectorOfArray{SArray}, throw an error explaining they need to load
Polyester.jl. Also fix tests to use Vector-of-SVector construction
(not Matrix-of-SVector) to properly exercise the SArray-specific path.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When Polyester is loaded, RecursiveArrayToolsFastBroadcastPolyesterExt defines more-specific methods for AbstractVectorOfSArray that win dispatch, so the base ext's AbstractVectorOfArray fallback is only reached when Polyester is not loaded. The flag check was redundant. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Commit 286ea09 accidentally moved FastBroadcast, Polyester, SparseArrays, StaticArrays, and RecursiveArrayToolsShorthandConstructors into [deps] (they were added there by stray Pkg.add/Pkg.develop calls during development). Restore FastBroadcast/Polyester/SparseArrays to [weakdeps] and drop StaticArrays/ShorthandConstructors (they are test-only). This fixes the Aqua stale_deps and deps_compat failures on Julia 1.10 CI, which were caused by the polluted [deps] triggering a circular precompile with the ShorthandConstructors subpackage dev'd in runtests.jl. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
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
@batchfor FastBroadcast VectorOfArray operations (addresses Multithreading withRecursiveArrayTools.VectorOfArrayis broken #564)RecursiveArrayToolsFastBroadcastPolyesterExttriggered by[FastBroadcast, Polyester]0.7.16Changes
ext/RecursiveArrayToolsFastBroadcastExt.jl: RemovedThreaded+AbstractVectorOfSArraymethod that usedThreads.@threads. The existingThreaded+AbstractVectorOfArrayfallback toSerialnow covers all VoA types when Polyester is not loaded.ext/RecursiveArrayToolsFastBroadcastPolyesterExt.jl: New 3-way extension that providesThreadeddispatch forAbstractVectorOfSArrayusingPolyester.@batch, with disambiguation method to avoid ambiguity with the base extension's fallback.Project.toml: Added Polyester as weakdep, extension, compat entry, extra, and test target.test/interface_tests.jl: Added tests verifying Polyester extension loads and threaded broadcast works correctly.Context
Per discussion in #564 (comment #564 (comment)), mixing Polyester.jl threads and Base multithreading causes issues. This PR uses Polyester-only threading (consistent with how FastBroadcast.jl handles threading in general) and falls back to serial when Polyester is not loaded.
Test plan
Pkg.test()passes locally🤖 Generated with Claude Code