Rewrite sliding window bounds let at the correct loop level#9150
Open
abadams wants to merge 2 commits into
Open
Rewrite sliding window bounds let at the correct loop level#9150abadams wants to merge 2 commits into
abadams wants to merge 2 commits into
Conversation
Sliding window populates a replacements map keyed by .min/.max let names and rewrites the first matching LetStmt encountered on the way out from the producer. That happens to hit the right let today because bounds inference places the lets driving production at the producer's loop nest level, but other lets with the same names can appear at deeper loop nest levels on the consume side. Gate replacement on enclosing_loops.size() matching the depth recorded when the producer was visited, so only lets at the producer's loop level are rewritten. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Member
|
I'm not sure how the depth eliminates ambiguity. Does it merely make it less likely? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9150 +/- ##
=======================================
Coverage ? 69.23%
=======================================
Files ? 254
Lines ? 78220
Branches ? 18714
=======================================
Hits ? 54157
Misses ? 18510
Partials ? 5553 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
|
There should be a single set of .min/.max lets per loop. But I guess you're saying there could be sibling loops at the depth of the produce node, multiple of which contain .min/.max lets, but only one of which actually contains the produce node? Perhaps I should change it to check the loop name instead of the depth. |
Member
|
|
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.
Sliding window populates a replacements map keyed by .min/.max let names and rewrites the first matching LetStmt encountered on the way out from the producer. That happens to hit the right let today because we don't inject bounds for that Func anywhere else that we might hit first (e.g. inside a loop on the consumer side, which is visited after the producer). That's a shaky assumption though. It caused a bug in another branch where I added more .min/.max declaration sites for other purposes. This PR explicitly only rewrites the ones at the Produce node's loop level. No test changes because there's no bug to trigger on main. This just makes the code more robust to future changes.