Repository navigation
Split the BroadcastStyle method to avoid invalidations - #231
Merged
Merged
Conversation
The single `BroadcastStyle` method with a `Union` of the signatures for
`FixedSizeArrayDims` and for their views invalidates compiled code calling
`BroadcastStyle` of unrelated types, e.g. `BroadcastStyle(::Type{<:Tuple})`.
Two methods, one for each signature, do not.
Assisted-by: Claude Code (Opus 5.5)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #231 +/- ##
==========================================
+ Coverage 94.39% 94.42% +0.03%
==========================================
Files 8 8
Lines 321 323 +2
==========================================
+ Hits 303 305 +2
Misses 18 18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ranocha
approved these changes
Oct 24, 2026
ranocha
left a comment
There was a problem hiding this comment.
This looks good to me. Nice to see that the invalidations CI job at least helped to fix some invalidations.
giordano
approved these changes
Oct 24, 2026
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.
The
BroadcastStylemethod forFixedSizeArrayDimsand their views has aUnionof both signatures:When the package is loaded, this method invalidates compiled code that calls
BroadcastStyleof unrelated types. This PR splits it into two methods with the same bodies, one per signature, which do not.Found via the invalidations check of trixi-framework/Trixi.jl#3357, which adds FixedSizeArrays.jl as a dependency. With
@snoop_invalidations using Trixion Julia 1.10:main(without FixedSizeArrays.jl)The 8 removed invalidations are all
BroadcastStyleofTupletypes, e.g.:The remaining 4 come from the method for views. They are
BroadcastStyle(::Type{SubArray}),combine_styles(::SubArray, ...)andmaterialize!(::SubArray, ...)compiled for abstractSubArrays. AnyBroadcastStylemethod for views would invalidate these. Thecconvertmethod only replaces a method of StaticArrays.jl as the root of the same invalidations and adds none.The broadcast style is unchanged, e.g. for
view(a, :, :),view(a, 1:2, :)andview(a, :, 2)(which keepsDefaultArrayStyle{1}as before) of aFixedSizeArray, and for views of arrays with static dimensions. The existing test of the style of views (test/static_dims.jl) still passes. The tests pass on Julia 1.10 and 1.12.🤖 Generated with Claude Code