[Mlir-commits] [mlir] 9e42f2a - [mlir][linalg][bufferize][NFC] Add inPlaceAnalysis overload
Matthias Springer
llvmlistbot at llvm.org
Fri Dec 3 17:42:13 PST 2021
Author: Matthias Springer
Date: 2021-12-04T10:41:57+09:00
New Revision: 9e42f2aa0b832c22377c993d64eb42aec65aa931
URL: https://github.com/llvm/llvm-project/commit/9e42f2aa0b832c22377c993d64eb42aec65aa931
DIFF: https://github.com/llvm/llvm-project/commit/9e42f2aa0b832c22377c993d64eb42aec65aa931.diff
LOG: [mlir][linalg][bufferize][NFC] Add inPlaceAnalysis overload
Differential Revision: https://reviews.llvm.org/D114773
Added:
Modified:
mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.cpp b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.cpp
index b887af08fa7d..6407febd8b6f 100644
--- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.cpp
+++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.cpp
@@ -622,6 +622,24 @@ static LogicalResult inPlaceAnalysis(SmallVector<Operation *> &ops,
return success();
}
+/// Analyze all ops that are contained in `op`.
+static LogicalResult inPlaceAnalysis(Operation *op,
+ BufferizationAliasInfo &aliasInfo,
+ const DominanceInfo &domInfo,
+ unsigned analysisFuzzerSeed = 0) {
+ // Collect ops so we can build our own reverse traversal.
+ SmallVector<Operation *> ops;
+ op->walk([&](Operation *op) {
+ // No tensors => no buffers.
+ if (none_of(op->getOperandTypes(), isaTensor) &&
+ none_of(op->getResultTypes(), isaTensor))
+ return;
+ ops.push_back(op);
+ });
+
+ return inPlaceAnalysis(ops, aliasInfo, domInfo, analysisFuzzerSeed);
+}
+
/// Assert that the current bufferization decisions are consistent.
static LogicalResult
checkAliasInfoConsistency(FuncOp funcOp, const DominanceInfo &domInfo,
@@ -685,19 +703,10 @@ LogicalResult mlir::linalg::comprehensive_bufferize::runComprehensiveBufferize(
if (failed(checkAliasInfoConsistency(funcOp, domInfo, aliasInfo)))
return failure();
- // Collect ops so we can build our own reverse traversal.
- SmallVector<Operation *> ops;
- funcOp.walk([&](Operation *op) {
- // No tensors => no buffers.
- if (none_of(op->getOperandTypes(), isaTensor) &&
- none_of(op->getResultTypes(), isaTensor))
- return;
- ops.push_back(op);
- });
-
// If the analysis fails, just return.
+ Operation *op = funcOp.getOperation();
if (failed(
- inPlaceAnalysis(ops, aliasInfo, domInfo, options.analysisFuzzerSeed)))
+ inPlaceAnalysis(op, aliasInfo, domInfo, options.analysisFuzzerSeed)))
return failure();
for (const std::unique_ptr<PostAnalysisStep> &step :
More information about the Mlir-commits
mailing list