[Mlir-commits] [mlir] 58678d3 - [mlir][tensor][bufferize] `tensor.empty` bufferizes to allocation (#68201)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Oct 5 05:06:05 PDT 2023
Author: Matthias Springer
Date: 2023-10-05T14:06:00+02:00
New Revision: 58678d3bcf32bada15d6286dff4abfdbf40bfc21
URL: https://github.com/llvm/llvm-project/commit/58678d3bcf32bada15d6286dff4abfdbf40bfc21
DIFF: https://github.com/llvm/llvm-project/commit/58678d3bcf32bada15d6286dff4abfdbf40bfc21.diff
LOG: [mlir][tensor][bufferize] `tensor.empty` bufferizes to allocation (#68201)
`BufferizableOpInterface::bufferizesToAllocation` is queried when
forming equivalence sets during bufferization. It is not really needed
for ops like `tensor.empty` which do not have tensor operands, but it
should be added for consistency.
This change should have been part of #68080. No test is added because
the return value of this function is irrelevant for ops without tensor
operands. (However, this function acts as a form documentation,
describing the bufferization semantics of the op.)
Added:
Modified:
mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
index 17e0cc08f8d208b..ac128d0a97bda4f 100644
--- a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -257,6 +257,8 @@ struct DimOpInterface
struct EmptyOpInterface
: public BufferizableOpInterface::ExternalModel<EmptyOpInterface,
tensor::EmptyOp> {
+ bool bufferizesToAllocation(Operation *op, Value value) const { return true; }
+
bool resultBufferizesToMemoryWrite(Operation *op, OpResult opResult,
const AnalysisState &state) const {
// The returned tensor does not have specified contents.
More information about the Mlir-commits
mailing list