[Mlir-commits] [mlir] 020ca17 - [mlir][linalg][bufferize] Move bufferizesToAliasOnly to extraClassDecls
Matthias Springer
llvmlistbot at llvm.org
Fri Nov 5 02:08:49 PDT 2021
Author: Matthias Springer
Date: 2021-11-05T18:08:43+09:00
New Revision: 020ca1747d6c98f3009ff919023efae9d68eca39
URL: https://github.com/llvm/llvm-project/commit/020ca1747d6c98f3009ff919023efae9d68eca39
DIFF: https://github.com/llvm/llvm-project/commit/020ca1747d6c98f3009ff919023efae9d68eca39.diff
LOG: [mlir][linalg][bufferize] Move bufferizesToAliasOnly to extraClassDecls
By doing so, the method can no longer be reimplemented.
Differential Revision: https://reviews.llvm.org/D113248
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.td
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.td b/mlir/include/mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.td
index 55d76479f89a6..cff45a2fdbfa2 100644
--- a/mlir/include/mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.td
+++ b/mlir/include/mlir/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.td
@@ -60,32 +60,6 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
llvm_unreachable("bufferizesToMemoryWrite not implemented");
}]
>,
- InterfaceMethod<
- /*desc=*/[{
- Return `true` if the given OpOperand creates an alias but does neither
- read nor write. This implies that `bufferizesToMemoryRead` and
- `bufferizesToMemoryWrite` must return `false`. This method will never
- be called on OpOperands that do not have a tensor type.
-
- Examples of such ops are `tensor.extract_slice` and `tensor.cast`.
-
- Note: This method is not meant to be reimplemented.
- }],
- /*retType=*/"bool",
- /*methodName=*/"bufferizesToAliasOnly",
- /*args=*/(ins "OpOperand &":$opOperand),
- /*methodBody=*/"",
- // TODO: This should be in methodBody instead of defaultImplementation.
- // Due to a bug in TableGen codegen, this does not compile.
- /*defaultImplementation=*/[{
- auto bufferizableOp =
- cast<BufferizableOpInterface>($_op.getOperation());
- return !bufferizableOp.bufferizesToMemoryRead(opOperand)
- && !bufferizableOp.bufferizesToMemoryWrite(opOperand)
- && static_cast<bool>(
- bufferizableOp.getAliasingOpResult(opOperand));
- }]
- >,
InterfaceMethod<
/*desc=*/[{
Return the OpResult that aliases with a given OpOperand when
@@ -174,6 +148,23 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
}]
>
];
+
+ let extraClassDeclaration = [{
+ /// Return `true` if the given OpOperand creates an alias but does neither
+ /// read nor write. This implies that `bufferizesToMemoryRead` and
+ /// `bufferizesToMemoryWrite` must return `false`. This method will never
+ /// be called on OpOperands that do not have a tensor type.
+ ///
+ /// Examples of such ops are `tensor.extract_slice` and `tensor.cast`.
+ bool bufferizesToAliasOnly(OpOperand &opOperand) {
+ auto bufferizableOp =
+ cast<BufferizableOpInterface>(getOperation());
+ return !bufferizableOp.bufferizesToMemoryRead(opOperand)
+ && !bufferizableOp.bufferizesToMemoryWrite(opOperand)
+ && static_cast<bool>(
+ bufferizableOp.getAliasingOpResult(opOperand));
+ }
+ }];
}
#endif // BUFFERIZABLE_OP_INTERFACE
More information about the Mlir-commits
mailing list