[Mlir-commits] [mlir] 976d25e - [mlir][vector] Use transform.apply_patterns in vector tests

Matthias Springer llvmlistbot at llvm.org
Tue Jun 6 00:27:15 PDT 2023


Author: Matthias Springer
Date: 2023-06-06T09:27:05+02:00
New Revision: 976d25ed9e575b7326a406c525bb1957f801d393

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

LOG: [mlir][vector] Use transform.apply_patterns in vector tests

All vector transform ops are now `PatternDescriptorOpInterface` ops that merely select the patterns. The patterns are applied by the `apply_patterns` op. This is to ensure that ops are properly tracked. (TrackingListener is used in the implementation of `apply_patterns`.) Furthermore, handles are no longer invalidated when applying patterns in the vector tests.

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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h
    mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.td
    mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
    mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
    mlir/lib/Dialect/Transform/IR/TransformOps.cpp
    mlir/test/Dialect/LLVM/transform-e2e.mlir
    mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir
    mlir/test/Dialect/Vector/transform-vector.mlir
    mlir/test/Dialect/Vector/vector-broadcast-lowering-transforms.mlir
    mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir
    mlir/test/Dialect/Vector/vector-contract-to-dot-transforms.mlir
    mlir/test/Dialect/Vector/vector-contract-to-matrix-intrinsics-transforms.mlir
    mlir/test/Dialect/Vector/vector-contract-to-outerproduct-transforms.mlir
    mlir/test/Dialect/Vector/vector-contract-to-parallel-arith-transforms.mlir
    mlir/test/Dialect/Vector/vector-mask-lowering-transforms.mlir
    mlir/test/Dialect/Vector/vector-multi-reduction-lowering.mlir
    mlir/test/Dialect/Vector/vector-multi-reduction-outer-lowering.mlir
    mlir/test/Dialect/Vector/vector-outerproduct-lowering-transforms.mlir
    mlir/test/Dialect/Vector/vector-shape-cast-lowering-transforms.mlir
    mlir/test/Dialect/Vector/vector-transfer-drop-unit-dims-patterns.mlir
    mlir/test/Dialect/Vector/vector-transfer-full-partial-split-copy-transform.mlir
    mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir
    mlir/test/Dialect/Vector/vector-transfer-to-vector-load-store.mlir
    mlir/test/Dialect/Vector/vector-transpose-lowering.mlir
    mlir/test/Integration/Dialect/Vector/CPU/test-shuffle16x16.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h b/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h
index fc1ffebf4a321..a283f974a68f9 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h
@@ -938,30 +938,6 @@ class TransformEachOpTrait
   static LogicalResult verifyTrait(Operation *op);
 };
 
-/// Trait implementing the applyToOne function required by TransformEachOpTrait
-/// by greedily applying a set of patterns to each target payload operation.
-/// This requires the transform operation to implement TransformEachOpTrait and
-/// to provide the following method:
-///   - void populatePatterns(RewritePatternSet &)
-/// that populates the given object with the patterns to apply. This is an
-/// instance method that can depend on the transform operation attributes.
-///
-/// The payload operation is expected to have the IsolatedFromAboveTrait, which
-/// is a requirement of the pattern rewriter. If it does not, or if pattern
-/// application fails, the transform fails definitively as the rewriter will
-/// have likely left the payload IR in some intermediate state that precludes
-/// further transformation.
-template <typename OpTy>
-class TransformWithPatternsOpTrait
-    : public OpTrait::TraitBase<OpTy, TransformWithPatternsOpTrait> {
-public:
-  DiagnosedSilenceableFailure applyToOne(Operation *target,
-                                         ApplyToEachResultList &results,
-                                         TransformState &state);
-
-  static LogicalResult verifyTrait(Operation *op);
-};
-
 /// Side effect resource corresponding to the mapping between Transform IR
 /// values and Payload IR operations. An Allocate effect from this resource
 /// means creating a new mapping entry, it is always accompanied by a Write
@@ -1253,14 +1229,6 @@ applyTransformToEach(TransformOpTy transformOp, Range &&targets,
   return DiagnosedSilenceableFailure::success();
 }
 
-/// Applies patterns configured by `populatePatterns` greedily to the contents
-/// of `target`. Reports (definite) errors at the location of `transformOp`.
-/// Sets up `results` to point to `target` after pattern application on success.
-DiagnosedSilenceableFailure transformWithPatternsApply(
-    Operation *transformOp, Operation *target, ApplyToEachResultList &results,
-    TransformState &state,
-    function_ref<void(RewritePatternSet &)> populatePatterns);
-
 } // namespace detail
 } // namespace transform
 } // namespace mlir
@@ -1322,26 +1290,4 @@ mlir::transform::TransformEachOpTrait<OpTy>::verifyTrait(Operation *op) {
   return success();
 }
 
-template <typename OpTy>
-mlir::DiagnosedSilenceableFailure
-mlir::transform::TransformWithPatternsOpTrait<OpTy>::applyToOne(
-    Operation *target, ApplyToEachResultList &results, TransformState &state) {
-  return detail::transformWithPatternsApply(
-      this->getOperation(), target, results, state,
-      [this](RewritePatternSet &patterns) {
-        cast<OpTy>(this->getOperation()).populatePatterns(patterns);
-      });
-}
-
-template <typename OpTy>
-mlir::LogicalResult
-mlir::transform::TransformWithPatternsOpTrait<OpTy>::verifyTrait(
-    Operation *op) {
-  if (!op->hasTrait<mlir::transform::TransformEachOpTrait>()) {
-    return op->emitOpError()
-           << "TransformWithPatternsOpTrait requires TransformEachOpTrait";
-  }
-  return success();
-}
-
 #endif // DIALECT_TRANSFORM_IR_TRANSFORMINTERFACES_H

diff  --git a/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.td b/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.td
index 0a9a6c18ad883..c3184c1e35bb8 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.td
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.td
@@ -181,10 +181,6 @@ def TransformEachOpTrait : NativeOpTrait<"TransformEachOpTrait"> {
   let cppNamespace = "::mlir::transform";
 }
 
-def TransformWithPatternsOpTrait : NativeOpTrait<"TransformWithPatternsOpTrait"> {
-  let cppNamespace = "::mlir::transform";
-}
-
 def NavigationTransformOpTrait : NativeOpTrait<"NavigationTransformOpTrait"> {
   let cppNamespace = "::mlir::transform";
 }

diff  --git a/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td b/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
index 45a9a42e31322..87fcbb0127e7f 100644
--- a/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
+++ b/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
@@ -15,339 +15,257 @@ include "mlir/Dialect/Vector/Transforms/VectorTransformsBase.td"
 include "mlir/Interfaces/SideEffectInterfaces.td"
 include "mlir/IR/OpBase.td"
 
-// TODO: not isolated from above and better targetability of the op.
-// TODO: not a functional-style transform.
-class TransformWithPatternsOp<string opname, list<Trait> traits = []>
-    : Op<Transform_Dialect, opname,
-         !listconcat([TransformOpInterface,
-                      TransformEachOpTrait,
-                      TransformWithPatternsOpTrait,
-                      MemoryEffectsOpInterface,
-                      FunctionalStyleTransformOpTrait], traits)> {
-  let extraClassDeclaration = [{
-    void populatePatterns(RewritePatternSet &patterns);
-  }];
-}
-
-def ApplyRankReducingSubviewPatternsOp : 
-  TransformWithPatternsOp<"vector.apply_rank_reducing_subview_patterns"> {
+def ApplyRankReducingSubviewPatternsOp : Op<Transform_Dialect,
+    "apply_patterns.vector.apply_rank_reducing_subview_patterns",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
     Apply opt-in vector transfer permutation patterns that include:
       - TransferReadDropUnitDimsPattern
       - TransferWriteDropUnitDimsPattern
-    
-    These patterns have the effect of rewriting a vector.transfer with unit 
+
+    These patterns have the effect of rewriting a vector.transfer with unit
     dimensions into a rank-reduced version thanks to subview operations.
     This is complemented by shape_cast folding patterns.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target);
-  let results = (outs TransformHandleTypeInterface:$results);
-
-  let assemblyFormat = [{
-    $target
-    attr-dict
-    `:` functional-type($target, results)
-  }];
+  let assemblyFormat = "attr-dict";
 }
 
-def ApplyTransferPermutationPatternsOp : 
-  TransformWithPatternsOp<"vector.apply_transfer_permutation_patterns"> {
+def ApplyTransferPermutationPatternsOp : Op<Transform_Dialect,
+    "apply_patterns.vector.apply_transfer_permutation_patterns",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
     Apply opt-in vector transfer permutation patterns that include:
       - TransferReadPermutationLowering
       - TransferWritePermutationLowering
       - TransferOpReduceRank
       - TransferWriteNonPermutationLowering
-    
-    These patterns have the effect of rewriting a vector.transfer with an 
-    arbitrary permutation_map to a vector.transfer with a permutation_map that is
-    a minor identity followed by a vector.transpose.
+
+    These patterns have the effect of rewriting a vector.transfer with an
+    arbitrary permutation_map to a vector.transfer with a permutation_map that
+    is a minor identity followed by a vector.transpose.
 
     In other words, this makes the vector.transfer contiguous on the most minor
     dimensions and materializes the permutation_map as a vector.transpose.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target);
-  let results = (outs TransformHandleTypeInterface:$results);
-
-  let assemblyFormat = [{
-    $target
-    attr-dict
-    `:` functional-type($target, results)
-  }];
+  let assemblyFormat = "attr-dict";
 }
 
-def LowerBroadcastOp : TransformWithPatternsOp<"vector.lower_broadcast"> {
+def LowerBroadcastOp : Op<Transform_Dialect,
+    "apply_patterns.vector.lower_broadcast",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that the vector outerproduct operations nested under the isolated
-    from above op `target` should be lowered to finer-grained vector primitives.
+    Indicates that vector broadcast operations should be lowered to
+    finer-grained vector primitives.
 
     This is usally a late step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target);
-  let results = (outs TransformHandleTypeInterface:$results);
-
-  let assemblyFormat = [{
-    $target
-    attr-dict
-    `:` functional-type($target, results)
-  }];
+  let assemblyFormat = "attr-dict";
 }
 
 // TODO: evolve lowering_strategy to proper enums.
-def LowerContractionOp : TransformWithPatternsOp<"vector.lower_contraction"> {
+def LowerContractionOp : Op<Transform_Dialect,
+    "apply_patterns.vector.lower_contraction",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that the vector contraction-like operations nested under the 
-    isolated from above op `target` should be lowered to finer-grained vector
-    primitives.
+    Indicates that vector contraction-like operations should be lowered to
+    finer-grained vector primitives.
 
     This is usually a late step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target,
-     DefaultValuedAttr<VectorContractLoweringAttr,
-       "vector::VectorContractLowering::OuterProduct">:$lowering_strategy
+  let arguments = (ins DefaultValuedAttr<VectorContractLoweringAttr,
+      "vector::VectorContractLowering::OuterProduct">:$lowering_strategy
   );
-  let results = (outs TransformHandleTypeInterface:$results);
-
   let assemblyFormat = [{
-    $target
-    (`lowering_strategy` `=` $lowering_strategy^)?
-    attr-dict
-    `:` functional-type($target, results)
+    (`lowering_strategy` `=` $lowering_strategy^)? attr-dict
   }];
 }
 
-def LowerMasksOp : TransformWithPatternsOp<"vector.lower_masks"> {
+def LowerMasksOp : Op<Transform_Dialect,
+    "apply_patterns.vector.lower_masks",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that the vector.create_mask and vector.constant_mask operations
-    nested under the isolated from above op `target` should be lowered to
-    finer-grained vector primitives.
+    Indicates that vector.create_mask and vector.constant_mask operations
+    should be lowered to finer-grained vector primitives.
 
     This is usually a late step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target);
-  let results = (outs TransformHandleTypeInterface:$results);
-
-  let assemblyFormat = [{
-    $target
-    attr-dict
-    `:` functional-type($target, results)
-  }];
+  let assemblyFormat = "attr-dict";
 }
 
-def LowerMaskedTransfersOp : TransformWithPatternsOp<"vector.lower_masked_transfers"> {
+def LowerMaskedTransfersOp : Op<Transform_Dialect,
+    "apply_patterns.vector.lower_masked_transfers",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that masked vector.transfer and vector.gather operations nested
-    under the isolated from above op `target` should be lowered to finer-grained
-    vector primitives.
+    Indicates that masked vector.transfer and vector.gather operations should
+    be lowered to finer-grained vector primitives.
 
     This is usually a late step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target);
-  let results = (outs TransformHandleTypeInterface:$results);
-
-  let assemblyFormat = [{
-    $target
-    attr-dict
-    `:` functional-type($target, results)
-  }];
+  let assemblyFormat = "attr-dict";
 }
 
-def MaterializeMasksOp : TransformWithPatternsOp<"vector.materialize_masks"> {
+def MaterializeMasksOp : Op<Transform_Dialect,
+    "apply_patterns.vector.materialize_masks",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that mask operations nested under the isolated from above op 
-    `target` should be lowered to fine-grained arithemtic operations.
+    Indicates that mask operations should be lowered to fine-grained arithemtic
+    operations.
 
     This is usually the last step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target);
-  let results = (outs TransformHandleTypeInterface:$results);
-
-  let assemblyFormat = [{
-    $target
-    attr-dict
-    `:` functional-type($target, results)
-  }];
+  let assemblyFormat = "attr-dict";
 }
 
 // TODO: evolve lowering_strategy to proper enums.
-def LowerMultiReductionOp
-    : TransformWithPatternsOp<"vector.lower_multi_reduction"> {
+def LowerMultiReductionOp : Op<Transform_Dialect,
+    "apply_patterns.vector.lower_multi_reduction",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that the vector multi_reduction-like operations nested under the 
-    isolated from above op `target` should be lowered to finer-grained vector
-    primitives.
+    Indicates that vector multi_reduction-like operations should be lowered to
+    finer-grained vector primitives.
 
     This is usually a late step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target,
-     DefaultValuedAttr<VectorMultiReductionLoweringAttr,
-       "vector::VectorMultiReductionLowering::InnerParallel">:
-         $lowering_strategy
+  let arguments = (ins DefaultValuedAttr<VectorMultiReductionLoweringAttr,
+      "vector::VectorMultiReductionLowering::InnerParallel">:$lowering_strategy
   );
-  let results = (outs TransformHandleTypeInterface:$results);
 
   let assemblyFormat = [{
-    $target
-    (`lowering_strategy` `=` $lowering_strategy^)?
-    attr-dict
-    `:` functional-type($target, results)
+    (`lowering_strategy` `=` $lowering_strategy^)? attr-dict
   }];
 }
 
-def LowerOuterProductOp : TransformWithPatternsOp<"vector.lower_outerproduct"> {
+def LowerOuterProductOp : Op<Transform_Dialect,
+    "apply_patterns.vector.lower_outerproduct",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that the vector outerproduct operations nested under the isolated
-    from above op `target` should be lowered to finer-grained vector primitives.
+    Indicates that the vector outerproduct operations should be lowered to
+    finer-grained vector primitives.
 
     This is usually a late step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target);
-  let results = (outs TransformHandleTypeInterface:$results);
-
-  let assemblyFormat = [{
-    $target
-    attr-dict
-    `:` functional-type($target, results)
-  }];
+  let assemblyFormat = "attr-dict";
 }
 
-def LowerShapeCastOp : TransformWithPatternsOp<"vector.lower_shape_cast"> {
+def LowerShapeCastOp : Op<Transform_Dialect,
+    "apply_patterns.vector.lower_shape_cast",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that the vector shape_cast operations nested under the 
-    isolated from above op `target` should be lowered to finer-grained vector
-    primitives.
+    Indicates that vector shape_cast operations should be lowered to
+    finer-grained vector primitives.
 
     This is usually a late step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target);
-  let results = (outs TransformHandleTypeInterface:$results);
-
-  let assemblyFormat = [{
-    $target
-    attr-dict
-    `:` functional-type($target, results)
-  }];
+  let assemblyFormat = "attr-dict";
 }
 
-def LowerTransferOp : TransformWithPatternsOp<"vector.lower_transfer"> {
+def LowerTransferOp : Op<Transform_Dialect,
+    "apply_patterns.vector.lower_transfer",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that the vector transfer operations nested under the 
-    isolated from above op `target` should be lowered to finer-grained vector
-    primitives.
+    Indicates that vector transfer operations should be lowered to finer-grained
+    vector primitives.
 
     This is usually a late step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target,
-     DefaultValuedAttr<I64Attr, "1">:$max_transfer_rank
-  );
-  let results = (outs TransformHandleTypeInterface:$results);
+  let arguments = (ins DefaultValuedAttr<I64Attr, "1">:$max_transfer_rank);
 
   let assemblyFormat = [{
-    $target
-    (`max_transfer_rank` `=` $max_transfer_rank^)?
-    attr-dict
-    `:` functional-type($target, results)
+    (`max_transfer_rank` `=` $max_transfer_rank^)? attr-dict
   }];
 }
 
 // TODO: evolve lowering_strategy to proper enums.
-def LowerTransposeOp : TransformWithPatternsOp<"vector.lower_transpose"> {
+def LowerTransposeOp : Op<Transform_Dialect,
+    "apply_patterns.vector.lower_transpose",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that the vector transpose-like operations nested under the 
-    isolated from above op `target` should be lowered to finer-grained vector
-    primitives.
+    Indicates that vector transpose-like operations should be lowered to
+    finer-grained vector primitives.
 
     This is usually a late step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target,
+  let arguments = (ins
      DefaultValuedAttr<VectorTransposeLoweringAttr,
        "vector::VectorTransposeLowering::EltWise">:$lowering_strategy,
      DefaultValuedAttr<BoolAttr, "false">:$avx2_lowering_strategy
   );
-  let results = (outs TransformHandleTypeInterface:$results);
 
   let assemblyFormat = [{
-    $target
     oilist (
       `lowering_strategy` `=` $lowering_strategy
       | `avx2_lowering_strategy` `=` $avx2_lowering_strategy
     )
     attr-dict
-    `:` functional-type($target, results)
   }];
 }
 
 // TODO: evolve split_transfer_strategy to proper enums.
-def SplitTransferFullPartialOp
-    : TransformWithPatternsOp<"vector.split_transfer_full_partial"> {
+def SplitTransferFullPartialOp : Op<Transform_Dialect,
+    "apply_patterns.vector.split_transfer_full_partial",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that the vector transfer operations nested under the 
-    isolated from above op `target` should be split to full and partial parts.
+    Indicates that vector transfer operations should be split to full and
+    partial parts.
 
     This is usually a late step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target,
+  let arguments = (ins
      DefaultValuedAttr<VectorTransferSplitAttr,
        "vector::VectorTransferSplit::LinalgCopy">:$split_transfer_strategy
   );
-  let results = (outs TransformHandleTypeInterface:$results);
 
   let assemblyFormat = [{
-    $target
-    (`split_transfer_strategy` `=` $split_transfer_strategy^)?
-    attr-dict
-    `:` functional-type($target, results)
+    (`split_transfer_strategy` `=` $split_transfer_strategy^)? attr-dict
   }];
 }
 
-def TransferToScfOp : TransformWithPatternsOp<"vector.transfer_to_scf"> {
+def TransferToScfOp : Op<Transform_Dialect,
+    "apply_patterns.vector.transfer_to_scf",
+    [DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
   let description = [{
-    Indicates that the vector transfer operations nested under the 
-    isolated from above op `target` should be rewritten with scf.for loops over
-    finer-grained vector primitives.
+    Indicates that vector transfer operations should be rewritten with scf.for
+    loops over finer-grained vector primitives.
 
     This is usually a late step that is run after bufferization as part of the
     process of lowering to e.g. LLVM or NVVM.
   }];
 
-  let arguments = (ins TransformHandleTypeInterface:$target,
+  let arguments = (ins
      DefaultValuedAttr<I64Attr, "1">:$max_transfer_rank,
      DefaultValuedAttr<BoolAttr, "false">:$full_unroll
   );
-  let results = (outs TransformHandleTypeInterface:$results);
 
   let assemblyFormat = [{
-    $target
     oilist (
         `max_transfer_rank` `=` $max_transfer_rank
       | `full_unroll` `=` $full_unroll
     )
     attr-dict
-    `:` functional-type($target, results)
   }];
 }
 

diff  --git a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
index b1dc66892c4c7..57b3226c7b3c1 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
@@ -1501,24 +1501,6 @@ transform::detail::verifyParamProducerTransformOpTrait(Operation *op) {
   return success();
 }
 
-DiagnosedSilenceableFailure transform::detail::transformWithPatternsApply(
-    Operation *transformOp, Operation *target, ApplyToEachResultList &results,
-    TransformState &state,
-    function_ref<void(RewritePatternSet &)> populatePatterns) {
-  if (!target->hasTrait<OpTrait::IsIsolatedFromAbove>()) {
-    return emitDefiniteFailure(transformOp)
-           << "applies only to isolated-from-above targets because it needs to "
-              "apply patterns greedily";
-  }
-  RewritePatternSet patterns(transformOp->getContext());
-  populatePatterns(patterns);
-  if (failed(applyPatternsAndFoldGreedily(target, std::move(patterns))))
-    return emitDefiniteFailure(transformOp) << "failed to apply patterns";
-
-  results.push_back(target);
-  return DiagnosedSilenceableFailure::success();
-}
-
 //===----------------------------------------------------------------------===//
 // Memory effects.
 //===----------------------------------------------------------------------===//

diff  --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
index 2dff9a903a261..212deb137077f 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
@@ -457,16 +457,25 @@ transform::ApplyPatternsOp::applyToOne(Operation *target,
   GreedyRewriteConfig config;
   config.listener = &listener;
 
-  // Manually gather list of ops because the other GreedyPatternRewriteDriver
-  // overloads only accepts ops that are isolated from above. This way, patterns
-  // can be applied to ops that are not isolated from above.
-  SmallVector<Operation *> ops;
-  target->walk([&](Operation *nestedOp) {
-    if (target != nestedOp)
-      ops.push_back(nestedOp);
-  });
-  LogicalResult result =
-      applyOpPatternsAndFold(ops, std::move(patterns), config);
+  LogicalResult result = failure();
+  if (target->hasTrait<OpTrait::IsIsolatedFromAbove>()) {
+    // Op is isolated from above. Apply patterns and also perform region
+    // simplification.
+    result = applyPatternsAndFoldGreedily(target, std::move(patterns), config);
+  } else {
+    // Manually gather list of ops because the other GreedyPatternRewriteDriver
+    // overloads only accepts ops that are isolated from above. This way,
+    // patterns can be applied to ops that are not isolated from above. Regions
+    // are not being simplified. Furthermore, only a single greedy rewrite
+    // iteration is performed.
+    SmallVector<Operation *> ops;
+    target->walk([&](Operation *nestedOp) {
+      if (target != nestedOp)
+        ops.push_back(nestedOp);
+    });
+    result = applyOpPatternsAndFold(ops, std::move(patterns), config);
+  }
+
   // A failure typically indicates that the pattern application did not
   // converge.
   if (failed(result)) {

diff  --git a/mlir/test/Dialect/LLVM/transform-e2e.mlir b/mlir/test/Dialect/LLVM/transform-e2e.mlir
index e9025238020b0..3fda2748c058a 100644
--- a/mlir/test/Dialect/LLVM/transform-e2e.mlir
+++ b/mlir/test/Dialect/LLVM/transform-e2e.mlir
@@ -27,33 +27,35 @@ transform.sequence failures(propagate) {
 
   // TODO: group these lower-level controls into various properly named vector
   // lowering TD macros.
-  %func = transform.vector.lower_contraction %f
-    lowering_strategy = "outerproduct"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_contraction lowering_strategy = "outerproduct"
+  } : !transform.any_op
 
-  %func_2 = transform.vector.apply_transfer_permutation_patterns %func
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.apply_transfer_permutation_patterns
+  } : !transform.any_op
 
-  %func_3 = transform.vector.lower_multi_reduction %func_2
-    lowering_strategy = "innerparallel"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_multi_reduction lowering_strategy = "innerparallel"
+  } : !transform.any_op
 
-  %func_4 = transform.vector.split_transfer_full_partial %func_3
-    split_transfer_strategy = "linalg-copy"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "linalg-copy"
+  } : !transform.any_op
 
-  %func_5 = transform.vector.transfer_to_scf %func_4
-    max_transfer_rank = 1 full_unroll = true
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.transfer_to_scf max_transfer_rank = 1 full_unroll = true
+  } : !transform.any_op
 
-  %func_6 = transform.vector.lower_transfer %func_5
-    max_transfer_rank = 1
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_transfer max_transfer_rank = 1
+  } : !transform.any_op
 
-  %func_7 = transform.vector.lower_shape_cast %func_6
-    : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_shape_cast
+  } : !transform.any_op
 
-  %func_8 = transform.vector.lower_transpose %func_7
-    lowering_strategy = "shuffle_1d"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_transpose lowering_strategy = "shuffle_1d"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir b/mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir
index a737b1885020c..f3140a9bda8a6 100644
--- a/mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir
+++ b/mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir
@@ -32,5 +32,7 @@ transform.sequence failures(propagate) {
   %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!transform.any_op) -> !transform.any_op
   %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
   %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
-  transform.vector.lower_contraction %2 lowering_strategy = "outerproduct" : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %2 {
+    transform.apply_patterns.vector.lower_contraction lowering_strategy = "outerproduct"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/transform-vector.mlir b/mlir/test/Dialect/Vector/transform-vector.mlir
index beda04294b844..7bdbaf9514a32 100644
--- a/mlir/test/Dialect/Vector/transform-vector.mlir
+++ b/mlir/test/Dialect/Vector/transform-vector.mlir
@@ -30,33 +30,35 @@ transform.sequence failures(propagate) {
 
   // TODO: group these lower-level controls into various properly named vector
   // lowering TD macros.
-  %func = transform.vector.lower_contraction %f
-    lowering_strategy = "outerproduct"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_contraction lowering_strategy = "outerproduct"
+  } : !transform.any_op
 
-  %func_2 = transform.vector.apply_transfer_permutation_patterns %func
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.apply_transfer_permutation_patterns
+  } : !transform.any_op
 
-  %func_3 = transform.vector.lower_multi_reduction %func_2
-    lowering_strategy = "innerparallel"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_multi_reduction lowering_strategy = "innerparallel"
+  } : !transform.any_op
 
-  %func_4 = transform.vector.split_transfer_full_partial %func_3
-    split_transfer_strategy = "linalg-copy"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "linalg-copy"
+  } : !transform.any_op
 
-  %func_5 = transform.vector.transfer_to_scf %func_4
-    max_transfer_rank = 1 full_unroll = true
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.transfer_to_scf max_transfer_rank = 1 full_unroll = true
+  } : !transform.any_op
 
-  %func_6 = transform.vector.lower_transfer %func_5
-    max_transfer_rank = 1
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_transfer max_transfer_rank = 1
+  } : !transform.any_op
 
-  %func_7 = transform.vector.lower_shape_cast %func_6
-    : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_shape_cast
+  } : !transform.any_op
 
-  %func_8 = transform.vector.lower_transpose %func_7
-    lowering_strategy = "shuffle_1d"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_transpose lowering_strategy = "shuffle_1d"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-broadcast-lowering-transforms.mlir b/mlir/test/Dialect/Vector/vector-broadcast-lowering-transforms.mlir
index 9712031f4fc81..c71b6d6d8a7a7 100644
--- a/mlir/test/Dialect/Vector/vector-broadcast-lowering-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-broadcast-lowering-transforms.mlir
@@ -167,6 +167,7 @@ transform.sequence failures(propagate) {
   %f = transform.structured.match ops{["func.func"]} in %module_op 
     : (!transform.any_op) -> !transform.any_op
 
-  transform.vector.lower_broadcast %f
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_broadcast
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir b/mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir
index 2a006034a87d8..f897ed0944ef6 100644
--- a/mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir
@@ -210,7 +210,7 @@ func.func @redpar_vecmattrans2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<v
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.lower_contraction %module_op
-    lowering_strategy = "outerproduct"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_contraction lowering_strategy = "outerproduct"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-contract-to-dot-transforms.mlir b/mlir/test/Dialect/Vector/vector-contract-to-dot-transforms.mlir
index eb05ae11b8647..913b5b3751b1a 100644
--- a/mlir/test/Dialect/Vector/vector-contract-to-dot-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-contract-to-dot-transforms.mlir
@@ -300,7 +300,7 @@ transform.sequence failures(propagate) {
   %f = transform.structured.match ops{["func.func"]} in %module_op 
     : (!transform.any_op) -> !transform.any_op
 
-  %f2 = transform.vector.lower_contraction %f
-    lowering_strategy = "dot"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_contraction lowering_strategy = "dot"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-contract-to-matrix-intrinsics-transforms.mlir b/mlir/test/Dialect/Vector/vector-contract-to-matrix-intrinsics-transforms.mlir
index 2101a5a1d59eb..2de95789cbddc 100644
--- a/mlir/test/Dialect/Vector/vector-contract-to-matrix-intrinsics-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-contract-to-matrix-intrinsics-transforms.mlir
@@ -48,10 +48,11 @@ transform.sequence failures(propagate) {
   %f = transform.structured.match ops{["func.func"]} in %module_op 
     : (!transform.any_op) -> !transform.any_op
 
-  %f2 = transform.vector.lower_contraction %f
-    lowering_strategy = "matmulintrinsics"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_contraction lowering_strategy = "matmulintrinsics"
+  } : !transform.any_op
 
-  %f3 = transform.vector.lower_shape_cast %f2
-    : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_shape_cast
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-contract-to-outerproduct-transforms.mlir b/mlir/test/Dialect/Vector/vector-contract-to-outerproduct-transforms.mlir
index 0c12ebb24be70..a53064a99d5c6 100644
--- a/mlir/test/Dialect/Vector/vector-contract-to-outerproduct-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-contract-to-outerproduct-transforms.mlir
@@ -347,7 +347,7 @@ transform.sequence failures(propagate) {
   %f = transform.structured.match ops{["func.func"]} in %module_op 
     : (!transform.any_op) -> !transform.any_op
 
-  %f2 = transform.vector.lower_contraction %f
-    lowering_strategy = "outerproduct"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_contraction lowering_strategy = "outerproduct"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-contract-to-parallel-arith-transforms.mlir b/mlir/test/Dialect/Vector/vector-contract-to-parallel-arith-transforms.mlir
index 2614e35fb4784..5a7502fbac355 100644
--- a/mlir/test/Dialect/Vector/vector-contract-to-parallel-arith-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-contract-to-parallel-arith-transforms.mlir
@@ -56,7 +56,7 @@ transform.sequence failures(propagate) {
   %f = transform.structured.match ops{["func.func"]} in %module_op 
     : (!transform.any_op) -> !transform.any_op
 
-  %f2 = transform.vector.lower_contraction %f
-    lowering_strategy = "parallelarith"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_contraction lowering_strategy = "parallelarith"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-mask-lowering-transforms.mlir b/mlir/test/Dialect/Vector/vector-mask-lowering-transforms.mlir
index ffb0c3ccc427d..d0d53a8356c8a 100644
--- a/mlir/test/Dialect/Vector/vector-mask-lowering-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-mask-lowering-transforms.mlir
@@ -96,8 +96,9 @@ transform.sequence failures(propagate) {
   %f = transform.structured.match ops{["func.func"]} in %module_op 
     : (!transform.any_op) -> !transform.any_op
 
-  transform.vector.lower_masks %f
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_masks
+  } : !transform.any_op
 }
 
 // -----
@@ -126,6 +127,7 @@ transform.sequence failures(propagate) {
   %f = transform.structured.match ops{["func.func"]} in %module_op 
     : (!transform.any_op) -> !transform.any_op
 
-  transform.vector.lower_masked_transfers %f
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_masked_transfers
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-multi-reduction-lowering.mlir b/mlir/test/Dialect/Vector/vector-multi-reduction-lowering.mlir
index d986d3c701437..884cf2840a3fd 100644
--- a/mlir/test/Dialect/Vector/vector-multi-reduction-lowering.mlir
+++ b/mlir/test/Dialect/Vector/vector-multi-reduction-lowering.mlir
@@ -267,7 +267,7 @@ func.func @vector_multi_reduction_parallel_middle(%arg0: vector<3x4x5xf32>, %acc
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.lower_multi_reduction %module_op
-    lowering_strategy = "innerreduction"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_multi_reduction lowering_strategy = "innerreduction"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-multi-reduction-outer-lowering.mlir b/mlir/test/Dialect/Vector/vector-multi-reduction-outer-lowering.mlir
index d3c4ecb9be812..eee55e834a9d1 100644
--- a/mlir/test/Dialect/Vector/vector-multi-reduction-outer-lowering.mlir
+++ b/mlir/test/Dialect/Vector/vector-multi-reduction-outer-lowering.mlir
@@ -190,7 +190,7 @@ func.func @vector_multi_reduction_to_scalar(%arg0: vector<2x3xf32>, %acc: f32) -
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.lower_multi_reduction %module_op
-    lowering_strategy = "innerparallel"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_multi_reduction lowering_strategy = "innerparallel"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-outerproduct-lowering-transforms.mlir b/mlir/test/Dialect/Vector/vector-outerproduct-lowering-transforms.mlir
index a60d1c48c40d0..907bdb45a3a68 100644
--- a/mlir/test/Dialect/Vector/vector-outerproduct-lowering-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-outerproduct-lowering-transforms.mlir
@@ -15,7 +15,7 @@
 // CHECK:      return %[[T7]] : vector<2x3xf32>
 
 func.func @outerproduct_noacc(%arg0: vector<2xf32>,
-                         %arg1: vector<3xf32>) -> vector<2x3xf32> {
+                              %arg1: vector<3xf32>) -> vector<2x3xf32> {
   %0 = vector.outerproduct %arg0, %arg1 : vector<2xf32>, vector<3xf32>
   return %0: vector<2x3xf32>
 }
@@ -38,8 +38,8 @@ func.func @outerproduct_noacc(%arg0: vector<2xf32>,
 // CHECK:      return %[[T9]] : vector<2x3xf32>
 
 func.func @outerproduct_acc(%arg0: vector<2xf32>,
-                       %arg1: vector<3xf32>,
-                       %arg2: vector<2x3xf32>) -> vector<2x3xf32> {
+                            %arg1: vector<3xf32>,
+                            %arg2: vector<2x3xf32>) -> vector<2x3xf32> {
   %0 = vector.outerproduct %arg0, %arg1, %arg2 : vector<2xf32>, vector<3xf32>
   return %0: vector<2x3xf32>
 }
@@ -58,7 +58,7 @@ func.func @outerproduct_acc(%arg0: vector<2xf32>,
 // CHECK:      %[[T7:.*]] = vector.insert %[[T6]], %[[T3]] [1] : vector<3xi32> into vector<2x3xi32>
 // CHECK:      return %[[T7]] : vector<2x3xi32>
 func.func @outerproduct_noacc_int(%arg0: vector<2xi32>,
-                             %arg1: vector<3xi32>) -> vector<2x3xi32> {
+                                  %arg1: vector<3xi32>) -> vector<2x3xi32> {
   %0 = vector.outerproduct %arg0, %arg1 : vector<2xi32>, vector<3xi32>
   return %0: vector<2x3xi32>
 }
@@ -82,8 +82,8 @@ func.func @outerproduct_noacc_int(%arg0: vector<2xi32>,
 // CHECK:      %[[T11:.*]] = vector.insert %[[T10]], %[[T5]] [1] : vector<3xi32> into vector<2x3xi32>
 // CHECK:      return %[[T11]] : vector<2x3xi32>
 func.func @outerproduct_acc_int(%arg0: vector<2xi32>,
-                           %arg1: vector<3xi32>,
-                           %arg2: vector<2x3xi32>) -> vector<2x3xi32> {
+                                %arg1: vector<3xi32>,
+                                %arg2: vector<2x3xi32>) -> vector<2x3xi32> {
   %0 = vector.outerproduct %arg0, %arg1, %arg2 : vector<2xi32>, vector<3xi32>
   return %0: vector<2x3xi32>
 }
@@ -95,8 +95,8 @@ func.func @outerproduct_acc_int(%arg0: vector<2xi32>,
 // CHECK: %[[T1:.*]] = arith.mulf %[[A]], %[[T0]] : vector<16xf32>
 // CHECK: return %[[T1]] : vector<16xf32>
 func.func @axpy_fp(%arg0: vector<16xf32>, %arg1: f32) -> vector<16xf32> {
-   %0 = vector.outerproduct %arg0, %arg1: vector<16xf32>, f32
-   return %0: vector<16xf32>
+  %0 = vector.outerproduct %arg0, %arg1: vector<16xf32>, f32
+  return %0: vector<16xf32>
 }
 
 // CHECK-LABEL: func @axpy_fp_add(
@@ -107,8 +107,8 @@ func.func @axpy_fp(%arg0: vector<16xf32>, %arg1: f32) -> vector<16xf32> {
 // CHECK: %[[T1:.*]] = vector.fma %[[A]], %[[T0]], %[[C]] : vector<16xf32>
 // CHECK: return %[[T1]] : vector<16xf32>
 func.func @axpy_fp_add(%arg0: vector<16xf32>, %arg1: f32, %arg2 : vector<16xf32>) -> vector<16xf32> {
-   %0 = vector.outerproduct %arg0, %arg1, %arg2: vector<16xf32>, f32
-   return %0: vector<16xf32>
+  %0 = vector.outerproduct %arg0, %arg1, %arg2: vector<16xf32>, f32
+  return %0: vector<16xf32>
 }
 
 // CHECK-LABEL: func @axpy_int(
@@ -118,8 +118,8 @@ func.func @axpy_fp_add(%arg0: vector<16xf32>, %arg1: f32, %arg2 : vector<16xf32>
 // CHECK: %[[T1:.*]] = arith.muli %[[A]], %[[T0]] : vector<16xi32>
 // CHECK: return %[[T1]] : vector<16xi32>
 func.func @axpy_int(%arg0: vector<16xi32>, %arg1: i32) -> vector<16xi32> {
-   %0 = vector.outerproduct %arg0, %arg1: vector<16xi32>, i32
-   return %0: vector<16xi32>
+  %0 = vector.outerproduct %arg0, %arg1: vector<16xi32>, i32
+  return %0: vector<16xi32>
 }
 
 // CHECK-LABEL: func @axpy_int_add(
@@ -131,8 +131,8 @@ func.func @axpy_int(%arg0: vector<16xi32>, %arg1: i32) -> vector<16xi32> {
 // CHECK: %[[T2:.*]] = arith.addi %[[T1]], %[[C]] : vector<16xi32>
 // CHECK: return %[[T2]] : vector<16xi32>
 func.func @axpy_int_add(%arg0: vector<16xi32>, %arg1: i32, %arg2: vector<16xi32>) -> vector<16xi32> {
-   %0 = vector.outerproduct %arg0, %arg1, %arg2: vector<16xi32>, i32
-   return %0: vector<16xi32>
+  %0 = vector.outerproduct %arg0, %arg1, %arg2: vector<16xi32>, i32
+  return %0: vector<16xi32>
 }
 
 transform.sequence failures(propagate) {
@@ -140,9 +140,11 @@ transform.sequence failures(propagate) {
   %f = transform.structured.match ops{["func.func"]} in %module_op 
     : (!transform.any_op) -> !transform.any_op
 
-  %f2 = transform.vector.lower_outerproduct %f
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_outerproduct
+  } : !transform.any_op
 
-  %f3 = transform.vector.lower_broadcast %f2
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_broadcast
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-shape-cast-lowering-transforms.mlir b/mlir/test/Dialect/Vector/vector-shape-cast-lowering-transforms.mlir
index f233a17244ff7..92b3e80b266b0 100644
--- a/mlir/test/Dialect/Vector/vector-shape-cast-lowering-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-shape-cast-lowering-transforms.mlir
@@ -154,6 +154,7 @@ transform.sequence failures(propagate) {
   %f = transform.structured.match ops{["func.func"]} in %module_op
     : (!transform.any_op) -> !transform.any_op
 
-  %f2 = transform.vector.lower_shape_cast %f
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %f {
+    transform.apply_patterns.vector.lower_shape_cast
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-transfer-drop-unit-dims-patterns.mlir b/mlir/test/Dialect/Vector/vector-transfer-drop-unit-dims-patterns.mlir
index 3efa06948f546..749afa238d69a 100644
--- a/mlir/test/Dialect/Vector/vector-transfer-drop-unit-dims-patterns.mlir
+++ b/mlir/test/Dialect/Vector/vector-transfer-drop-unit-dims-patterns.mlir
@@ -16,9 +16,10 @@ func.func @transfer_read_rank_reducing(
 //       CHECK:   vector.transfer_read %[[SUBVIEW]]
 
 transform.sequence failures(propagate) {
-^bb1(%module_op: !pdl.operation):
-  transform.vector.apply_rank_reducing_subview_patterns %module_op
-      : (!pdl.operation) -> !pdl.operation
+^bb1(%module_op: !transform.any_op):
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.apply_rank_reducing_subview_patterns
+  } : !transform.any_op
 }
 
 // -----
@@ -37,9 +38,10 @@ func.func @transfer_write_rank_reducing(%arg : memref<1x1x3x2xi8, strided<[6, 6,
 //       CHECK:   vector.transfer_write %{{.*}}, %[[SUBVIEW]]
 
 transform.sequence failures(propagate) {
-^bb1(%module_op: !pdl.operation):
-  transform.vector.apply_rank_reducing_subview_patterns %module_op
-      : (!pdl.operation) -> !pdl.operation
+^bb1(%module_op: !transform.any_op):
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.apply_rank_reducing_subview_patterns
+  } : !transform.any_op
 }
 
 // -----
@@ -60,9 +62,10 @@ func.func @transfer_read_and_vector_rank_reducing(
 //       CHECK:   vector.transfer_read %[[SUBVIEW]]{{.*}} {in_bounds = [true, true]} : memref<3x2xf32>, vector<3x2xf32>
 
 transform.sequence failures(propagate) {
-^bb1(%module_op: !pdl.operation):
-  transform.vector.apply_rank_reducing_subview_patterns %module_op
-      : (!pdl.operation) -> !pdl.operation
+^bb1(%module_op: !transform.any_op):
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.apply_rank_reducing_subview_patterns
+  } : !transform.any_op
 }
 
 // -----
@@ -84,8 +87,9 @@ func.func @transfer_write_and_vector_rank_reducing(
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.apply_rank_reducing_subview_patterns %module_op
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.apply_rank_reducing_subview_patterns
+  } : !transform.any_op
 }
 
 // -----
@@ -106,9 +110,10 @@ func.func @transfer_read_and_vector_rank_reducing_to_0d(
 //       CHECK:   vector.shape_cast %[[READ]] : vector<f32> to vector<1x1x1xf32>
 
 transform.sequence failures(propagate) {
-^bb1(%module_op: !pdl.operation):
-  transform.vector.apply_rank_reducing_subview_patterns %module_op
-      : (!pdl.operation) -> !pdl.operation
+^bb1(%module_op: !transform.any_op):
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.apply_rank_reducing_subview_patterns
+  } : !transform.any_op
 }
 
 // -----
@@ -130,6 +135,7 @@ func.func @transfer_write_and_vector_rank_reducing_to_0d(
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.apply_rank_reducing_subview_patterns %module_op
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.apply_rank_reducing_subview_patterns
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-transfer-full-partial-split-copy-transform.mlir b/mlir/test/Dialect/Vector/vector-transfer-full-partial-split-copy-transform.mlir
index ff167bc639b04..424c53c93575d 100644
--- a/mlir/test/Dialect/Vector/vector-transfer-full-partial-split-copy-transform.mlir
+++ b/mlir/test/Dialect/Vector/vector-transfer-full-partial-split-copy-transform.mlir
@@ -108,9 +108,9 @@ func.func @split_vector_transfer_read_strided_2d(
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.split_transfer_full_partial %module_op
-    split_transfer_strategy = "linalg-copy"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "linalg-copy"
+  } : !transform.any_op
 }
 
 // -----
@@ -169,9 +169,9 @@ func.func @split_vector_transfer_write_2d(%V: vector<4x8xf32>, %A: memref<?x8xf3
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.split_transfer_full_partial %module_op
-    split_transfer_strategy = "linalg-copy"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "linalg-copy"
+  } : !transform.any_op
 }
 
 // -----
@@ -237,7 +237,7 @@ func.func @split_vector_transfer_write_strided_2d(
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.split_transfer_full_partial %module_op
-    split_transfer_strategy = "linalg-copy"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "linalg-copy"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir b/mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir
index 8ae8400712092..e7adcfaed41c2 100644
--- a/mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir
+++ b/mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir
@@ -103,9 +103,9 @@ func.func @split_vector_transfer_read_strided_2d(
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.split_transfer_full_partial %module_op
-    split_transfer_strategy = "vector-transfer"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "vector-transfer"
+  } : !transform.any_op
 }
 
 // -----
@@ -161,9 +161,9 @@ func.func @split_vector_transfer_write_2d(%V: vector<4x8xf32>, %A: memref<?x8xf3
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.split_transfer_full_partial %module_op
-    split_transfer_strategy = "vector-transfer"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "vector-transfer"
+  } : !transform.any_op
 }
 
 // -----
@@ -223,9 +223,9 @@ func.func @split_vector_transfer_write_strided_2d(
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.split_transfer_full_partial %module_op
-    split_transfer_strategy = "vector-transfer"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "vector-transfer"
+  } : !transform.any_op
 }
 
 // -----
@@ -265,7 +265,7 @@ func.func @transfer_read_within_scf_for(%A : memref<?x?xf32>, %lb : index, %ub :
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.split_transfer_full_partial %module_op
-    split_transfer_strategy = "vector-transfer"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "vector-transfer"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-transfer-to-vector-load-store.mlir b/mlir/test/Dialect/Vector/vector-transfer-to-vector-load-store.mlir
index b948abb7c0a51..e136219a2e03c 100644
--- a/mlir/test/Dialect/Vector/vector-transfer-to-vector-load-store.mlir
+++ b/mlir/test/Dialect/Vector/vector-transfer-to-vector-load-store.mlir
@@ -240,11 +240,10 @@ func.func @transfer_broadcasting_complex(%mem : memref<10x20x30x8x8xf32>, %i : i
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  %m2 = transform.vector.lower_transfer %module_op
-    max_transfer_rank = 99
-      : (!transform.any_op) -> !transform.any_op
-  transform.vector.apply_transfer_permutation_patterns %m2
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_transfer max_transfer_rank = 99
+    transform.apply_patterns.vector.apply_transfer_permutation_patterns
+  } : !transform.any_op
 }
 
 // -----
@@ -363,9 +362,8 @@ func.func @transfer_write_broadcast_unit_dim(
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  %m2 = transform.vector.lower_transfer %module_op
-    max_transfer_rank = 99
-      : (!transform.any_op) -> !transform.any_op
-  transform.vector.apply_transfer_permutation_patterns %m2
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_transfer max_transfer_rank = 99
+    transform.apply_patterns.vector.apply_transfer_permutation_patterns
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Dialect/Vector/vector-transpose-lowering.mlir b/mlir/test/Dialect/Vector/vector-transpose-lowering.mlir
index ba4e2177088ca..0865f97a9fd4d 100644
--- a/mlir/test/Dialect/Vector/vector-transpose-lowering.mlir
+++ b/mlir/test/Dialect/Vector/vector-transpose-lowering.mlir
@@ -76,9 +76,9 @@ func.func @transpose1023_1x1x8x8xf32(%arg0: vector<1x1x8x8xf32>) -> vector<1x1x8
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.lower_transpose %module_op
-    lowering_strategy = "eltwise"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_transpose lowering_strategy = "eltwise"
+  } : !transform.any_op
 }
 
 // -----
@@ -99,9 +99,9 @@ func.func @transpose(%arg0: vector<2x4xf32>) -> vector<4x2xf32> {
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.lower_transpose %module_op
-    lowering_strategy = "shuffle_1d"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_transpose lowering_strategy = "shuffle_1d"
+  } : !transform.any_op
 }
 
 // -----
@@ -118,9 +118,9 @@ func.func @transpose(%arg0: vector<2x4xf32>) -> vector<4x2xf32> {
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.lower_transpose %module_op
-    lowering_strategy = "flat_transpose"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_transpose lowering_strategy = "flat_transpose"
+  } : !transform.any_op
 }
 
 // -----
@@ -605,9 +605,9 @@ func.func @transpose210_1x8x8xf32(%arg0: vector<1x8x8xf32>) -> vector<8x8x1xf32>
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.lower_transpose %module_op
-    avx2_lowering_strategy = true
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_transpose avx2_lowering_strategy = true
+  } : !transform.any_op
 }
 
 // -----
@@ -683,9 +683,9 @@ func.func @transpose_shuffle16x16xf32(%arg0: vector<16x16xf32>) -> vector<16x16x
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.lower_transpose %module_op
-    lowering_strategy = "shuffle_16x16"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_transpose lowering_strategy = "shuffle_16x16"
+  } : !transform.any_op
 }
 
 // -----
@@ -762,7 +762,7 @@ func.func @transpose021_shuffle16x16xf32(%arg0: vector<1x16x16xf32>) -> vector<1
 
 transform.sequence failures(propagate) {
 ^bb1(%module_op: !transform.any_op):
-  transform.vector.lower_transpose %module_op
-    lowering_strategy = "shuffle_16x16"
-      : (!transform.any_op) -> !transform.any_op
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_transpose lowering_strategy = "shuffle_16x16"
+  } : !transform.any_op
 }

diff  --git a/mlir/test/Integration/Dialect/Vector/CPU/test-shuffle16x16.mlir b/mlir/test/Integration/Dialect/Vector/CPU/test-shuffle16x16.mlir
index 147d9a7f2ff4c..798a224285f00 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/test-shuffle16x16.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/test-shuffle16x16.mlir
@@ -30,9 +30,9 @@ func.func @entry() {
 }
 
 transform.sequence failures(propagate) {
-^bb1(%module_op: !pdl.operation):
-  transform.vector.lower_transpose %module_op
-    lowering_strategy = "shuffle_16x16"
-      : (!pdl.operation) -> !pdl.operation
+^bb1(%module_op: !transform.any_op):
+  transform.apply_patterns [] to %module_op {
+    transform.apply_patterns.vector.lower_transpose lowering_strategy = "shuffle_16x16"
+  } : !transform.any_op
 }
 


        


More information about the Mlir-commits mailing list