From d561c4a2e77c5e4fb9f0972b5ec1ac06a667c56f Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Wed, 4 Oct 2023 12:42:19 +0200 Subject: [PATCH] [mlir][tensor][bufferize] `tensor.empty` bufferizes to allocation `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.) --- .../Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp index b08283f007078..997e442bc9ae2 100644 --- a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp @@ -260,6 +260,8 @@ struct DimOpInterface struct EmptyOpInterface : public BufferizableOpInterface::ExternalModel { + 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.