Skip to content

Commit 58678d3

Browse files
[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.)
1 parent 5958043 commit 58678d3

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
@@ -257,6 +257,8 @@ struct DimOpInterface
257257
struct EmptyOpInterface
258258
: public BufferizableOpInterface::ExternalModel<EmptyOpInterface,
259259
tensor::EmptyOp> {
260+
bool bufferizesToAllocation(Operation *op, Value value) const { return true; }
261+
260262
bool resultBufferizesToMemoryWrite(Operation *op, OpResult opResult,
261263
const AnalysisState &state) const {
262264
// The returned tensor does not have specified contents.

0 commit comments

Comments
 (0)