-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[mlir] Add requiresReplacedValues
and visitReplacedValues
to PromotableOpInterface
#86792
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
Changes from all commits
e3b7f23
9e85edd
327ee45
a03e75d
975e1ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,6 +229,36 @@ def PromotableOpInterface : OpInterface<"PromotableOpInterface"> { | |
(ins "const ::llvm::SmallPtrSetImpl<mlir::OpOperand *> &":$blockingUses, | ||
"::mlir::RewriterBase &":$rewriter) | ||
>, | ||
InterfaceMethod<[{ | ||
This method allows the promoted operation to visit the SSA values used | ||
in place of the memory slot once the promotion process of the memory | ||
slot is complete. | ||
|
||
If this method returns true, the `visitReplacedValues` method on this | ||
operation will be called after the main mutation stage finishes | ||
(i.e., after all ops have been processed with `removeBlockingUses`). | ||
|
||
Operations should only the replaced values if the intended | ||
transformation applies to all the replaced values. Furthermore, replaced | ||
values must not be deleted. | ||
}], "bool", "requiresReplacedValues", (ins), [{}], | ||
[{ return false; }] | ||
>, | ||
InterfaceMethod<[{ | ||
Transforms the IR using the SSA values that replaced the memory slot. | ||
|
||
This method will only be called after all blocking uses have been | ||
scheduled for removal and if `requiresReplacedValues` returned | ||
true. | ||
|
||
The rewriter is located after the promotable operation on call. All IR | ||
mutations must happen through the rewriter. During the transformation, | ||
*no operation should be deleted*. | ||
}], | ||
"void", "visitReplacedValues", | ||
(ins "::llvm::ArrayRef<std::pair<::mlir::Operation*, ::mlir::Value>>":$mutatedDefs, | ||
"::mlir::RewriterBase &":$rewriter), [{}], [{ return; }] | ||
Comment on lines
+259
to
+260
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like to be absolutely complete this method should also provide the memory slot, as one may want to know which memory slot specifically those definitions correspond to. But at the same time I am not really sure that this would be useful in practice, so change it only if you feel like it. |
||
>, | ||
]; | ||
} | ||
|
||
|
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.
Name suggestion:
replacingValues