Skip to content

Keep the whole dimension for a loop index that is not affine in the loop variable - #2621

Merged
tbennun merged 1 commit into
mainfrom
fix/nested-offset-nonaffine-start
Oct 1, 2026
Merged

tbennun merged 1 commit into
mainfrom
fix/nested-offset-nonaffine-start

Conversation

@ThrudPrimrose

@ThrudPrimrose ThrudPrimrose commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

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.

…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 tbennun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
tbennun added this pull request to the merge queue Oct 1, 2026
Merged via the queue into main with commit 18e6bbf Oct 1, 2026
17 checks passed
@tbennun
tbennun deleted the fix/nested-offset-nonaffine-start branch October 1, 2026 00:49
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants