[Mlir-commits] [mlir] d95114c - [mlir][tensor][transform] Register tensor dialect patterns

Matthias Springer llvmlistbot at llvm.org
Fri Jun 2 06:37:44 PDT 2023


Author: Matthias Springer
Date: 2023-06-02T15:31:13+02:00
New Revision: d95114c66981d33a6bbb90cc346e0809979950b4

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

LOG: [mlir][tensor][transform] Register tensor dialect patterns

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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Tensor/Transforms/Transforms.h
    mlir/lib/Dialect/Tensor/TransformOps/TensorTransformOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Tensor/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Tensor/Transforms/Transforms.h
index fe8f6cc9ff286..a87ee1b3e8053 100644
--- a/mlir/include/mlir/Dialect/Tensor/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Tensor/Transforms/Transforms.h
@@ -34,9 +34,6 @@ FailureOr<TilingResult> replaceExtractSliceWithTiledProducer(
 // Populate functions.
 //===----------------------------------------------------------------------===//
 
-/// Collects a set of patterns to rewrite ops within the tensor dialect.
-void populateExpandOpsPatterns(RewritePatternSet &patterns);
-
 /// Appends patterns for folding tensor aliasing ops into consumer load/store
 /// ops into `patterns`.
 void populateFoldTensorSubsetOpPatterns(RewritePatternSet &patterns);

diff  --git a/mlir/lib/Dialect/Tensor/TransformOps/TensorTransformOps.cpp b/mlir/lib/Dialect/Tensor/TransformOps/TensorTransformOps.cpp
index 6f948fdd5d569..1ab7883b9be5f 100644
--- a/mlir/lib/Dialect/Tensor/TransformOps/TensorTransformOps.cpp
+++ b/mlir/lib/Dialect/Tensor/TransformOps/TensorTransformOps.cpp
@@ -144,6 +144,26 @@ class TensorTransformDialectExtension
 #define GET_OP_LIST
 #include "mlir/Dialect/Tensor/TransformOps/TensorTransformOps.cpp.inc"
         >();
+
+    addDialectDataInitializer<transform::PatternRegistry>(
+        [&](transform::PatternRegistry &registry) {
+          registry.registerPatterns("tensor.fold_tensor_subset_ops",
+                                    tensor::populateFoldTensorSubsetOpPatterns);
+          registry.registerPatterns(
+              "tensor.merge_consecutive_insert_extract_slice",
+              tensor::populateMergeConsecutiveInsertExtractSlicePatterns);
+          registry.registerPatterns(
+              "tensor.drop_redundant_insert_slice_rank_expansion",
+              tensor::populateDropRedundantInsertSliceRankExpansionPatterns);
+          registry.registerPatterns(
+              "tensor.reassociative_reshape_folding",
+              tensor::populateReassociativeReshapeFoldingPatterns);
+          registry.registerPatterns("tensor.fold_tensor_empty",
+                                    tensor::populateFoldTensorEmptyPatterns);
+          registry.registerPatterns(
+              "tensor.fold_into_pack_and_unpack",
+              tensor::populateFoldIntoPackAndUnpackPatterns);
+        });
   }
 };
 } // namespace


        


More information about the Mlir-commits mailing list