diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h index 4442e9067ca4..aa4b8d86da20 100644 --- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h +++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h @@ -81,6 +81,9 @@ void populateFoldUnitExtentDimsPatterns(RewritePatternSet &patterns); /// Patterns that are used to inline constant operands into linalg generic ops. void populateInlineConstantOperandsPatterns(RewritePatternSet &patterns); +/// Pattern to convert TiledLoopOp to SCF loops. +void populateTiledLoopToSCFPattern(RewritePatternSet &patterns); + /// Options that control fusion of elementwise operations. struct LinalgElementwiseFusionOptions { /// Enable fusion of reshapes into the shape with elementwise operations. By diff --git a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp index 1301be14e1fc..5d8ddb5bb421 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp @@ -597,12 +597,16 @@ struct LowerTiledLoopsToSCF void runOnFunction() override { MLIRContext *context = &getContext(); RewritePatternSet patterns(context); - patterns.add(context); + populateTiledLoopToSCFPattern(patterns); (void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns)); } }; } // namespace +void mlir::linalg::populateTiledLoopToSCFPattern(RewritePatternSet &patterns) { + patterns.add(patterns.getContext()); +} + std::unique_ptr> mlir::createConvertLinalgTiledLoopsToSCFPass() { return std::make_unique();