[Mlir-commits] [mlir] 1d153ea - [mlir][vector][transform] Add ApplyCastAwayVectorLeadingOneDimPatternsOp

Matthias Springer llvmlistbot at llvm.org
Wed Jun 7 01:32:50 PDT 2023


Author: Matthias Springer
Date: 2023-06-07T10:32:37+02:00
New Revision: 1d153ea9aa0dbb9cc48f7fa882cdd3c65985cc52

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

LOG: [mlir][vector][transform] Add ApplyCastAwayVectorLeadingOneDimPatternsOp

Expose the respective patterns as a transform op.

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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
    mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td b/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
index c1891ff4463c9..d9d69c53be0f5 100644
--- a/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
+++ b/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
@@ -15,6 +15,21 @@ include "mlir/Dialect/Vector/Transforms/VectorTransformsBase.td"
 include "mlir/Interfaces/SideEffectInterfaces.td"
 include "mlir/IR/OpBase.td"
 
+def ApplyCastAwayVectorLeadingOneDimPatternsOp : Op<Transform_Dialect,
+    "apply_patterns.vector.cast_away_vector_leading_one_dim",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
+  let description = [{
+    Collect a set of leading one dimension removal patterns.
+
+    These patterns insert vector.shape_cast to remove leading one dimensions
+    to expose more canonical forms of read/write/insert/extract operations.
+    With them, there are more chances that we can cancel out extract-insert
+    pairs or forward write-read pairs.
+  }];
+
+  let assemblyFormat = "attr-dict";
+}
+
 def ApplyRankReducingSubviewPatternsOp : Op<Transform_Dialect,
     "apply_patterns.vector.apply_rank_reducing_subview_patterns",
     [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {

diff  --git a/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp b/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp
index 7e097942c8189..da99232ed6ab8 100644
--- a/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp
+++ b/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp
@@ -27,6 +27,11 @@ using namespace mlir::transform;
 // Apply...PatternsOp
 //===----------------------------------------------------------------------===//
 
+void transform::ApplyCastAwayVectorLeadingOneDimPatternsOp::populatePatterns(
+    RewritePatternSet &patterns) {
+  vector::populateCastAwayVectorLeadingOneDimPatterns(patterns);
+}
+
 void transform::ApplyRankReducingSubviewPatternsOp::populatePatterns(
     RewritePatternSet &patterns) {
   vector::populateVectorTransferDropUnitDimsPatterns(patterns);


        


More information about the Mlir-commits mailing list