-
Notifications
You must be signed in to change notification settings - Fork 30
MLIR: Add ReplaceOpAction into DialectConversion and PatternMatch #709
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
base: aie-public
Are you sure you want to change the base?
Conversation
a84528d to
a1da90b
Compare
| /// Find uses of `from` and replace them with `to`. Also notify the listener | ||
| /// about every in-place op modification (for every use that was replaced). | ||
| void replaceAllUsesWith(Value from, Value to) { | ||
| if (auto *fromOp = from.getDefiningOp()) |
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.
Also notify the listener
/// about every in-place op modification (for every use that was replaced).
Was this not up-to-date? Or is an action something else than the listener?
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.
My main question is also whats the difference between an action and a listener
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.
The RewriterBase supports attaching listeners, and the MLIRContext supports action handlers. In this PR, we use the action handlers on the MLIRContext, which allow us to observe across all passes without modifying each.
cferry-AMD
left a comment
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.
replaceAllUsesWith(ValueRange, ValueRange) should also be modified, shouldn't it?
|
cferry-AMD
left a comment
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.
Thanks for the claraifications, that looks good.
Add action to enable listener for
RewriterBase::replaceOp,RewriterBase::replaceAllUsesWithand friends.