Fold a repeated symbol name in Range.offset and Range.compose - #2560
Open
ThrudPrimrose wants to merge 2 commits into
Open
Fold a repeated symbol name in Range.offset and Range.compose#2560ThrudPrimrose wants to merge 2 commits into
ThrudPrimrose wants to merge 2 commits into
Conversation
added 2 commits
September 7, 2026 15:00
Two ways an SDFG stopped surviving a serialization round trip, both found by running the GPU pipeline over the npbench kernels with `testing.serialization` on. A memlet parsed from a string mints its symbols with the default dtype and no assumptions, while a map parameter carries the frontend's -- int64 and nonnegative. SymPy compares assumptions, so the two `k` atoms stay distinct and offsetting one subset by the other leaves `k - k` in the range instead of `0`. A symbol in DaCe is its name, so both denote one value; `Range.offset` and `offset_new` now collapse such a pair, guarded by a name count so the substitution only runs when a name really is duplicated (vadv). The GPUAuto reduce expansion reshaped its `_in` descriptor by assigning `shape` alone. `offset` is rank-dependent, so it stayed at the source array's rank and the descriptor failed its own `validate` with "Offset must be the same size as shape"; deserialization then answered with an unregistered placeholder instead of an Array (softmax). It goes through `set_shape`, which recomputes what the rank decides.
`compose` adds a bound of one subset to a bound of the other, exactly as `offset` does, and the two can carry different mints of one name: a map parameter's `i` is int64 and nonnegative, a string-parsed memlet's is neither. SymPy compares assumptions and keeps both, so `RedundantArray` composing them produced `i + (M - i - 1)` where it means `M - 1`. Over the npbench kernels this was the only remaining place a single expression carried one name on two symbols; with both folds in place none of the 37 does, parsed or optimized.
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.
Adding a bound of one subset to a bound of another brings together two mints of the same name — a map parameter's symbol is int64 and nonnegative, a string-parsed memlet's is neither — and SymPy compares assumptions, so
Range.offsetleftk - kandRange.composelefti + (M - i - 1)standing where both mean something simpler; the expression then does not survive a serialization round trip, since only one of the two atoms is written with its dtype. Both now fold throughequalize_symbol, guarded by a name count so the substitution only runs when a name really is repeated, and the GPUAuto reduce expansion reshapes its_indescriptor throughset_shapesooffsetno longer keeps the source array's rank.