[Mlir-commits] [mlir] 69bcff4 - [mlir][linalg] Pad independent of application order (NFC).
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Dec 5 23:36:35 PST 2021
Author: gysit
Date: 2021-12-06T07:26:15Z
New Revision: 69bcff46bff34838c91880ecaa6616bb6979cd23
URL: https://github.com/llvm/llvm-project/commit/69bcff46bff34838c91880ecaa6616bb6979cd23
DIFF: https://github.com/llvm/llvm-project/commit/69bcff46bff34838c91880ecaa6616bb6979cd23.diff
LOG: [mlir][linalg] Pad independent of application order (NFC).
This revision makes the padding pattern independent of the application order. It addresses the concern that we cannot rely on the execution order of the greedy rewriter (https://reviews.llvm.org/D114689). Instead, the pattern is updated to apply repeatedly till all operations are padded.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D114851
Added:
Modified:
mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp
mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp b/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp
index c006a1e778012..0da17434c4298 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp
@@ -132,19 +132,7 @@ struct LinalgStrategyPadPass
paddingPattern.add<LinalgPaddingPattern>(funcOp.getContext(), options,
filter);
}
- // Traverse the operations top down to pad producers before consumers. The
- // extract slice operation introduced after every padded operation enables
- // padding its consumers. Padding an operation whose producers have not been
- // padded before fails due to the missing extract slice operations. In this
- // case, the padding pattern increments the transformation marker without
- // padding the operation. The top down traversal is thus not only a
- // performance optimization but also needed to pad all operations along the
- // use-def chains.
- GreedyRewriteConfig config;
- config.useTopDownTraversal = true;
- if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(paddingPattern),
- config)))
- signalPassFailure();
+ (void)applyPatternsAndFoldGreedily(funcOp, std::move(paddingPattern));
}
LinalgPaddingOptions options;
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
index 917ff770a3b5a..e2d16cf285d39 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
@@ -503,10 +503,8 @@ LogicalResult mlir::linalg::LinalgPaddingPattern::matchAndRewrite(
FailureOr<SmallVector<Value>> newResults = rewriteAsPaddedOp(
rewriter, linalgOp, options.paddingValueComputationFunction,
options.paddingNoFoldComputationFunction, paddedOp);
- if (failed(newResults)) {
- filter.replaceLinalgTransformationFilter(rewriter, linalgOp);
+ if (failed(newResults))
return failure();
- }
// Compute the desired hoisting depths.
SmallVector<int64_t> depths;
More information about the Mlir-commits
mailing list