Skip to content

Commit d561c4a

Browse files
[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 llvm#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.)
1 parent 3661a48 commit d561c4a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ struct DimOpInterface
260260
struct EmptyOpInterface
261261
: public BufferizableOpInterface::ExternalModel<EmptyOpInterface,
262262
tensor::EmptyOp> {
263+
bool bufferizesToAllocation(Operation *op, Value value) const { return true; }
264+
263265
bool resultBufferizesToMemoryWrite(Operation *op, OpResult opResult,
264266
const AnalysisState &state) const {
265267
// The returned tensor does not have specified contents.

0 commit comments

Comments
 (0)