Skip to content

Add Polyester threading extension for FastBroadcast VectorOfArray#567

Merged
ChrisRackauckas merged 5 commits intoSciML:masterfrom
ChrisRackauckas-Claude:polyester-threading-ext
Apr 5, 2026
Merged

Add Polyester threading extension for FastBroadcast VectorOfArray#567
ChrisRackauckas merged 5 commits intoSciML:masterfrom
ChrisRackauckas-Claude:polyester-threading-ext

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown
Contributor

Summary

  • Replaces Base.Threads threading with Polyester @batch for FastBroadcast VectorOfArray operations (addresses Multithreading with RecursiveArrayTools.VectorOfArray is broken #564)
  • Creates new 3-way extension RecursiveArrayToolsFastBroadcastPolyesterExt triggered by [FastBroadcast, Polyester]
  • Without Polyester loaded, threaded broadcasting falls back to serial to avoid issues with mixing Polyester and Base threading
  • Adds Polyester as a weakdep and test dependency with compat 0.7.16

Changes

  • ext/RecursiveArrayToolsFastBroadcastExt.jl: Removed Threaded + AbstractVectorOfSArray method that used Threads.@threads. The existing Threaded + AbstractVectorOfArray fallback to Serial now covers all VoA types when Polyester is not loaded.
  • ext/RecursiveArrayToolsFastBroadcastPolyesterExt.jl: New 3-way extension that provides Threaded dispatch for AbstractVectorOfSArray using Polyester.@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

  • Full Pkg.test() passes locally
  • New Polyester extension test verifies extension loads and produces correct results
  • Aqua quality assurance tests pass (no stale deps)
  • CI

🤖 Generated with Claude Code

…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>
ChrisRackauckas and others added 3 commits April 4, 2026 09:48
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>
@ChrisRackauckas ChrisRackauckas merged commit 110f2aa into SciML:master Apr 5, 2026
34 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants