Conversation
`maybestatic_reshape` wrapped any array into an `SArray` for a static size, which copies device arrays and traced arrays to the host. Only `StaticArray` inputs stay or become static arrays now, other arrays are reshaped with the non-static size. Created by generative AI.
Tools that generic code needs to keep static sizes static, collected from private helpers of MeasureBase: - `size_dims`, the inverse of `canonical_size`, and a type-level `axes2size` for statically sized axes. - `static_reduce`, `static_all` and `static_any`, pairwise folds over tuple types that infer as constants where `reduce`, `all` and `any` over tuples of values don't (Julia 1.10). - `sum_leading_dims`, `drop_leading_dims`, `merge_leading_dims` and `all_leading_dims`, indexed by a static number of leading dimensions. Static arrays stay static, lazy broadcasts are reduced lazily where their style allows it. - `maybestatic_view` and `split_at`, views and splits of vectors and tuples that stay static for static inputs and indices. Created by generative AI.
Reducing dimension by dimension costs one kernel launch per dimension on a device. Only StaticArrays needs it, `all` over several dimensions at once is unsupported there. Created by generative AI.
`static_reduce(op, f, T)` becomes `static_mapreduce(f, op, T)`, like `mapreduce(f, op, itr)`, and `static_reduce(op, T)` stays the `identity` case. Reducing an empty tuple type has no result and says so. `maybestatic_view` also takes an index range, like `view`. Created by generative AI.
Created by generative AI.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12 +/- ##
===========================================
- Coverage 100.00% 97.10% -2.90%
===========================================
Files 1 1
Lines 110 173 +63
===========================================
+ Hits 110 168 +58
- Misses 0 5 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Written by Claude (Fable 5.1, high effort) on behalf of the maintainer.
Work in progress, companion to JuliaMath/MeasureBase.jl#182.
Static and dynamic size tools that MeasureBase's batched-first rewrite needs, moved here from MeasureBase's private helpers so that other packages can use them:
size_dims, a type-levelaxes2size, constant-folding reductions over tuple types (static_reduce,static_mapreduce,static_all,static_any, folded pairwise so they infer as constants on Julia 1.10), a static-preserving leading-dimensions family (sum_leading_dims,drop_leading_dims,merge_leading_dims,all_leading_dims), and static-preserving vector splits and views (split_at,maybestatic_view).One breaking change, hence 0.3.0:
maybestatic_reshapekeeps onlyStaticArrayinputs static. It used to wrap any array, including device and traced arrays, into anSArraywhen the target size was static, which copies through the host. See NEWS.md.https://claude.ai/code/session_01L5yPndh2K6u14z3CwF9YXf