Repository navigation
Keep the whole dimension for a loop index that is not affine in the loop variable - #2621
Merged
Merged
Conversation
…oop variable The Python frontend offsets a nested SDFG's view of an array by f(min(range)) and sizes it by the trip count, which assumes the index f is affine in the loop variable. A modulo index such as tbl[(j + t) % 3] broke both: the nested array got shape k + 1 and an offset of j % 3 while the caller passed the table's base pointer, so the nested SDFG read the wrong entries.
tbennun
approved these changes
Sep 30, 2026
tbennun
left a comment
Collaborator
There was a problem hiding this comment.
Good catch!
I am wondering if is_affine_in (and is_polynomial) is faster than Match(a*b+c). We need to benchmark and maybe propagation.py can improve too.
tbennun
added a commit
that referenced
this pull request
Oct 1, 2026
newast.py: the non-affine index handling of #2621 patches the offset-and-squeeze logic that this branch removed, so the branch's version is kept. vector_inference.py: kept the Indices-to-Range conversion and adopted the name-based loop parameter lookup from main. 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.
The frontend offset a nested SDFG array by f(min(loop range)) and sized it by the trip count, which is only valid when the index f is affine in the loop variable; an index such as (j + t) % 3 read the wrong table entries. It now keeps the whole dimension for a non-affine index, with a reproducer that checks the nested connector shapes and the numerics.