Skip to content

Commit 353412e

Browse files
[mlir][bufferization][NFC] Rename resultBufferizesToMemoryWrite
1 parent 3751c83 commit 353412e

File tree

7 files changed

+18
-17
lines changed

7 files changed

+18
-17
lines changed

mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,10 +720,10 @@ defaultGetBufferType(Value value, const BufferizationOptions &options,
720720
SmallVector<Value> &invocationStack);
721721

722722
/// This is the default implementation of
723-
/// BufferizableOpInterface::resultBufferizesToMemoryWrite. Should not be called
723+
/// BufferizableOpInterface::bufferizesToMemoryWrite. Should not be called
724724
/// from other places.
725-
bool defaultResultBufferizesToMemoryWrite(OpResult opResult,
726-
const AnalysisState &state);
725+
bool defaultBufferizesToMemoryWrite(OpResult opResult,
726+
const AnalysisState &state);
727727

728728
/// This is the default implementation of
729729
/// BufferizableOpInterface::isRepetitiveRegion. Should not be called from other

mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
148148
InterfaceMethod<
149149
/*desc=*/[{
150150
Return `true` if the given OpResult bufferizes to a memory write.
151-
This is the same property as `bufferizesToMemoryWrite`, but from The
152-
perspective of OpResults.
151+
This is the same property as `bufferizesToMemoryWrite(OpOperand &)`,
152+
but from the perspective of OpResults.
153153

154154
This method will never be called on OpResults that do not have a
155155
tensor type.
@@ -165,7 +165,7 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
165165

166166
Counter-example: bufferization.alloc_tensor
167167
The op just allocates and does not specify the data of the tensor,
168-
so resultBufferizesToMemoryWrite is overridden to return false.
168+
so `bufferizesToMemoryWrite` is overridden to return false.
169169

170170
2. At least one aliasing OpOperand bufferizes to a memory write.
171171

@@ -192,14 +192,14 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
192192
write.
193193
}],
194194
/*retType=*/"bool",
195-
/*methodName=*/"resultBufferizesToMemoryWrite",
195+
/*methodName=*/"bufferizesToMemoryWrite",
196196
/*args=*/(ins "::mlir::OpResult":$opResult,
197197
"const ::mlir::bufferization::AnalysisState &":$state),
198198
/*methodBody=*/"",
199199
/*defaultImplementation=*/[{
200200
assert(opResult.getDefiningOp() == $_op.getOperation() &&
201201
"invalid OpResult");
202-
return ::mlir::bufferization::detail::defaultResultBufferizesToMemoryWrite(
202+
return ::mlir::bufferization::detail::defaultBufferizesToMemoryWrite(
203203
opResult, state);
204204
}]
205205
>,

mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def Bufferization_AllocTensorOp : Bufferization_Op<"alloc_tensor",
9696
const BufferizationOptions &options,
9797
BufferizationState &state);
9898

99-
bool resultBufferizesToMemoryWrite(OpResult opResult,
99+
bool bufferizesToMemoryWrite(OpResult opResult,
100100
const AnalysisState &state);
101101

102102
bool bufferizesToAllocation(Value value) { return true; }

mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ bool AnalysisState::bufferizesToMemoryWrite(Value value) const {
496496
auto bufferizableOp = getOptions().dynCastBufferizableOp(value);
497497
if (!bufferizableOp)
498498
return true;
499-
return bufferizableOp.resultBufferizesToMemoryWrite(opResult, *this);
499+
return bufferizableOp.bufferizesToMemoryWrite(opResult, *this);
500500
}
501501

502502
/// Return true if the given value is read by an op that bufferizes to a memory
@@ -882,7 +882,7 @@ bufferization::getMemRefTypeWithStaticIdentityLayout(TensorType tensorType,
882882
// Default implementations of interface methods
883883
//===----------------------------------------------------------------------===//
884884

885-
bool bufferization::detail::defaultResultBufferizesToMemoryWrite(
885+
bool bufferization::detail::defaultBufferizesToMemoryWrite(
886886
OpResult opResult, const AnalysisState &state) {
887887
auto bufferizableOp = cast<BufferizableOpInterface>(opResult.getDefiningOp());
888888
AliasingOpOperandList opOperands =

mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,9 @@ LogicalResult AllocTensorOp::bufferize(RewriterBase &rewriter,
195195
return success();
196196
}
197197

198-
bool AllocTensorOp::resultBufferizesToMemoryWrite(OpResult opResult,
199-
const AnalysisState &state) {
198+
bool AllocTensorOp::bufferizesToMemoryWrite(OpResult opResult,
199+
const AnalysisState &state) {
200+
200201
// AllocTensorOps do not write unless they have a `copy` value.
201202
return static_cast<bool>(getCopy());
202203
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ struct LoadOpInterface
112112
struct NewOpInterface
113113
: public SparseBufferizableOpInterfaceExternalModel<NewOpInterface,
114114
sparse_tensor::NewOp> {
115-
bool resultBufferizesToMemoryWrite(Operation *op, OpResult opResult,
116-
const AnalysisState &state) const {
115+
bool bufferizesToMemoryWrite(Operation *op, OpResult opResult,
116+
const AnalysisState &state) const {
117117
// NewOps allocate but do not write.
118118
return false;
119119
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ struct EmptyOpInterface
272272
tensor::EmptyOp> {
273273
bool bufferizesToAllocation(Operation *op, Value value) const { return true; }
274274

275-
bool resultBufferizesToMemoryWrite(Operation *op, OpResult opResult,
276-
const AnalysisState &state) const {
275+
bool bufferizesToMemoryWrite(Operation *op, OpResult opResult,
276+
const AnalysisState &state) const {
277277
// The returned tensor does not have specified contents.
278278
return false;
279279
}

0 commit comments

Comments
 (0)