[Mlir-commits] [mlir] 335fa18 - [mlir] NFC: Expose tiled_loop->scf pattern.

Alexander Belyaev llvmlistbot at llvm.org
Fri May 21 09:19:08 PDT 2021


Author: Alexander Belyaev
Date: 2021-05-21T18:19:00+02:00
New Revision: 335fa1802854d651b89e4e79916a10ca87795ff2

URL: https://github.com/llvm/llvm-project/commit/335fa1802854d651b89e4e79916a10ca87795ff2
DIFF: https://github.com/llvm/llvm-project/commit/335fa1802854d651b89e4e79916a10ca87795ff2.diff

LOG: [mlir] NFC: Expose tiled_loop->scf pattern.

Differential Revision: https://reviews.llvm.org/D102921

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
    mlir/lib/Dialect/Linalg/Transforms/Loops.cpp

Removed: 
    


################################################################################
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<TiledLoopToSCFPattern>(context);
+    populateTiledLoopToSCFPattern(patterns);
     (void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
   }
 };
 } // namespace
 
+void mlir::linalg::populateTiledLoopToSCFPattern(RewritePatternSet &patterns) {
+  patterns.add<TiledLoopToSCFPattern>(patterns.getContext());
+}
+
 std::unique_ptr<OperationPass<FuncOp>>
 mlir::createConvertLinalgTiledLoopsToSCFPass() {
   return std::make_unique<LowerTiledLoopsToSCF>();


        


More information about the Mlir-commits mailing list