Repository navigation
fix: avoid double dynamic dispatch in pick_batchsize with run-time batch size - #1076
Merged
Merged
Conversation
devmotion
added a commit
that referenced
this pull request
Oct 5, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…batch size
Replace `BatchSizeSettings{B}(N)` and `BatchSizeSettings{B}(::Val{N})` with
`BatchSizeSettings(B::Int, N::Int)`, which computes all type parameters
before constructing the concrete type.
Fixes #1075
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
devmotion
force-pushed
the
dmw/pick-batchsize-runtime
branch
from
October 5, 2026 14:15
92da381 to
b1eb273
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1076 +/- ##
==========================================
+ Coverage 97.40% 98.21% +0.80%
==========================================
Files 143 143
Lines 8300 8236 -64
==========================================
+ Hits 8085 8089 +4
+ Misses 215 147 -68
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
gdalle
requested changes
Oct 5, 2026
gdalle
left a comment
Member
There was a problem hiding this comment.
Thanks for this!
Can we fix the missing coverage too?
…pick_batchsize` Move the `singlebatch`/`aligned` computation into a foldable helper `batchsize_flags`, used by the run-time constructor and directly by the StaticArrays extension, so static-array inference relies on concrete evaluation rather than const-prop heuristics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All arguments are constants in the StaticArrays case, which forces const-prop regardless of method size, and the flag computation is loop-free foldable arithmetic, so the helper gave no observable inference benefit on Julia 1.10, 1.12 or 1.13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Added direct |
gdalle
approved these changes
Oct 12, 2026
gdalle
left a comment
Member
There was a problem hiding this comment.
Thanks! Docs failure is unrelated
gdalle
pushed a commit
that referenced
this pull request
Oct 13, 2026
…ic arrays (#1078) Follow-up to #1076: lock in that `pick_batchsize` and `prepare_jacobian` infer the batch size from the type for `SVector`, `SMatrix` and `MVector`, with adaptive and fixed batch sizes. Mark multi-batch `jacobian` inference as broken, since `mapreduce(hcat, ...)` changes the static size at every step. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #1075.
BatchSizeSettings{B}(N)with a run-timeBdid two dynamic dispatches. This PR replaces it (and theVal{N}variant) withBatchSizeSettings(B::Int, N::Int), which computes all three type parameters first and constructs the concrete type once. Static-array calls still infer via constant propagation (existing@inferredtests pass).pick_batchsize(AutoForwardDiff(), N)pick_batchsize(AutoForwardDiff(; chunksize = 1), N)jacobian!from the issue (n = 8)prepare_jacobianfrom the issue(medians, Chairmarks)
🤖 Generated with Claude Code