Skip to content

Commit

Permalink
[mlir][tensor][bufferize] tensor.empty bufferizes to allocation (#6…
Browse files Browse the repository at this point in the history
…8201)

`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.)
  • Loading branch information
matthias-springer authored Oct 5, 2023
1 parent 5958043 commit 58678d3
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 58678d3

Please sign in to comment.