[Mlir-commits] [mlir] 330372f - [mlir][tensor][bufferize] tensor.empty does not define the result tensor contents
Matthias Springer
llvmlistbot at llvm.org
Mon Feb 6 01:26:46 PST 2023
Author: Matthias Springer
Date: 2023-02-06T10:26:38+01:00
New Revision: 330372f2c58de12d711062f298c6472fc6a51fc5
URL: https://github.com/llvm/llvm-project/commit/330372f2c58de12d711062f298c6472fc6a51fc5
DIFF: https://github.com/llvm/llvm-project/commit/330372f2c58de12d711062f298c6472fc6a51fc5.diff
LOG: [mlir][tensor][bufferize] tensor.empty does not define the result tensor contents
This is encoded in the `BufferizableOpInterface` via `resultBufferizesToMemoryWrite = false`.
Differential Revision: https://reviews.llvm.org/D143181
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 14401a98c8e2b..3287dcfdfc634 100644
--- a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -264,6 +264,12 @@ struct DimOpInterface
struct EmptyOpInterface
: public BufferizableOpInterface::ExternalModel<EmptyOpInterface,
tensor::EmptyOp> {
+ bool resultBufferizesToMemoryWrite(Operation *op, OpResult opResult,
+ const AnalysisState &state) const {
+ // The returned tensor does not have specified contents.
+ return false;
+ }
+
LogicalResult bufferize(Operation *op, RewriterBase &rewriter,
const BufferizationOptions &options) const {
// tensor.empty ops are used to indicate the shape of a tensor. They have
More information about the Mlir-commits
mailing list