-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: Walk regions for rewritings instead of ops #3506
Conversation
Currently, the pattern rewriter walker walks an operation, and tries to apply patterns on all contained operations, including itself. This is not what we would want, as rewriting a toplevel operation is dangerous, if that operation does not have a parent. This commit changes the walker to walk regions instead of operations, so it is clear that the toplevel operation will not be modified. This is similar to what MLIR currently does in applyPatternsAndFoldGreedily.
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3506 +/- ##
==========================================
- Coverage 90.33% 90.33% -0.01%
==========================================
Files 464 464
Lines 58157 58152 -5
Branches 5557 5558 +1
==========================================
- Hits 52536 52530 -6
Misses 4190 4190
- Partials 1431 1432 +1 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few small comments but looks good to me.
PS. why don't we have the batched suggestion thing enabled
Currently, the pattern rewriter walker walks an operation, and tries to apply patterns on all contained operations, including itself. This is not what we would want, as rewriting a toplevel operation is dangerous, if that operation does not have a parent.
This commit changes the walker to walk regions instead of operations, so it is clear that the toplevel operation will not be modified. This is similar to what MLIR currently does in applyPatternsAndFoldGreedily.