Skip to content

Commit 4ba2424

Browse files
Remove redundant POLYESTER_LOADED flag
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>
1 parent 8c4602c commit 4ba2424

3 files changed

Lines changed: 4 additions & 9 deletions

File tree

ext/RecursiveArrayToolsFastBroadcastExt.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ end
3636
::Threaded, dst::AbstractVectorOfArray,
3737
bc::Broadcast.Broadcasted
3838
)
39-
if dst isa AbstractVectorOfSArray && !RecursiveArrayTools.POLYESTER_LOADED[]
39+
# When Polyester is loaded, RecursiveArrayToolsFastBroadcastPolyesterExt
40+
# defines more-specific methods for AbstractVectorOfSArray, so reaching
41+
# this method with an SArray VoA means Polyester is not loaded.
42+
if dst isa AbstractVectorOfSArray
4043
error("Threaded FastBroadcast on VectorOfArray{SArray} requires Polyester.jl. " *
4144
"Add `using Polyester` to enable threaded broadcasting, or use " *
4245
"`@.. thread=false` for serial broadcasting.")

ext/RecursiveArrayToolsFastBroadcastPolyesterExt.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ using FastBroadcast: Serial, Threaded
66
using Polyester
77
using StaticArraysCore
88

9-
# Signal to the base FastBroadcast extension that Polyester threading is available.
10-
RecursiveArrayTools.POLYESTER_LOADED[] = true
11-
129
const AbstractVectorOfSArray = AbstractVectorOfArray{
1310
T, N, <:AbstractVector{<:StaticArraysCore.SArray},
1411
} where {T, N}

src/RecursiveArrayTools.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ module RecursiveArrayTools
142142

143143
export ArrayPartition, AP, NamedArrayPartition
144144

145-
# Flag set to `true` by RecursiveArrayToolsFastBroadcastPolyesterExt when
146-
# Polyester is loaded. Checked by the FastBroadcast ext to decide whether
147-
# to throw an informative error on threaded VoA{SArray} operations.
148-
const POLYESTER_LOADED = Ref(false)
149-
150145
include("precompilation.jl")
151146

152147
end # module

0 commit comments

Comments
 (0)