[Mlir-commits] [mlir] 4106557 - [mlir][transform] Improve transform.get_closest_isolated_parent
Matthias Springer
llvmlistbot at llvm.org
Tue Jul 4 07:30:21 PDT 2023
Author: Matthias Springer
Date: 2023-07-04T16:23:08+02:00
New Revision: 4106557a2883fd977c64c96728e18dab9a7f02ef
URL: https://github.com/llvm/llvm-project/commit/4106557a2883fd977c64c96728e18dab9a7f02ef
DIFF: https://github.com/llvm/llvm-project/commit/4106557a2883fd977c64c96728e18dab9a7f02ef.diff
LOG: [mlir][transform] Improve transform.get_closest_isolated_parent
* Rename op to `transform.get_parent_op`
* Match parents by "is isolated from above" and/or op name, or just the direct parent.
* Deduplication of result payload ops is optional.
Differential Revision: https://reviews.llvm.org/D154071
Added:
Modified:
mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
mlir/lib/Dialect/Transform/IR/TransformOps.cpp
mlir/python/mlir/dialects/_transform_ops_ext.py
mlir/test/Dialect/LLVM/transform-e2e.mlir
mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir
mlir/test/Dialect/Linalg/transform-op-vectorize.mlir
mlir/test/Dialect/Linalg/vectorization.mlir
mlir/test/Dialect/Linalg/vectorize-tensor-extract.mlir
mlir/test/Dialect/Transform/expensive-checks.mlir
mlir/test/Dialect/Transform/selective-targeting.mlir
mlir/test/Dialect/Transform/test-interpreter.mlir
mlir/test/Dialect/Vector/transform-vector.mlir
mlir/test/python/dialects/transform.py
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
index b8727864499fe8..0f8fdfd358858c 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
@@ -420,33 +420,6 @@ def ForeachOp : TransformDialectOp<"foreach",
}];
}
-def GetClosestIsolatedParentOp : TransformDialectOp<"get_closest_isolated_parent",
- [DeclareOpInterfaceMethods<TransformOpInterface>,
- NavigationTransformOpTrait, MemoryEffectsOpInterface]> {
- let summary = "Gets handles to the closest isolated-from-above parents";
- let description = [{
- The handles defined by this Transform op correspond to the closest isolated
- from above ancestor of the Payload IR operations associated with its
- operand. If any of the given Payload IR ops has no such parent (unlikely as
- there usually is a top-level ModuleOp), the transformation is considered to
- have failed.
-
- Ancestor ops follow the same order as the ops associated with the
- operand, except for potential duplicates (multiple Payload IR ops associated
- with the operand have the same parent) for which the ancestor will only be
- listed once for the first time it occurs. For example, given the list
- "(childof(A), childof(B), childof(B), childof(A), childof(B))", the
- resulting list will be just "(A, B)". Note that no other semantic ordering
- is applied, e.g., "B" may itself be a parent of "A". This may have an impact
- on the further transformation applied to the handle produced here.
- }];
-
- let arguments = (ins TransformHandleTypeInterface:$target);
- let results = (outs TransformHandleTypeInterface:$parent);
- let assemblyFormat =
- "$target attr-dict `:` functional-type(operands, results)";
-}
-
def GetConsumersOfResult : TransformDialectOp<"get_consumers_of_result",
[DeclareOpInterfaceMethods<TransformOpInterface>,
NavigationTransformOpTrait, MemoryEffectsOpInterface]> {
@@ -485,6 +458,40 @@ def GetDefiningOp : TransformDialectOp<"get_defining_op",
"functional-type(operands, results)";
}
+def GetParentOp : TransformDialectOp<"get_parent_op",
+ [DeclareOpInterfaceMethods<TransformOpInterface>,
+ NavigationTransformOpTrait, MemoryEffectsOpInterface]> {
+ let summary = "Gets handles to the closest isolated-from-above parents";
+ let description = [{
+ The handle defined by this Transform op corresponds to the parents of the
+ targeted payload ops (in the same order).
+
+ Requirements that parent ops must fulfill can be optionally specified. In
+ that case for each target op, the closest parent op that fulfills all
+ requirements, is returned.
+ - `isolated_from_above`: the parent op must be isolated from above
+ - `op_name`: the parent op must have the specified name
+
+ If `deduplicate` is set, the result handle does not contain any duplicate
+ ops. For example, given the list
+ "(childof(A), childof(B), childof(B), childof(A), childof(B))", the
+ resulting list will be just "(A, B)". Note that no other semantic ordering
+ is applied, e.g., "B" may itself be a parent of "A". This may have an impact
+ on the further transformation applied to the handle produced here.
+
+ If any of the given Payload IR ops has no such suitable parent, the
+ transformation fails silently.
+ }];
+
+ let arguments = (ins TransformHandleTypeInterface:$target,
+ UnitAttr:$isolated_from_above,
+ OptionalAttr<StrAttr>:$op_name,
+ UnitAttr:$deduplicate);
+ let results = (outs TransformHandleTypeInterface:$parent);
+ let assemblyFormat =
+ "$target attr-dict `:` functional-type(operands, results)";
+}
+
def GetProducerOfOperand : TransformDialectOp<"get_producer_of_operand",
[DeclareOpInterfaceMethods<TransformOpInterface>,
NavigationTransformOpTrait, MemoryEffectsOpInterface]> {
diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
index 278010805fb43b..3c60d45999d7b3 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
@@ -909,26 +909,43 @@ LogicalResult transform::ForeachOp::verify() {
}
//===----------------------------------------------------------------------===//
-// GetClosestIsolatedParentOp
+// GetParentOp
//===----------------------------------------------------------------------===//
-DiagnosedSilenceableFailure transform::GetClosestIsolatedParentOp::apply(
- transform::TransformRewriter &rewriter,
- transform::TransformResults &results, transform::TransformState &state) {
- SetVector<Operation *> parents;
+DiagnosedSilenceableFailure
+transform::GetParentOp::apply(transform::TransformRewriter &rewriter,
+ transform::TransformResults &results,
+ transform::TransformState &state) {
+ SmallVector<Operation *> parents;
+ DenseSet<Operation *> resultSet;
for (Operation *target : state.getPayloadOps(getTarget())) {
- Operation *parent =
- target->getParentWithTrait<OpTrait::IsIsolatedFromAbove>();
+ Operation *parent = target->getParentOp();
+ do {
+ bool checkIsolatedFromAbove =
+ !getIsolatedFromAbove() ||
+ parent->hasTrait<OpTrait::IsIsolatedFromAbove>();
+ bool checkOpName = !getOpName().has_value() ||
+ parent->getName().getStringRef() == *getOpName();
+ if (checkIsolatedFromAbove && checkOpName)
+ break;
+ } while ((parent = parent->getParentOp()));
if (!parent) {
DiagnosedSilenceableFailure diag =
emitSilenceableError()
- << "could not find an isolated-from-above parent op";
+ << "could not find a parent op that matches all requirements";
diag.attachNote(target->getLoc()) << "target op";
return diag;
}
- parents.insert(parent);
+ if (getDeduplicate()) {
+ if (!resultSet.contains(parent)) {
+ parents.push_back(parent);
+ resultSet.insert(parent);
+ }
+ } else {
+ parents.push_back(parent);
+ }
}
- results.set(llvm::cast<OpResult>(getResult()), parents.getArrayRef());
+ results.set(llvm::cast<OpResult>(getResult()), parents);
return DiagnosedSilenceableFailure::success();
}
diff --git a/mlir/python/mlir/dialects/_transform_ops_ext.py b/mlir/python/mlir/dialects/_transform_ops_ext.py
index 425ec65859d399..87f8d398cd5bfc 100644
--- a/mlir/python/mlir/dialects/_transform_ops_ext.py
+++ b/mlir/python/mlir/dialects/_transform_ops_ext.py
@@ -15,17 +15,42 @@
class CastOp:
- def __init__(
- self, result_type: Type, target: Union[Operation, Value], *, loc=None, ip=None
- ):
- super().__init__(result_type, _get_op_result_or_value(target), loc=loc, ip=ip)
+ def __init__(
+ self,
+ result_type: Type,
+ target: Union[Operation, Value],
+ *,
+ loc=None,
+ ip=None,
+ ):
+ super().__init__(
+ result_type, _get_op_result_or_value(target), loc=loc, ip=ip
+ )
-class GetClosestIsolatedParentOp:
- def __init__(
- self, result_type: Type, target: Union[Operation, Value], *, loc=None, ip=None
- ):
- super().__init__(result_type, _get_op_result_or_value(target), loc=loc, ip=ip)
+
+class testGetParentOp:
+
+ def __init__(
+ self,
+ result_type: Type,
+ target: Union[Operation, Value],
+ *,
+ isolated_from_above: bool = False,
+ op_name: Optional[str] = None,
+ deduplicate: bool = False,
+ loc=None,
+ ip=None,
+ ):
+ super().__init__(
+ result_type,
+ _get_op_result_or_value(target),
+ isolated_from_above=isolated_from_above,
+ op_name=op_name,
+ deduplicate=deduplicate,
+ loc=loc,
+ ip=ip,
+ )
class MergeHandlesOp:
diff --git a/mlir/test/Dialect/LLVM/transform-e2e.mlir b/mlir/test/Dialect/LLVM/transform-e2e.mlir
index 25cf749f495ed3..777de75b1a47ac 100644
--- a/mlir/test/Dialect/LLVM/transform-e2e.mlir
+++ b/mlir/test/Dialect/LLVM/transform-e2e.mlir
@@ -16,7 +16,7 @@ transform.sequence failures(propagate) {
^bb1(%module_op: !transform.any_op):
%0 = transform.structured.match ops{["linalg.matmul"]} in %module_op : (!transform.any_op) -> !transform.any_op
%1, %loops:3 = transform.structured.tile %0 [2, 2, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op)
- %2 = get_closest_isolated_parent %1 : (!transform.any_op) -> !transform.any_op
+ %2 = get_parent_op %1 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
transform.structured.vectorize %2 : (!transform.any_op) -> !transform.any_op
%b = transform.bufferization.one_shot_bufferize layout{IdentityLayoutMap}
%module_op {bufferize_function_boundaries = true}
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 6ebcdd463988b7..ea84b6b7587687 100644
--- a/mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir
+++ b/mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir
@@ -30,7 +30,7 @@ func.func @outerproduct_matmul(%A: memref<3x3xf32>, %B: memref<3x3xf32>, %C: mem
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%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
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
transform.apply_patterns to %2 {
transform.apply_patterns.vector.lower_contraction lowering_strategy = "outerproduct"
diff --git a/mlir/test/Dialect/Linalg/transform-op-vectorize.mlir b/mlir/test/Dialect/Linalg/transform-op-vectorize.mlir
index d30db938f2bd1c..b335a65250d93e 100644
--- a/mlir/test/Dialect/Linalg/transform-op-vectorize.mlir
+++ b/mlir/test/Dialect/Linalg/transform-op-vectorize.mlir
@@ -19,7 +19,7 @@ func.func @vectorize_matmul(%arg0: tensor<24x12xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%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
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -44,7 +44,7 @@ func.func @vectorize_matmul_memref(%arg0: memref<24x12xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%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
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -64,7 +64,7 @@ func.func @vectorize_copy_memref(%arg0: memref<100x100xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.copy"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -110,7 +110,7 @@ func.func @vectorize_keep_pad(
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%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
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -158,7 +158,7 @@ func.func @vectorize_pad(
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%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
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 {vectorize_padding} : (!transform.any_op) -> !transform.any_op
}
diff --git a/mlir/test/Dialect/Linalg/vectorization.mlir b/mlir/test/Dialect/Linalg/vectorization.mlir
index 933c9c78649886..465558721f969e 100644
--- a/mlir/test/Dialect/Linalg/vectorization.mlir
+++ b/mlir/test/Dialect/Linalg/vectorization.mlir
@@ -13,7 +13,7 @@ func.func @contraction_dot(%A: memref<1584xf32>, %B: memref<1584xf32>, %C: memre
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.dot"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -32,7 +32,7 @@ func.func @contraction_matvec(%A: memref<1584x1584xf32>, %B: memref<1584xf32>, %
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.matvec"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -50,7 +50,7 @@ func.func @contraction_matmul(%A: memref<1584x1584xf32>, %B: memref<1584x1584xf3
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%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
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -69,7 +69,7 @@ func.func @contraction_batch_matmul(%A: memref<1584x1584x1584xf32>, %B: memref<1
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.batch_matmul"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -109,7 +109,7 @@ func.func @vectorization_test(%A: memref<8x16xf32>, %B: memref<16x32xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -149,7 +149,7 @@ func.func @generic_output_transpose(%A: memref<8x16xf32>, %B: memref<16x32xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -176,7 +176,7 @@ func.func @generic_interchanged_transpose(%arg0: tensor<12x128x32xf32>) -> tenso
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -216,7 +216,7 @@ func.func @vectorization_test_integer(%A: memref<8x16xi32>, %B: memref<16x32xi32
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -236,7 +236,7 @@ func.func @vectorization_test_2(%A: memref<8x16xf32>, %B: memref<16x32xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%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
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -260,7 +260,7 @@ func.func @test_vectorize_scalar_input(%A : memref<8x16xf32>, %arg0 : f32) {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -284,7 +284,7 @@ func.func @test_do_not_vectorize_unsupported_element_types(%A : memref<8x16xcomp
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -329,7 +329,7 @@ func.func @vectorize_affine_apply(%arg0: tensor<5xf32>, %arg3: index) -> tensor<
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
@@ -346,7 +346,7 @@ func.func @test_vectorize_fill(%A : memref<8x16xf32>, %arg0 : f32) {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.fill"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -364,7 +364,7 @@ func.func @test_vectorize_fill_scalar(%A : memref<f32>, %arg0 : f32) {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.fill"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -381,7 +381,7 @@ func.func @test_vectorize_copy(%A : memref<8x16xf32>, %B : memref<8x16xf32>) {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["memref.copy"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -401,7 +401,7 @@ func.func @test_vectorize_copy_scalar(%A : memref<f32>, %B : memref<f32>) {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["memref.copy"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -417,7 +417,7 @@ func.func @test_vectorize_copy_complex(%A : memref<8x16xcomplex<f32>>, %B : memr
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["memref.copy"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -445,7 +445,7 @@ func.func @test_vectorize_trailing_index(%arg0: memref<1x2x4x8xindex>) {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -474,7 +474,7 @@ func.func @test_vectorize_inner_index(%arg0: memref<1x2x4x8xindex>) {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -559,7 +559,7 @@ func.func @generic_vectorize(%arg0: memref<4x256xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -650,7 +650,7 @@ func.func @generic_vectorize_tensor(%arg0: tensor<4x256xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -694,7 +694,7 @@ func.func @generic_vectorize_broadcast_transpose(
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -737,7 +737,7 @@ func.func @vectorization_transpose(%A: memref<14x7xf32>, %B: memref<16x14xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -769,7 +769,7 @@ func.func @matmul_tensors(
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%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
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -798,7 +798,7 @@ func.func @pad_static(%arg0: tensor<2x?x2xf32>, %pad_value: f32) -> tensor<2x3x4
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op
}
@@ -827,7 +827,7 @@ func.func @pad_static_source(%arg0: tensor<2x5x2xf32>, %pad_value: f32) -> tenso
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op
}
@@ -864,7 +864,7 @@ func.func @pad_static_dynamic(%arg0: tensor<1x2x2x?xf32>, %low: index, %high: in
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op
}
@@ -884,7 +884,7 @@ func.func @pad_static_complex(%arg0: tensor<2x5x2xcomplex<f32>>, %pad_value: com
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op
}
@@ -914,7 +914,7 @@ func.func @pad_and_transfer_read(%arg0: tensor<5x6xf32>) -> vector<7x9xf32> {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op
}
@@ -947,7 +947,7 @@ func.func @pad_and_transfer_write_static(
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 { vectorize_padding } : (!transform.any_op) -> !transform.any_op
}
@@ -984,7 +984,7 @@ func.func @pad_and_transfer_write_dynamic_static(
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 { vectorize_padding } : (!transform.any_op) -> !transform.any_op
}
@@ -1018,7 +1018,7 @@ func.func @pad_and_insert_slice_source(
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 { vectorize_padding } : (!transform.any_op) -> !transform.any_op
}
@@ -1046,7 +1046,7 @@ func.func @pad_and_insert_slice_dest(
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op
}
@@ -1083,7 +1083,7 @@ func.func @pad_tensor_non_const_pad_value(%arg0: tensor<5x6xf32>) -> tensor<12x1
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 { vectorize_padding } : (!transform.any_op) -> !transform.any_op
}
@@ -1118,7 +1118,7 @@ func.func @sum_exp(%input: tensor<4x16x8xf32>, %output: tensor<4x16xf32>)
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op
}
@@ -1163,7 +1163,7 @@ func.func @sum_exp_2(%input: tensor<3x2xf32>, %input_2: tensor<5x4xf32>, %output
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -1193,7 +1193,7 @@ func.func @red_max_2d(%arg0: tensor<4x4xf32>) -> tensor<4xf32> {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 { vectorize_padding } : (!transform.any_op) -> !transform.any_op
}
@@ -1224,7 +1224,7 @@ func.func @red_min_2d(%arg0: tensor<4x4xf32>) -> tensor<4xf32> {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op
}
@@ -1254,7 +1254,7 @@ func.func @red_mul_2d(%arg0: tensor<4x4xf32>) -> tensor<4xf32> {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op
}
@@ -1284,7 +1284,7 @@ func.func @red_or_2d(%arg0: tensor<4x4xi1>) -> tensor<4xi1> {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op
}
@@ -1314,7 +1314,7 @@ func.func @red_and_2d(%arg0: tensor<4x4xi1>) -> tensor<4xi1> {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op
}
@@ -1344,7 +1344,7 @@ func.func @red_xor_2d(%arg0: tensor<4x4xi1>) -> tensor<4xi1> {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op
}
@@ -1378,7 +1378,7 @@ func.func @explicit_broadcast(%arg0: tensor<4x4xf32>, %arg1: tensor<4x1xf32>) ->
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op
}
@@ -1416,11 +1416,11 @@ func.func @fused_broadcast_red_2d(%arg0: tensor<4x4xf32>, %arg1: tensor<4x1xf32>
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.fill"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op
}
@@ -1463,7 +1463,7 @@ func.func @reduce_1d(%arg0: tensor<32xf32>) -> tensor<f32> {
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -1494,7 +1494,7 @@ func.func @not_projected_permutation(%arg0: tensor<8x8xf32>) -> tensor<6x6x3x3xf
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -1533,7 +1533,7 @@ func.func @mixed_parallel_reduced_results(%arg0 : tensor<2x4x8xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op
}
@@ -1557,7 +1557,7 @@ func.func @vectorize_map(%arg0: memref<64xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.map"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -1576,7 +1576,7 @@ func.func @vectorize_transpose(%arg0: memref<16x32x64xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.transpose"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -1599,7 +1599,7 @@ func.func @vectorize_reduce(%arg0: memref<16x32x64xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.reduce"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -1666,7 +1666,7 @@ func.func @wrong_reduction_detection(%input: tensor<120x64xf32>) -> tensor<120x6
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -1695,7 +1695,7 @@ func.func @tensor_size0(%arg0: tensor<0xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -1716,7 +1716,7 @@ func.func @test_masked_pad_static_dynamic(%arg0: tensor<1x2x2x?xf32>, %low: inde
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op
}
@@ -1738,7 +1738,7 @@ func.func @zero_dim_tensor(%input: tensor<f32>, %output: tensor<f32>) -> tensor<
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op
}
@@ -1775,7 +1775,7 @@ func.func @multi_output_generic_
diff erent_perm_maps(%in0: tensor<4x1xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%3 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op
+ %4 = get_parent_op %3 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op
}
diff --git a/mlir/test/Dialect/Linalg/vectorize-tensor-extract.mlir b/mlir/test/Dialect/Linalg/vectorize-tensor-extract.mlir
index baf0894fd4853e..cf1c33bf5eec85 100644
--- a/mlir/test/Dialect/Linalg/vectorize-tensor-extract.mlir
+++ b/mlir/test/Dialect/Linalg/vectorize-tensor-extract.mlir
@@ -30,7 +30,7 @@ func.func @vectorize_1d_tensor_extract(%arg0: tensor<3xf32>, %arg1: tensor<4x3xi
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
@@ -66,7 +66,7 @@ func.func @vectorize_nd_tensor_extract_constant_idx(%arg0: tensor<3x3xf32>, %arg
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
@@ -105,7 +105,7 @@ func.func @vectorize_nd_tensor_extract_transfer_read_basic(%arg0: tensor<3x3x3xf
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
@@ -157,7 +157,7 @@ func.func @vectorize_nd_tensor_extract_transfer_read_complex(%6: tensor<45x80x16
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
@@ -205,7 +205,7 @@ func.func @vectorize_nd_tensor_extract_index_from_tensor(%arg0: tensor<3x3xf32>,
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
// -----
@@ -249,7 +249,7 @@ func.func @vectorize_nd_tensor_extract_contiguous_and_gather(%arg0: tensor<6xf32
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
@@ -291,7 +291,7 @@ func.func @vectorize_nd_tensor_extract_with_affine_apply_contiguous(%6: tensor<8
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
@@ -333,7 +333,7 @@ func.func @vectorize_nd_tensor_extract_with_tensor_extract(%input_1: tensor<1x20
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
@@ -377,7 +377,7 @@ func.func @vectorize_nd_tensor_extract_with_affine_apply_gather(%6: tensor<80x16
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
@@ -417,7 +417,7 @@ func.func @vectorize_nd_tensor_extract_with_maxsi_gather(%arg0: tensor<80x16xf32
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
@@ -457,7 +457,7 @@ func.func @vectorize_nd_tensor_extract_with_maxsi_contiguous(%arg0: tensor<80x16
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
@@ -496,6 +496,6 @@ func.func @vectorize_nd_tensor_extract_block_arg(%arg0: tensor<5x6xf32>, %arg1:
transform.sequence failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op
}
diff --git a/mlir/test/Dialect/Transform/expensive-checks.mlir b/mlir/test/Dialect/Transform/expensive-checks.mlir
index 2e6318918c44e9..fef857bcef029d 100644
--- a/mlir/test/Dialect/Transform/expensive-checks.mlir
+++ b/mlir/test/Dialect/Transform/expensive-checks.mlir
@@ -19,7 +19,7 @@ transform.with_pdl_patterns {
^bb1(%arg1: !transform.any_op):
// expected-note @below {{handle to invalidated ops}}
%0 = pdl_match @return in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
// expected-note @below {{invalidated by this transform op that consumes its operand #0}}
test_consume_operand %1 : !transform.any_op
// expected-error @below {{op uses a handle invalidated by a previously executed transform op}}
diff --git a/mlir/test/Dialect/Transform/selective-targeting.mlir b/mlir/test/Dialect/Transform/selective-targeting.mlir
index 13b0a1f404288e..5bf47fd75d3d20 100644
--- a/mlir/test/Dialect/Transform/selective-targeting.mlir
+++ b/mlir/test/Dialect/Transform/selective-targeting.mlir
@@ -79,7 +79,7 @@ transform.with_pdl_patterns {
%0 = pdl_match @pdl_target_attrA in %arg1 : (!transform.any_op) -> !transform.any_op
transform.structured.tile %0 [4, 4, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op)
%1 = pdl_match @pdl_target_attrC in %arg1 : (!transform.any_op) -> !transform.any_op
- %2 = transform.get_closest_isolated_parent %1 : (!transform.any_op) -> !transform.any_op
+ %2 = get_parent_op %1 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
transform.structured.vectorize %2 : (!transform.any_op) -> !transform.any_op
}
}
@@ -124,7 +124,7 @@ transform.with_pdl_patterns {
transform.sequence %arg0 : !transform.any_op failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = pdl_match @pdl_target in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op
}
}
diff --git a/mlir/test/Dialect/Transform/test-interpreter.mlir b/mlir/test/Dialect/Transform/test-interpreter.mlir
index b7cfca0ed5b572..36a6ff40f0b3a2 100644
--- a/mlir/test/Dialect/Transform/test-interpreter.mlir
+++ b/mlir/test/Dialect/Transform/test-interpreter.mlir
@@ -107,7 +107,7 @@ transform.with_pdl_patterns {
transform.sequence %arg0 : !transform.any_op failures(propagate) {
^bb1(%arg1: !transform.any_op):
%f = pdl_match @const in %arg1 : (!transform.any_op) -> !transform.any_op
- %m = get_closest_isolated_parent %f : (!transform.any_op) -> !transform.any_op
+ %m = get_parent_op %f {isolated_from_above} : (!transform.any_op) -> !transform.any_op
test_print_remark_at_operand %m, "parent function" : !transform.any_op
}
}
@@ -169,7 +169,7 @@ transform.with_pdl_patterns {
transform.sequence %arg0 : !transform.any_op failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = pdl_match @match_call in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
// expected-error @below {{all alternatives failed}}
transform.alternatives %1 : !transform.any_op {
^bb2(%arg2: !transform.any_op):
@@ -202,7 +202,7 @@ transform.with_pdl_patterns {
transform.sequence %arg0 : !transform.any_op failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = pdl_match @match_call in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
transform.alternatives %1 : !transform.any_op {
^bb2(%arg2: !transform.any_op):
%2 = transform.pdl_match @match_call in %arg2 : (!transform.any_op) -> !transform.any_op
@@ -243,7 +243,7 @@ transform.with_pdl_patterns {
transform.sequence %arg0 : !transform.any_op failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = pdl_match @match_call in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
transform.alternatives %1 : !transform.any_op {
^bb2(%arg2: !transform.any_op):
%2 = transform.pdl_match @match_call in %arg2 : (!transform.any_op) -> !transform.any_op
@@ -279,7 +279,7 @@ transform.with_pdl_patterns {
transform.sequence %arg0 : !transform.any_op failures(propagate) {
^bb1(%arg1: !transform.any_op):
%0 = pdl_match @match_call in %arg1 : (!transform.any_op) -> !transform.any_op
- %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op
+ %1 = get_parent_op %0 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
%2 = transform.alternatives %1 : !transform.any_op -> !transform.any_op {
^bb2(%arg2: !transform.any_op):
%3 = transform.pdl_match @match_call in %arg2 : (!transform.any_op) -> !transform.any_op
@@ -1826,3 +1826,37 @@ module {
transform.apply_licm to %arg1 : !transform.any_op
}
}
+
+// -----
+
+func.func @get_parent_op() {
+ // expected-remark @below{{found test.foo parent}}
+ "test.foo"() ({
+ // expected-remark @below{{direct parent}}
+ "test.bar"() ({
+ "test.qux"() : () -> ()
+ "test.qux"() : () -> ()
+ }) : () -> ()
+ }) : () -> ()
+}
+
+transform.sequence failures(propagate) {
+^bb1(%arg1: !transform.any_op):
+ %0 = transform.structured.match ops{["test.qux"]} in %arg1 : (!transform.any_op) -> !transform.any_op
+
+ // Get parent by name.
+ %1 = transform.get_parent_op %0 {op_name = "test.foo"} : (!transform.any_op) -> !transform.any_op
+ test_print_remark_at_operand %1, "found test.foo parent" : !transform.any_op
+
+ // Get immediate parent.
+ %2 = transform.get_parent_op %0 : (!transform.any_op) -> !transform.any_op
+ test_print_remark_at_operand %2, "direct parent" : !transform.any_op
+ // expected-remark @below{{2}}
+ test_print_number_of_associated_payload_ir_ops %2 : !transform.any_op
+
+ // Deduplicate results.
+ %3 = transform.structured.match ops{["test.qux"]} in %arg1 : (!transform.any_op) -> !transform.any_op
+ %4 = transform.get_parent_op %3 {deduplicate} : (!transform.any_op) -> !transform.any_op
+ // expected-remark @below{{1}}
+ test_print_number_of_associated_payload_ir_ops %4 : !transform.any_op
+}
diff --git a/mlir/test/Dialect/Vector/transform-vector.mlir b/mlir/test/Dialect/Vector/transform-vector.mlir
index ee2c80a33834c6..d050885ed30fc1 100644
--- a/mlir/test/Dialect/Vector/transform-vector.mlir
+++ b/mlir/test/Dialect/Vector/transform-vector.mlir
@@ -18,7 +18,7 @@ transform.sequence failures(propagate) {
%0 = transform.structured.match ops{["linalg.matmul"]} in %module_op : (!transform.any_op) -> !transform.any_op
%1, %loops:3 = transform.structured.tile %0 [8, 4, 2]
: (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op)
- %2 = get_closest_isolated_parent %1 : (!transform.any_op) -> !transform.any_op
+ %2 = get_parent_op %1 {isolated_from_above} : (!transform.any_op) -> !transform.any_op
transform.structured.vectorize %2 : (!transform.any_op) -> !transform.any_op
%b = transform.bufferization.one_shot_bufferize
layout{IdentityLayoutMap} %module_op
diff --git a/mlir/test/python/dialects/transform.py b/mlir/test/python/dialects/transform.py
index ca6499b5706d1a..668e0040d6b9c5 100644
--- a/mlir/test/python/dialects/transform.py
+++ b/mlir/test/python/dialects/transform.py
@@ -94,67 +94,67 @@ def testSequenceOpWithExtras():
@run
def testNestedSequenceOpWithExtras():
- sequence = transform.SequenceOp(
+ sequence = transform.SequenceOp(
transform.FailurePropagationMode.PROPAGATE,
[],
transform.AnyOpType.get(),
[transform.AnyOpType.get(), transform.OperationType.get("foo.bar")],
)
- with InsertionPoint(sequence.body):
- nested = transform.SequenceOp(
+ with InsertionPoint(sequence.body):
+ nested = transform.SequenceOp(
transform.FailurePropagationMode.PROPAGATE,
[],
sequence.bodyTarget,
sequence.bodyExtraArgs,
)
- with InsertionPoint(nested.body):
- transform.YieldOp()
- transform.YieldOp()
- # CHECK-LABEL: TEST: testNestedSequenceOpWithExtras
- # CHECK: transform.sequence failures(propagate)
- # CHECK: ^{{.*}}(%[[ARG0:.*]]: !transform.any_op, %[[ARG1:.*]]: !transform.any_op, %[[ARG2:.*]]: !transform.op<"foo.bar">):
- # CHECK: sequence %[[ARG0]], %[[ARG1]], %[[ARG2]] : (!transform.any_op, !transform.any_op, !transform.op<"foo.bar">)
+ with InsertionPoint(nested.body):
+ transform.YieldOp()
+ transform.YieldOp()
+ # CHECK-LABEL: TEST: testNestedSequenceOpWithExtras
+ # CHECK: transform.sequence failures(propagate)
+ # CHECK: ^{{.*}}(%[[ARG0:.*]]: !transform.any_op, %[[ARG1:.*]]: !transform.any_op, %[[ARG2:.*]]: !transform.op<"foo.bar">):
+ # CHECK: sequence %[[ARG0]], %[[ARG1]], %[[ARG2]] : (!transform.any_op, !transform.any_op, !transform.op<"foo.bar">)
@run
def testTransformPDLOps():
- withPdl = transform_pdl.WithPDLPatternsOp(transform.AnyOpType.get())
- with InsertionPoint(withPdl.body):
- sequence = transform.SequenceOp(
- transform.FailurePropagationMode.PROPAGATE,
- [transform.AnyOpType.get()],
- withPdl.bodyTarget,
- )
- with InsertionPoint(sequence.body):
- match = transform_pdl.PDLMatchOp(
- transform.AnyOpType.get(), sequence.bodyTarget, "pdl_matcher"
- )
- transform.YieldOp(match)
- # CHECK-LABEL: TEST: testTransformPDLOps
- # CHECK: transform.with_pdl_patterns {
- # CHECK: ^{{.*}}(%[[ARG0:.+]]: !transform.any_op):
- # CHECK: = sequence %[[ARG0]] : !transform.any_op -> !transform.any_op failures(propagate) {
- # CHECK: ^{{.*}}(%[[ARG1:.+]]: !transform.any_op):
- # CHECK: %[[RES:.+]] = pdl_match @pdl_matcher in %[[ARG1]]
- # CHECK: yield %[[RES]] : !transform.any_op
- # CHECK: }
- # CHECK: }
+ withPdl = transform_pdl.WithPDLPatternsOp(transform.AnyOpType.get())
+ with InsertionPoint(withPdl.body):
+ sequence = transform.SequenceOp(
+ transform.FailurePropagationMode.PROPAGATE,
+ [transform.AnyOpType.get()],
+ withPdl.bodyTarget,
+ )
+ with InsertionPoint(sequence.body):
+ match = transform_pdl.PDLMatchOp(
+ transform.AnyOpType.get(), sequence.bodyTarget, "pdl_matcher"
+ )
+ transform.YieldOp(match)
+ # CHECK-LABEL: TEST: testTransformPDLOps
+ # CHECK: transform.with_pdl_patterns {
+ # CHECK: ^{{.*}}(%[[ARG0:.+]]: !transform.any_op):
+ # CHECK: = sequence %[[ARG0]] : !transform.any_op -> !transform.any_op failures(propagate) {
+ # CHECK: ^{{.*}}(%[[ARG1:.+]]: !transform.any_op):
+ # CHECK: %[[RES:.+]] = pdl_match @pdl_matcher in %[[ARG1]]
+ # CHECK: yield %[[RES]] : !transform.any_op
+ # CHECK: }
+ # CHECK: }
@run
-def testGetClosestIsolatedParentOp():
- sequence = transform.SequenceOp(
- transform.FailurePropagationMode.PROPAGATE, [], transform.AnyOpType.get()
+def testGetParentOp():
+ sequence = transform.SequenceOp(
+ transform.FailurePropagationMode.PROPAGATE, [], transform.AnyOpType.get()
+ )
+ with InsertionPoint(sequence.body):
+ transform.GetParentOp(
+ transform.AnyOpType.get(), sequence.bodyTarget, isolated_from_above=True
)
- with InsertionPoint(sequence.body):
- transform.GetClosestIsolatedParentOp(
- transform.AnyOpType.get(), sequence.bodyTarget
- )
- transform.YieldOp()
- # CHECK-LABEL: TEST: testGetClosestIsolatedParentOp
- # CHECK: transform.sequence
- # CHECK: ^{{.*}}(%[[ARG1:.+]]: !transform.any_op):
- # CHECK: = get_closest_isolated_parent %[[ARG1]]
+ transform.YieldOp()
+ # CHECK-LABEL: TEST: testGetParentOp
+ # CHECK: transform.sequence
+ # CHECK: ^{{.*}}(%[[ARG1:.+]]: !transform.any_op):
+ # CHECK: = get_parent_op %[[ARG1]] {isolated_from_above}
@run
More information about the Mlir-commits
mailing list