Fix bounds inference for implicit pure def with RVar args (#9102)#9103
Merged
Fix bounds inference for implicit pure def with RVar args (#9102)#9103
Conversation
When a Func's first definition is an update whose LHS uses an RVar directly (e.g. `h(r.x) += ...`), define_base_case synthesized an implicit pure definition but reused the RVar's name for the pure dimension. The resulting name collision caused bounds inference to resolve the update's RVar loop bounds to the pure dimension's output-buffer bounds instead of the RDom's, which broke scheduling directives like vectorize/unroll on the RVar. Treat Variables with a defined reduction_domain the same way we treat Variables with a defined param: generate a fresh pure-arg Var instead of reusing the name. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
LLVM's ARM64 backend fails to widen the 15-wide int32 vector store produced by the original reproducer's vectorize(r.x) schedule. The bug under test is about bounds inference, not vector widths, so round the RDom extent up to 16 so vectorize lowers to clean NEON stores on every supported target. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
alexreinking
approved these changes
Apr 22, 2026
Member
alexreinking
left a comment
There was a problem hiding this comment.
Easy fix and a regression test, woot!
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.
When a Func's first definition is an update whose LHS uses an RVar directly (e.g.
h(r.x) += ...), define_base_case synthesized an implicit pure definition but reused the RVar's name for the pure dimension. The resulting name collision caused bounds inference to resolve the update's RVar loop bounds to the pure dimension's output-buffer bounds instead of the RDom's, which broke scheduling directives like vectorize/unroll on the RVar.Treat Variables with a defined reduction_domain the same way we treat Variables with a defined param: generate a fresh pure-arg Var instead of reusing the name.
Fixes #9102
This one was 100% Claude. I'm just opening the PR for it.