From 584f401730da87cf54b536320439d0875ddb3d63 Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Mon, 5 Jun 2023 10:19:55 +0200 Subject: [PATCH] [mlir][linalg][transform] Register linalg dialect patterns Differential Revision: https://reviews.llvm.org/D152124 --- .../Dialect/Linalg/TransformOps/DialectExtension.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mlir/lib/Dialect/Linalg/TransformOps/DialectExtension.cpp b/mlir/lib/Dialect/Linalg/TransformOps/DialectExtension.cpp index 9578648..ab28ad3 100644 --- a/mlir/lib/Dialect/Linalg/TransformOps/DialectExtension.cpp +++ b/mlir/lib/Dialect/Linalg/TransformOps/DialectExtension.cpp @@ -13,9 +13,11 @@ #include "mlir/Dialect/Linalg/IR/Linalg.h" #include "mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.h" #include "mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.h" +#include "mlir/Dialect/Linalg/Transforms/Transforms.h" #include "mlir/Dialect/SCF/IR/SCF.h" #include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/Dialect/Transform/IR/TransformDialect.h" +#include "mlir/Dialect/Transform/IR/TransformOps.h" #include "mlir/Dialect/Vector/IR/VectorOps.h" using namespace mlir; @@ -47,6 +49,22 @@ public: #define GET_OP_LIST #include "mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.cpp.inc" >(); + + addDialectDataInitializer( + [&](transform::PatternRegistry ®istry) { + registry.registerPatterns( + "linalg.erase_unnecessary_inputs", + linalg::populateEraseUnnecessaryInputsPatterns); + registry.registerPatterns( + "linalg.fold_unit_extent_dims_via_slices", + linalg::populateFoldUnitExtentDimsViaSlicesPatterns); + registry.registerPatterns( + "linalg.fold_unit_extent_dims_via_reshapes", + linalg::populateFoldUnitExtentDimsViaReshapesPatterns); + registry.registerPatterns( + "linalg.tiling_canonicalization", + linalg::populateLinalgTilingCanonicalizationPatterns); + }); } }; } // namespace -- 2.7.4