[mlir][transform] failure propagation mode in sequence
authorAlex Zinenko <zinenko@google.com>
Fri, 12 Aug 2022 13:53:46 +0000 (13:53 +0000)
committerAlex Zinenko <zinenko@google.com>
Fri, 12 Aug 2022 15:31:22 +0000 (15:31 +0000)
Introduce two different failure propagation mode in the Transform
dialect's Sequence operation. These modes specify whether silenceable
errors produced by nested ops are immediately propagated, thus stopping
the sequence, or suppressed. The latter is useful in end-to-end
transform application scenarios where the user cannot correct the
transformation, but it is robust enough to silenceable failures. It
can be combined with the "alternatives" operation. There is
intentionally no default value to avoid favoring one mode over the
other.

Downstreams can update their tests using:

  S='s/sequence \(%.*\) {/sequence \1 failures(propagate) {/'
  T='s/sequence {/sequence failures(propagate) {/'
  git grep -l transform.sequence | xargs sed -i -e "$S"
  git grep -l transform.sequence | xargs sed -i -e "$T"

Reviewed By: nicolasvasilache

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

46 files changed:
mlir/include/mlir/Dialect/Transform/IR/CMakeLists.txt
mlir/include/mlir/Dialect/Transform/IR/TransformAttrs.td [new file with mode: 0644]
mlir/include/mlir/Dialect/Transform/IR/TransformDialect.h
mlir/include/mlir/Dialect/Transform/IR/TransformOps.h
mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
mlir/lib/Dialect/Transform/IR/TransformDialect.cpp
mlir/lib/Dialect/Transform/IR/TransformOps.cpp
mlir/python/mlir/dialects/_transform_ops_ext.py
mlir/python/mlir/dialects/transform/__init__.py
mlir/test/Dialect/Bufferization/Transforms/transform-ops.mlir
mlir/test/Dialect/Linalg/multisize-tiling-full.mlir
mlir/test/Dialect/Linalg/promote.mlir
mlir/test/Dialect/Linalg/promotion_options.mlir
mlir/test/Dialect/Linalg/tile-to-foreach-thread.mlir
mlir/test/Dialect/Linalg/transform-op-decompose.mlir
mlir/test/Dialect/Linalg/transform-op-fuse-into-containing.mlir
mlir/test/Dialect/Linalg/transform-op-fuse.mlir
mlir/test/Dialect/Linalg/transform-op-generalize.mlir
mlir/test/Dialect/Linalg/transform-op-interchange.mlir
mlir/test/Dialect/Linalg/transform-op-match.mlir
mlir/test/Dialect/Linalg/transform-op-multitile-sizes.mlir
mlir/test/Dialect/Linalg/transform-op-pad.mlir
mlir/test/Dialect/Linalg/transform-op-scalarize.mlir
mlir/test/Dialect/Linalg/transform-op-split-reduction-by-scaling.mlir
mlir/test/Dialect/Linalg/transform-op-split-reduction.mlir
mlir/test/Dialect/Linalg/transform-op-split.mlir
mlir/test/Dialect/Linalg/transform-op-tile.mlir
mlir/test/Dialect/Linalg/transform-op-vectorize.mlir
mlir/test/Dialect/Linalg/transform-ops-invalid.mlir
mlir/test/Dialect/Linalg/transform-ops.mlir
mlir/test/Dialect/Linalg/transform-promotion.mlir
mlir/test/Dialect/Linalg/transform-tile-and-fuse.mlir
mlir/test/Dialect/SCF/transform-ops.mlir
mlir/test/Dialect/Transform/check-use-after-free.mlir
mlir/test/Dialect/Transform/expensive-checks.mlir
mlir/test/Dialect/Transform/ops-invalid.mlir
mlir/test/Dialect/Transform/ops.mlir
mlir/test/Dialect/Transform/selective-targeting.mlir
mlir/test/Dialect/Transform/test-interpreter.mlir
mlir/test/Dialect/Transform/transform-state-extension.mlir
mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp
mlir/test/python/.style.yapf [new file with mode: 0644]
mlir/test/python/dialects/transform.py
mlir/test/python/dialects/transform_loop_ext.py
mlir/test/python/dialects/transform_structured_ext.py
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

index be6cf1f..7039b23 100644 (file)
@@ -8,6 +8,12 @@ mlir_tablegen(TransformDialect.cpp.inc -gen-dialect-defs -dialect=transform)
 add_public_tablegen_target(MLIRTransformDialectIncGen)
 add_dependencies(mlir-headers MLIRTransformDialectIncGen)
 
+set(LLVM_TARGET_DEFINITIONS TransformAttrs.td)
+mlir_tablegen(TransformDialectEnums.h.inc -gen-enum-decls)
+mlir_tablegen(TransformDialectEnums.cpp.inc -gen-enum-defs)
+add_public_tablegen_target(MLIRTransformDialectEnumIncGen)
+add_dependencies(mlir-headers MLIRTransformDialectEnumIncGen)
+
 add_mlir_dialect(TransformOps transform)
 add_mlir_doc(TransformOps TransformOps Dialects/ -gen-dialect-doc -dialect=transform)
 
diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformAttrs.td b/mlir/include/mlir/Dialect/Transform/IR/TransformAttrs.td
new file mode 100644 (file)
index 0000000..652f714
--- /dev/null
@@ -0,0 +1,23 @@
+//===- TransformAttrs.td - Transform dialect attributes ----*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_DIALECT_TRANSFORM_IR_TRANSFORMATTRS
+#define MLIR_DIALECT_TRANSFORM_IR_TRANSFORMATTRS
+
+include "mlir/IR/EnumAttr.td"
+
+def PropagateFailuresCase : I32EnumAttrCase<"Propagate", 1, "propagate">;
+def SuppressFailuresCase : I32EnumAttrCase<"Suppress", 2, "suppress">;
+
+def FailurePropagationMode : I32EnumAttr<
+    "FailurePropagationMode", "Silenceable error propagation policy",
+    [PropagateFailuresCase, SuppressFailuresCase]> {
+  let cppNamespace = "::mlir::transform";
+}
+
+#endif  // MLIR_DIALECT_TRANSFORM_IR_TRANSFORMATTRS
index 1f32a59..aea8f4b 100644 (file)
@@ -193,4 +193,6 @@ public:
 } // namespace transform
 } // namespace mlir
 
+#include "mlir/Dialect/Transform/IR/TransformDialectEnums.h.inc"
+
 #endif // MLIR_DIALECT_TRANSFORM_IR_TRANSFORMDIALECT_H
index 70ef677..29fa720 100644 (file)
 #include "mlir/IR/SymbolTable.h"
 #include "mlir/Interfaces/ControlFlowInterfaces.h"
 
+namespace mlir {
+namespace transform {
+enum class FailurePropagationMode : uint32_t;
+class FailurePropagationModeAttr;
+} // namespace transform
+} // namespace mlir
+
 #define GET_OP_CLASSES
 #include "mlir/Dialect/Transform/IR/TransformOps.h.inc"
 
index 1f28b33..361973d 100644 (file)
@@ -13,6 +13,7 @@ include "mlir/Interfaces/ControlFlowInterfaces.td"
 include "mlir/IR/OpAsmInterface.td"
 include "mlir/IR/SymbolInterfaces.td"
 include "mlir/Dialect/PDL/IR/PDLTypes.td"
+include "mlir/Dialect/Transform/IR/TransformAttrs.td"
 include "mlir/Dialect/Transform/IR/TransformDialect.td"
 include "mlir/Dialect/Transform/IR/TransformEffects.td"
 include "mlir/Dialect/Transform/IR/TransformInterfaces.td"
@@ -270,9 +271,20 @@ def SequenceOp : TransformDialectOp<"sequence",
     The transformations indicated by the sequence are applied in order of their
     appearance. Each value produced by a transformation within the sequence
     corresponds to an operation or a group of operations in the payload IR.
-    During application, if any transformation in the sequence fails, the entire
-    sequence fails immediately leaving the payload IR in potentially invalid
-    state, i.e., this operation offers no transformation rollback capabilities.
+    The behavior of the operation when a nested transformation produces a
+    silenceable error is controlled by the `failure_propagation_mode` attribute.
+    When set to `propagate`, the failure of any nested transformation in the
+    sequence implies immediate failure of the entire sequence with a silenceable
+    error, and no further transformation is attempted. When set to `suppress`,
+    silenceable errors in nested operations are ignored and further
+    transformations are applied. Beware that even silenceable errors may leave
+    the payload IR in a state unsuitable for further transformations. It is
+    the responsibility of the caller to ensure the following transformations
+    are robust enough when errors are suppressed. Definite errors reported by
+    nested transformations abort the sequence regardless of the propagation
+    mode. The set of modes may be extended in the future, e.g., to collect
+    silenceable errors and report them after attempting all transformations in
+    the sequence.
 
     The entry block of this operation has a single argument that maps to either
     the operand if provided or the top-level container operation of the payload
@@ -281,12 +293,13 @@ def SequenceOp : TransformDialectOp<"sequence",
     another sequence.
   }];
 
-  let arguments = (ins Optional<PDL_Operation>:$root);
+  let arguments = (ins FailurePropagationMode:$failure_propagation_mode,
+                       Optional<PDL_Operation>:$root);
   let results = (outs Variadic<AnyType>:$results);
   let regions = (region SizedRegion<1>:$body);
 
   let assemblyFormat =
-    "($root^)? attr-dict-with-keyword regions (`:` type($results)^)?";
+    "($root^)? `failures` `(` $failure_propagation_mode `)` attr-dict-with-keyword regions (`:` type($results)^)?";
 
   let extraClassDeclaration = [{
     /// Allow the dialect prefix to be omitted.
@@ -316,7 +329,7 @@ def WithPDLPatternsOp : TransformDialectOp<"with_pdl_patterns",
         pdl.rewrite %0 with "transform.dialect"
       }
 
-      sequence %arg0 {
+      sequence %arg0 failures(propagate) {
       ^bb0(%arg1: !pdl.operation):
         %1 = pdl_match @my_pattern in %arg1
         // Use %1 as handle
index 203d419..42234ec 100644 (file)
@@ -35,3 +35,5 @@ const llvm::StringMap<PDLConstraintFunction> &
 transform::TransformDialect::getPDLConstraintHooks() const {
   return pdlMatchHooks.getConstraintFunctions();
 }
+
+#include "mlir/Dialect/Transform/IR/TransformDialectEnums.cpp.inc"
index 511b854..ecab661 100644 (file)
@@ -489,8 +489,14 @@ transform::SequenceOp::apply(transform::TransformResults &results,
   for (Operation &transform : getBodyBlock()->without_terminator()) {
     DiagnosedSilenceableFailure result =
         state.applyTransform(cast<TransformOpInterface>(transform));
-    if (!result.succeeded())
+    if (result.isDefiniteFailure())
       return result;
+
+    if (result.isSilenceableFailure()) {
+      if (getFailurePropagationMode() == FailurePropagationMode::Propagate)
+        return result;
+      (void)result.silence();
+    }
   }
 
   // Forward the operation mapping for values yielded from the sequence to the
index e75d6b5..992139f 100644 (file)
@@ -9,6 +9,7 @@ try:
 except ImportError as e:
   raise RuntimeError("Error loading imports from extension module") from e
 
+from argparse import SUPPRESS
 from typing import Optional, overload, Sequence, Union
 
 
@@ -78,22 +79,31 @@ class ReplicateOp:
 class SequenceOp:
 
   @overload
-  def __init__(self, resultsOrRoot: Sequence[Type],
+  def __init__(self, failure_propagation_mode,
+               resultsOrRoot: Sequence[Type],
                optionalRoot: Optional[Union[Operation, Value]]):
     ...
 
   @overload
-  def __init__(self, resultsOrRoot: Optional[Union[Operation, Value]],
-               optionalRoot: NoneType):
+  def __init__(self, failure_propagation_mode,
+               resultsOrRoot: Optional[Union[Operation,
+                                             Value]], optionalRoot: NoneType):
     ...
 
-  def __init__(self, resultsOrRoot=None, optionalRoot=None):
+  def __init__(self, failure_propagation_mode, resultsOrRoot=None, optionalRoot=None):
     results = resultsOrRoot if isinstance(resultsOrRoot, Sequence) else []
     root = (
         resultsOrRoot
         if not isinstance(resultsOrRoot, Sequence) else optionalRoot)
     root = _get_op_result_or_value(root) if root else None
-    super().__init__(results_=results, root=root)
+    if not isinstance(failure_propagation_mode, Attribute):
+      failure_propagation_mode_attr = IntegerAttr.get(
+          IntegerType.get_signless(32), failure_propagation_mode._as_int())
+    else:
+      failure_propagation_mode = failure_propagation_mode
+    super().__init__(results_=results,
+                     failure_propagation_mode=failure_propagation_mode_attr,
+                     root=root)
     self.regions[0].blocks.append(pdl.OperationType.get())
 
   @property
index ab4fa56..d4d7127 100644 (file)
@@ -2,4 +2,19 @@
 #  See https://llvm.org/LICENSE.txt for license information.
 #  SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+from enum import Enum
+
+
+class FailurePropagationMode(Enum):
+  """Propagation mode for silenceable errors."""
+  PROPAGATE = 1
+  SUPPRESS = 2
+
+  def _as_int(self):
+    if self is FailurePropagationMode.PROPAGATE:
+      return 1
+
+    assert self is FailurePropagationMode.SUPPRESS
+    return 2
+
 from .._transform_ops_gen import *
index fe7b13e..2927ba6 100644 (file)
@@ -4,7 +4,7 @@
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["func.func"]} in %arg1
       transform.bufferization.one_shot_bufferize %0
@@ -36,7 +36,7 @@ func.func @test_function(%A : tensor<?xf32>, %v : vector<4xf32>) -> (tensor<?xf3
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["func.func"]} in %arg1
       transform.bufferization.one_shot_bufferize %0
@@ -62,7 +62,7 @@ func.func @test_function_analysis(%A : tensor<?xf32>, %v : vector<4xf32>) -> (te
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["func.func"]} in %arg1
       // expected-error @+1 {{bufferization failed}}
@@ -82,7 +82,7 @@ func.func @test_unknown_op_failure() -> (tensor<?xf32>) {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       // %arg1 is the module
       transform.bufferization.one_shot_bufferize %arg1
index 0651e76..cfbac63 100644 (file)
@@ -3,7 +3,7 @@
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
   // This implements a 2D multisize tiling with target sizes [3, 10].
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.generic"]} in %arg1
     %1:3 = transform.structured.multitile_sizes %0 { dimension = 0, target_size = 3}
index cf1283d..beae288 100644 (file)
@@ -70,7 +70,7 @@ func.func @matmul_f32(%A: memref<?xi8>, %M: index, %N: index, %K: index) {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
       %1 = transform.structured.promote %0 { use_alloca }
@@ -143,7 +143,7 @@ func.func @matmul_f64(%A: memref<?xi8>, %M: index, %N: index, %K: index) {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
       %1 = transform.structured.promote %0
@@ -196,7 +196,7 @@ func.func @promote_rank_reducing_subviews(%arg0:  memref<?x?x?x64xf32, #map0>, %
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match interface{LinalgOp} in %arg1
       %1 = transform.structured.promote %0
index fffa29a..bf6e8c1 100644 (file)
@@ -33,7 +33,7 @@ func.func @gemm(%a : memref<?x?xf32>, %b : memref<?x?xf32>, %c : memref<?x?xf32>
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
       %1, %loops:3 = transform.structured.tile %0 [16, 16, 16]
index 8a922fe..ab63ac9 100644 (file)
@@ -34,7 +34,7 @@ module {
 
   transform.with_pdl_patterns {
   ^bb0(%arg0: !pdl.operation):
-    transform.sequence %arg0 {
+    transform.sequence %arg0 failures(propagate) {
     ^bb1(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
       %1:2 = transform.structured.tile_to_foreach_thread_op %0 num_threads [10, 20] (mapped to dims [1, 0])
@@ -80,7 +80,7 @@ func.func @matmul_static(%A: tensor<100x200xf32>, %B: tensor<200x300xf32>, %C: t
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     %1:2 = transform.structured.tile_to_foreach_thread_op %0 num_threads [10, 21]
@@ -128,7 +128,7 @@ func.func @matmul_tile_size_dynamic(%A: tensor<?x?xf32>, %B: tensor<?x?xf32>, %C
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):    
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     %1:2 = transform.structured.tile_to_foreach_thread_op %0 tile_sizes [10, 20]
@@ -171,7 +171,7 @@ func.func @matmul_tile_size_static(%A: tensor<100x200xf32>, %B: tensor<200x300xf
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     %1:2 = transform.structured.tile_to_foreach_thread_op %0 tile_sizes [10, 21]
index 25177eb..988d706 100644 (file)
@@ -40,7 +40,7 @@ func.func @depthwise_conv_2d_nhwc_hwc(%input: tensor<1x1x113x96xf32>, %filter: t
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match interface{LinalgOp} in %arg1
     %1 = transform.structured.decompose %0
index 3d7009f..32f8950 100644 (file)
@@ -43,7 +43,7 @@ module {
 
   transform.with_pdl_patterns {
   ^bb0(%arg0: !pdl.operation):
-    transform.sequence %arg0 {
+    transform.sequence %arg0 failures(propagate) {
     ^bb1(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.fill"]} in %arg1
       %1 = transform.structured.match ops{["scf.foreach_thread"]} in %arg1
@@ -89,7 +89,7 @@ module {
 
   transform.with_pdl_patterns {
   ^bb0(%arg0: !pdl.operation):
-    transform.sequence %arg0 {
+    transform.sequence %arg0 failures(propagate) {
     ^bb1(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.init_tensor"]} in %arg1
       %1 = transform.structured.match ops{["scf.foreach_thread"]} in %arg1
index 7c06229..8c133d7 100644 (file)
@@ -16,7 +16,7 @@ func.func @fuse_unary(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) -> tensor<
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.elemwise_binary"]} in %arg1
     %1, %loops:2 = transform.structured.fuse %0 {tile_sizes = [32, 32], tile_interchange = [0, 1]}
@@ -45,7 +45,7 @@ func.func @fuse_unary(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) -> tensor<
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.elemwise_binary"]} in %arg1
     %1, %loops:2 = transform.structured.fuse %0 {tile_sizes = [32, 32], tile_interchange = [0, 1]}
@@ -88,7 +88,7 @@ func.func @interchange_reduction(%input: tensor<12x7x25xf32>) -> tensor<12x25xf3
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.generic"]} in %arg1
     %1, %loops:3 = transform.structured.fuse %0 {tile_sizes = [5, 4, 7], tile_interchange = [0, 2, 1]}
index b052ace..eba44b4 100644 (file)
@@ -12,7 +12,7 @@ func.func @generalize_unary(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) -> t
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.elemwise_unary"]} in %arg1
     %1 = transform.structured.generalize %0
index 5555b7c..f67f966 100644 (file)
@@ -20,7 +20,7 @@ func.func @interchange_generic(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) -
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.generic"]} in %arg1
     transform.structured.interchange %0 { iterator_interchange = [1, 0]}
@@ -37,7 +37,7 @@ func.func @interchange_matmul(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>, %a
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     // expected-error @below {{transform applied to the wrong op kind}}
index 002f142..9e2341b 100644 (file)
@@ -11,7 +11,7 @@ func.func @bar() {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %match_name = transform.structured.match ops{["arith.constant"]} in %arg1
     transform.test_print_remark_at_operand %match_name, "matched op name"
index a13235d..5ee342b 100644 (file)
@@ -4,7 +4,7 @@
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
       transform.structured.multitile_sizes %0 { target_size = 3, dimension = 0 }
@@ -31,7 +31,7 @@ func.func @multitile_sizes_static(
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
       transform.structured.multitile_sizes %0 { target_size = 3, divisor = 2, dimension = 0 }
index e3aba61..d2d72cd 100644 (file)
@@ -33,7 +33,7 @@ func.func @static_sizes_output_divisible(%arg0: tensor<24x12xf32>,
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     %1 = transform.structured.pad %0 {padding_values=[0.0 : f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2], pack_paddings=[1, 1, 0]}
@@ -52,7 +52,7 @@ func.func @pad(%arg0: tensor<24x12xf32>,
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     // expected-error @below {{op expects a padding value of type 'f32', got 0 : i32}}
@@ -72,7 +72,7 @@ func.func @pad(%arg0: tensor<24x12xf32>,
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     // expected-error @below {{expects a padding that parses to 'f32', got "foo"}}
@@ -93,7 +93,7 @@ func.func @pad(%arg0: tensor<24x12xf32>,
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     // This error is silenceable and is not reported by this transform
index b57bcc2..04cefa2 100644 (file)
@@ -12,7 +12,7 @@ func.func @scalarize(%arg0: tensor<24x12xf32>,
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     %1, %loops = transform.structured.tile %0 [10, 0, 0]
index e7d4bd7..a6e9de2 100644 (file)
@@ -20,7 +20,7 @@ func.func @matmul_split(%A : tensor<?x256xf32>, %B: tensor<256x32xf32>, %C: tens
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     %1:4 = transform.structured.split_reduction %0 
index 732574c..868dcfb 100644 (file)
@@ -19,7 +19,7 @@ func.func @matmul_split(%A : tensor<16x256xf32>, %B: tensor<256x32xf32>, %C: ten
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     %1:4 = transform.structured.split_reduction %0 { split_factor = 4, insert_split_dimension = 2}
index 9a22d3a..ebf3b25 100644 (file)
@@ -2,7 +2,7 @@
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.generic"]} in %arg1
     %1:2 = transform.structured.split %0 after 42 { dimension = 0 }
@@ -76,7 +76,7 @@ func.func @one_d_static_overflow(%arg0: tensor<10xf32>, %arg1: tensor<10xf32>) -
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.generic"]} in %arg1
     %1 = transform.structured.match ops{["func.call"]} in %arg1
@@ -127,7 +127,7 @@ func.func @dynamic(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.generic"]} in %arg1
     %1:2 = transform.structured.split %0 after 4 { dimension = 0}
@@ -185,7 +185,7 @@ func.func @two_d(%arg0: tensor<10x34xf32>,
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb1(%arg1: !pdl.operation):
   // expected-error @below {{expects either a dynamic or a static split point to be provided}}
   %0:2 = "transform.structured.split"(%arg1) { dimension = 1, static_split_point = -1 } : (!pdl.operation) -> (!pdl.operation, !pdl.operation)
@@ -195,7 +195,7 @@ transform.sequence {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.generic"]} in %arg1
     %1 = transform.structured.match ops{["func.call"]} in %arg1
@@ -224,7 +224,7 @@ func.func @dynamic(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.generic"]} in %arg1
     %1 = transform.structured.match ops{["func.call"]} in %arg1
@@ -258,7 +258,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["func.return"]} in %arg1
     // expected-error @below {{only applies to structured ops}}
@@ -282,7 +282,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.generic"]} in %arg1
     // expected-error @below {{dimension 1 does not exist in target op}}
index b0d8179..69e654c 100644 (file)
@@ -2,7 +2,7 @@
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
       %1, %loops:3 = transform.structured.tile %0 [4, 4, 4]
@@ -41,7 +41,7 @@ func.func @tile_linalg_matmul(
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
       %1 = transform.structured.match ops{["func.call"]} in %arg1
index f2cce8d..b155a9d 100644 (file)
@@ -26,7 +26,7 @@ transform.with_pdl_patterns {
     rewrite %0 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     %1 = get_closest_isolated_parent %0
@@ -75,7 +75,7 @@ func.func @vectorize_keep_pad(
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     %1 = get_closest_isolated_parent %0
@@ -126,7 +126,7 @@ func.func @vectorize_pad(
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     %1 = get_closest_isolated_parent %0
@@ -146,7 +146,7 @@ func.func @vectorize(%arg0: tensor<24x12xf32>,
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
     // expected-error @below {{op requires isolated-from-above targets}}
index 9b80b23..01bb8e8 100644 (file)
@@ -1,6 +1,6 @@
 // RUN: mlir-opt %s --split-input-file --verify-diagnostics
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-error@below {{expects iterator_interchange to be a permutation, found [1, 1]}}
   transform.structured.interchange %arg0 {iterator_interchange = [1, 1]}
@@ -8,7 +8,7 @@ transform.sequence {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-error@below {{expects padding_dimensions to contain positive integers, found [1, -7]}}
   transform.structured.pad %arg0 {padding_dimensions=[1, -7]}
@@ -16,7 +16,7 @@ transform.sequence {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-error@below {{expects pack_paddings to contain booleans (0/1), found [1, 7]}}
   transform.structured.pad %arg0 {pack_paddings=[1, 7]}
@@ -24,7 +24,7 @@ transform.sequence {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-error@below {{expects hoist_paddings to contain positive integers, found [1, -7]}}
   transform.structured.pad %arg0 {hoist_paddings=[1, -7]}
@@ -32,7 +32,7 @@ transform.sequence {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-error@below {{expects transpose_paddings to be a permutation, found [1, 1]}}
   transform.structured.pad %arg0 {transpose_paddings=[[1, 1]]}
index a7d2e1e..898cce7 100644 (file)
@@ -1,6 +1,6 @@
 // RUN: mlir-opt %s | mlir-opt | FileCheck %s
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb1(%arg0: !pdl.operation):
   // CHECK %{{.*}}, %{{.*}}:2 = transform.structured.tile
   %0, %1:2 = transform.structured.tile %arg0 [2, 0, 3]
@@ -12,19 +12,19 @@ transform.sequence {
 // we test the generator.
 //===----------------------------------------------------------------------===//
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb1(%arg0: !pdl.operation):
   // CHECK: transform.structured.pad
   %0 = transform.structured.pad %arg0
 }
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb1(%arg0: !pdl.operation):
   // CHECK: transform.structured.interchange
   %0 = transform.structured.interchange %arg0
 }
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb1(%arg0: !pdl.operation):
   // CHECK: transform.structured.scalarize
   %0 = transform.structured.scalarize %arg0
index abbc435..e2980d3 100644 (file)
@@ -64,7 +64,7 @@ func.func @promote_subview_matmul(%arg0: memref<?x?xf32, offset: ?, strides: [?,
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
       %1 = transform.structured.promote %0 { operands_to_promote = [0, 1, 2], use_full_tiles_by_default }
@@ -127,7 +127,7 @@ func.func @promote_first_subview_matmul(%arg0: memref<?x?xf32, offset: ?, stride
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1
       %1 = transform.structured.promote %0 { operands_to_promote = [0], use_full_tiles_by_default }
@@ -160,7 +160,7 @@ func.func @aligned_promote_fill(%arg0: memref<?x?xf32, offset: ?, strides: [?, 1
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.fill"]} in %arg1
       %1 = transform.structured.promote %0 { operands_to_promote = [1], use_full_tile_buffers = [false, true], alignment = 32}
@@ -194,7 +194,7 @@ func.func @aligned_promote_fill_complex(%arg0: memref<?x?xcomplex<f32>, offset:
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = transform.structured.match ops{["linalg.fill"]} in %arg1
       %1 = transform.structured.promote %0 { operands_to_promote = [1], use_full_tile_buffers = [false, true], alignment = 32}
index 1f6185f..de86adb 100644 (file)
@@ -42,7 +42,7 @@ module {
 
   transform.with_pdl_patterns {
   ^bb0(%arg0: !pdl.operation):
-    transform.sequence %arg0 {
+    transform.sequence %arg0 failures(propagate) {
     ^bb1(%arg1: !pdl.operation):
       // Find the root and all producers.
       %root = transform.structured.match attributes{"__root__"} in %arg1
@@ -102,7 +102,7 @@ module {
 
   transform.with_pdl_patterns {
   ^bb0(%arg0: !pdl.operation):
-    transform.sequence %arg0 {
+    transform.sequence %arg0 failures(propagate) {
     ^bb1(%arg1: !pdl.operation):
       // Find the root and all producers.
       %root = transform.structured.match attributes{"__root__"} in %arg1
index f1ddd24..8fa9807 100644 (file)
@@ -17,7 +17,7 @@ func.func @get_parent_for_op(%arg0: index, %arg1: index, %arg2: index) {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["arith.addi"]} in %arg1
     // CHECK: = transform.loop.get_parent_for
@@ -40,7 +40,7 @@ func.func @get_parent_for_op_no_loop(%arg0: index, %arg1: index) {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["arith.addi"]} in %arg1
     // expected-error @below {{could not find an 'scf.for' parent}}
@@ -82,7 +82,7 @@ func.func @loop_outline_op(%arg0: index, %arg1: index, %arg2: index) {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["arith.addi"]} in %arg1
     %1 = transform.loop.get_parent_for %0
@@ -111,7 +111,7 @@ func.func @loop_outline_op_multi_region() {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["scf.while"]} in %arg1
     // expected-error @below {{failed to outline}}
@@ -142,7 +142,7 @@ func.func @loop_peel_op() {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["arith.addi"]} in %arg1
     %1 = transform.loop.get_parent_for %0
@@ -178,7 +178,7 @@ func.func @loop_pipeline_op(%A: memref<?xf32>, %result: memref<?xf32>) {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["arith.addf"]} in %arg1
     %1 = transform.loop.get_parent_for %0
@@ -205,7 +205,7 @@ func.func @loop_unroll_op() {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.structured.match ops{["arith.addi"]} in %arg1
     %1 = transform.loop.get_parent_for %0
index 6ef865a..71a0156 100644 (file)
@@ -17,7 +17,7 @@ func.func @use_after_free_branching_control_flow() {
     "transform.test_branching_transform_op_terminator"()[^bb3] : () -> ()
   ^bb3:
     // expected-warning @below {{operand #0 may be used after free}}
-    transform.sequence %0 {
+    transform.sequence %0 failures(propagate) {
     ^bb0(%arg0: !pdl.operation):
     }
     "transform.test_branching_transform_op_terminator"() : () -> ()
@@ -46,7 +46,7 @@ func.func @use_after_free_in_nested_op() {
     "transform.test_branching_transform_op_terminator"() : () -> ()
   }
   // expected-warning @below {{operand #0 may be used after free}}
-  transform.sequence %0 {
+  transform.sequence %0 failures(propagate) {
     ^bb0(%arg0: !pdl.operation):
   }
   return
@@ -55,29 +55,29 @@ func.func @use_after_free_in_nested_op() {
 // -----
 
 func.func @use_after_free_recursive_side_effects() {
-  transform.sequence {
+  transform.sequence failures(propagate) {
   ^bb0(%arg0: !pdl.operation):
     // expected-note @below {{allocated here}}
-    %0 = transform.sequence %arg0 attributes { ord = 1 } {
+    %0 = transform.sequence %arg0 failures(propagate) attributes { ord = 1 } {
     ^bb1(%arg1: !pdl.operation):
       yield %arg1 : !pdl.operation
     } : !pdl.operation
-    transform.sequence %0 attributes { ord = 2 } {
+    transform.sequence %0 failures(propagate) attributes { ord = 2 } {
     ^bb2(%arg2: !pdl.operation):
     }
-    transform.sequence %0 attributes { ord = 3 } {
+    transform.sequence %0 failures(propagate) attributes { ord = 3 } {
     ^bb3(%arg3: !pdl.operation):
     }
     
     // `transform.sequence` has recursive side effects so it has the same "free"
     // as the child op it contains.
     // expected-note @below {{freed here}}
-    transform.sequence %0 attributes { ord = 4 } {
+    transform.sequence %0 failures(propagate) attributes { ord = 4 } {
     ^bb4(%arg4: !pdl.operation):
       test_consume_operand_if_matches_param_or_fail %0[42]
     }
     // expected-warning @below {{operand #0 may be used after free}}
-    transform.sequence %0 attributes { ord = 5 } {
+    transform.sequence %0 failures(propagate) attributes { ord = 5 } {
     ^bb3(%arg3: !pdl.operation):
     }
   }
@@ -87,24 +87,24 @@ func.func @use_after_free_recursive_side_effects() {
 // -----
 
 func.func @use_after_free() {
-  transform.sequence {
+  transform.sequence failures(propagate) {
   ^bb0(%arg0: !pdl.operation):
     // expected-note @below {{allocated here}}
-    %0 = transform.sequence %arg0 attributes { ord = 1 } {
+    %0 = transform.sequence %arg0 failures(propagate) attributes { ord = 1 } {
     ^bb1(%arg1: !pdl.operation):
       yield %arg1 : !pdl.operation
     } : !pdl.operation
-    transform.sequence %0 attributes { ord = 2 } {
+    transform.sequence %0 failures(propagate) attributes { ord = 2 } {
     ^bb2(%arg2: !pdl.operation):
     }
-    transform.sequence %0 attributes { ord = 3 } {
+    transform.sequence %0 failures(propagate) attributes { ord = 3 } {
     ^bb3(%arg3: !pdl.operation):
     }
     
     // expected-note @below {{freed here}}
     test_consume_operand_if_matches_param_or_fail %0[42]
     // expected-warning @below {{operand #0 may be used after free}}
-    transform.sequence %0 attributes { ord = 5 } {
+    transform.sequence %0 failures(propagate) attributes { ord = 5 } {
     ^bb3(%arg3: !pdl.operation):
     }
   }
@@ -127,7 +127,7 @@ func.func @use_after_free_self_cycle() {
     "transform.test_branching_transform_op_terminator"()[^bb1] : () -> ()
   ^bb1:
     // expected-warning @below {{operand #0 may be used after free}}
-    transform.sequence %0 {
+    transform.sequence %0 failures(propagate) {
     ^bb0(%arg0: !pdl.operation):
     }
     // expected-warning @below {{operand #0 may be used after free}}
index 2e49efc..6340d1d 100644 (file)
@@ -15,7 +15,7 @@ transform.with_pdl_patterns {
     rewrite %2 with "transform.dialect"
   }
 
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     // expected-note @below {{other handle}}
     %0 = pdl_match @return in %arg1
@@ -49,7 +49,7 @@ transform.with_pdl_patterns {
     rewrite %2 with "transform.dialect"
   }
 
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = pdl_match @func in %arg1
     %1 = pdl_match @return in %arg1
index 2650651..66d4598 100644 (file)
@@ -1,16 +1,16 @@
 // RUN: mlir-opt %s -split-input-file -verify-diagnostics
 
 // expected-error @below {{expects the entry block to have one argument of type '!pdl.operation'}}
-transform.sequence {
+transform.sequence failures(propagate) {
 }
 
 // -----
 
 // expected-note @below {{nested in another possible top-level op}}
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-error @below {{expects the root operation to be provided for a nested op}}
-  transform.sequence {
+  transform.sequence failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
   }
 }
@@ -18,7 +18,7 @@ transform.sequence {
 // -----
 
 // expected-error @below {{expected children ops to implement TransformOpInterface}}
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-note @below {{op without interface}}
   arith.constant 42.0 : f32
@@ -27,7 +27,7 @@ transform.sequence {
 // -----
 
 // expected-error @below {{expects the types of the terminator operands to match the types of the resul}}
-%0 = transform.sequence {
+%0 = transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-note @below {{terminator}}
   transform.yield
@@ -39,7 +39,7 @@ transform.sequence {
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
   // expected-error @below {{expects the root operation to be provided for a nested op}}
-  transform.sequence {
+  transform.sequence failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
   }
 }
@@ -50,11 +50,11 @@ transform.with_pdl_patterns {
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
   // expected-note @below {{first non-pattern op}}
-  transform.sequence {
+  transform.sequence failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
   }
   // expected-note @below {{second non-pattern op}}
-  transform.sequence {
+  transform.sequence failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
   }
 }
@@ -96,7 +96,7 @@ transform.with_pdl_patterns {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-error @below {{result #0 has more than one potential consumer}}
   %0 = test_produce_param_or_forward_operand 42
@@ -108,14 +108,14 @@ transform.sequence {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-error @below {{result #0 has more than one potential consumer}}
   %0 = test_produce_param_or_forward_operand 42
   // expected-note @below {{used here as operand #0}}
   test_consume_operand_if_matches_param_or_fail %0[42]
   // expected-note @below {{used here as operand #0}}
-  transform.sequence %0 {
+  transform.sequence %0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     test_consume_operand_if_matches_param_or_fail %arg1[42]
   }
@@ -123,13 +123,13 @@ transform.sequence {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-error @below {{result #0 has more than one potential consumer}}
   %0 = test_produce_param_or_forward_operand 42
   // expected-note @below {{used here as operand #0}}
   test_consume_operand_if_matches_param_or_fail %0[42]
-  transform.sequence %0 {
+  transform.sequence %0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     // expected-note @below {{used here as operand #0}}
     test_consume_operand_if_matches_param_or_fail %0[42]
@@ -138,16 +138,16 @@ transform.sequence {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-error @below {{result #0 has more than one potential consumer}}
   %0 = test_produce_param_or_forward_operand 42
   // expected-note @below {{used here as operand #0}}
   test_consume_operand_if_matches_param_or_fail %0[42]
   // expected-note @below {{used here as operand #0}}
-  transform.sequence %0 {
+  transform.sequence %0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
-    transform.sequence %arg1 {
+    transform.sequence %arg1 failures(propagate) {
     ^bb2(%arg2: !pdl.operation):
       test_consume_operand_if_matches_param_or_fail %arg2[42]
     }
@@ -156,7 +156,7 @@ transform.sequence {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb1(%arg1: !pdl.operation):
   // expected-error @below {{expects at least one region}}
   transform.alternatives
@@ -164,7 +164,7 @@ transform.sequence {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb1(%arg1: !pdl.operation):
   // expected-error @below {{expects terminator operands to have the same type as results of the operation}}
   %2 = transform.alternatives %arg1 -> !pdl.operation {
@@ -187,7 +187,7 @@ transform.alternatives {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // expected-error @below {{result #0 has more than one potential consumer}}
   %0 = test_produce_param_or_forward_operand 42
index 23dd6b8..d905a3e 100644 (file)
@@ -2,11 +2,11 @@
 
 // CHECK: transform.sequence
 // CHECK: ^{{.+}}(%{{.+}}: !pdl.operation):
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // CHECK: sequence %{{.+}}
   // CHECK: ^{{.+}}(%{{.+}}: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
   }
 }
@@ -16,14 +16,14 @@ transform.sequence {
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
   // CHECK: sequence %[[ARG]]
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
   }
 }
 
 // CHECK: transform.sequence
 // CHECK: ^{{.+}}(%[[ARG:.+]]: !pdl.operation):
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   // CHECK: with_pdl_patterns %[[ARG]]
   with_pdl_patterns %arg0 {
@@ -36,23 +36,23 @@ transform.sequence {
 // CHECK: %[[V:.+]] = sequence
 // CHECK: sequence %[[V]]
 // CHECK: sequence %[[V]]
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
-  %0 = transform.sequence %arg0 {
+  %0 = transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     yield %arg1 : !pdl.operation
   } : !pdl.operation
-  transform.sequence %0 {
+  transform.sequence %0 failures(propagate) {
   ^bb2(%arg2: !pdl.operation):
   }
-  transform.sequence %0 {
+  transform.sequence %0 failures(propagate) {
   ^bb3(%arg3: !pdl.operation):
   }
 }
 
 // CHECK: transform.sequence
 // CHECK: foreach
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   transform.foreach %arg0 {
   ^bb1(%arg1: !pdl.operation):
index c25d001..feaf489 100644 (file)
@@ -74,7 +74,7 @@ transform.with_pdl_patterns {
     rewrite %0 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = pdl_match @pdl_target_attrA in %arg1
     transform.structured.tile %0 [4, 4, 4]
@@ -121,7 +121,7 @@ transform.with_pdl_patterns {
     rewrite %0 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = pdl_match @pdl_target in %arg1
     %1 = get_closest_isolated_parent %0
@@ -148,7 +148,7 @@ func.func @vectorize_all(
   return %1 : tensor<128x128xf32>
 }
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   transform.structured.vectorize %arg0
 }
index 425ba60..494c616 100644 (file)
@@ -28,9 +28,9 @@ transform.test_consume_operand_if_matches_param_or_fail %2[42]
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb0(%arg1: !pdl.operation):
     // expected-remark @below {{applying transformation "a"}}
     test_transform_op "a"
@@ -47,10 +47,10 @@ transform.sequence {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   %0 = test_produce_param_or_forward_operand 42
-  sequence %0 {
+  sequence %0 failures(propagate) {
   ^bb0(%arg1: !pdl.operation):
     // expected-remark @below {{succeeded}}
     test_consume_operand_if_matches_param_or_fail %arg1[42]
@@ -59,9 +59,9 @@ transform.sequence {
 
 // -----
 
-transform.sequence {
+transform.sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
-  %0 = sequence %arg0 {
+  %0 = sequence %arg0 failures(propagate) {
   ^bb0(%arg1: !pdl.operation):
     %1 = test_produce_param_or_forward_operand 42
     yield %1 : !pdl.operation
@@ -74,7 +74,7 @@ transform.sequence {
 
 transform.with_pdl_patterns {
 ^bb0(%arg0: !pdl.operation):
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb0(%arg1: !pdl.operation):
     %0 = pdl_match @some in %arg1
     test_print_remark_at_operand %0, "matched"
@@ -120,7 +120,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %0 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %f = pdl_match @const in %arg1
     // CHECK: %{{.+}} = get_closest_isolated_parent %{{.+}}
@@ -145,7 +145,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     // This is necessary to run the transformation on something other than the
     // top-level module, "alternatives" cannot be run on that.
@@ -183,7 +183,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = pdl_match @match_call in %arg1
     %1 = get_closest_isolated_parent %0
@@ -216,7 +216,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = pdl_match @match_call in %arg1
     %1 = get_closest_isolated_parent %0
@@ -259,7 +259,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = pdl_match @match_call in %arg1
     %1 = get_closest_isolated_parent %0
@@ -295,7 +295,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = pdl_match @match_call in %arg1
     %1 = get_closest_isolated_parent %0
@@ -333,7 +333,7 @@ module {
     return
   }
 
-  transform.sequence {
+  transform.sequence failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     // expected-error @below {{scope must not contain the transforms being applied}}
     transform.alternatives %arg1 {
@@ -368,7 +368,7 @@ transform.with_pdl_patterns {
   }
 
 
-  sequence %arg0 {
+  sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %0 = transform.pdl_match @match_const in %arg1
     %1 = transform.loop.get_parent_for %0
@@ -395,7 +395,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb0(%arg1: !pdl.operation):
     %0 = pdl_match @some in %arg1
     // expected-error @below {{applications of transform.test_wrong_number_of_results expected to produce 3 results (actually produced 1).}}
@@ -423,7 +423,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb0(%arg1: !pdl.operation):
     %0 = pdl_match @some in %arg1
     // expected-error @below {{applications of transform.test_wrong_number_of_multi_results expected to produce 1 results (actually produced 0)}}
@@ -451,7 +451,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb0(%arg1: !pdl.operation):
     %0 = pdl_match @some in %arg1
     // Transform matches 3 ops and produces 2 results.
@@ -475,7 +475,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb0(%arg1: !pdl.operation):
     %0 = pdl_match @some in %arg1
     // Transform fails to match any but still produces 2 results.
@@ -500,7 +500,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb0(%arg1: !pdl.operation):
     %0 = pdl_match @some in %arg1
     // expected-error @below {{unexpected application of transform.test_mixed_null_and_non_null_results produces both null and non null results.}}
@@ -537,7 +537,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb0(%arg1: !pdl.operation):
     %0 = pdl_match @addi in %arg1
     %1 = pdl_match @subi in %arg1
@@ -563,7 +563,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %2 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb0(%arg1: !pdl.operation):
     %0 = pdl_match @some in %arg1
     transform.test_mixed_sucess_and_silenceable %0
@@ -572,6 +572,57 @@ transform.with_pdl_patterns {
 
 // -----
 
+func.func @foo() {
+  "op" () : () -> ()
+  return
+}
+
+transform.with_pdl_patterns {
+^bb0(%arg0: !pdl.operation):
+  pdl.pattern @some : benefit(1) {
+    %0 = pdl.operands
+    %1 = pdl.types
+    %2 = pdl.operation "op"(%0 : !pdl.range<value>) -> (%1 : !pdl.range<type>)
+    pdl.rewrite %2 with "transform.dialect"
+  }
+
+  transform.sequence %arg0 failures(suppress) {
+  ^bb0(%arg1: !pdl.operation):
+    %0 = pdl_match @some in %arg1
+    // Not expecting error here because we are suppressing it.
+    // expected-remark @below {{foo}}
+    test_emit_remark_and_erase_operand %0, "foo" {fail_after_erase}
+  }
+}
+
+// -----
+
+func.func @foo() {
+  "op" () : () -> ()
+  return
+}
+
+transform.with_pdl_patterns {
+^bb0(%arg0: !pdl.operation):
+  pdl.pattern @some : benefit(1) {
+    %0 = pdl.operands
+    %1 = pdl.types
+    %2 = pdl.operation "op"(%0 : !pdl.range<value>) -> (%1 : !pdl.range<type>)
+    pdl.rewrite %2 with "transform.dialect"
+  }
+
+  transform.sequence %arg0 failures(propagate) {
+  ^bb0(%arg1: !pdl.operation):
+    %0 = pdl_match @some in %arg1
+    // expected-error @below {{silenceable error}}
+    // expected-remark @below {{foo}}
+    test_emit_remark_and_erase_operand %0, "foo" {fail_after_erase}
+  }
+}
+
+
+// -----
+
 module {
   func.func private @foo()
   func.func private @bar()
@@ -585,7 +636,7 @@ module {
       pdl.rewrite %2 with "transform.dialect"
     }
 
-    transform.sequence %arg0 {
+    transform.sequence %arg0 failures(propagate) {
     ^bb0(%arg1: !pdl.operation):
       %0 = pdl_match @func in %arg1
       %1 = replicate num(%0) %arg1
@@ -616,7 +667,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %0 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %f = pdl_match @const in %arg1
     transform.foreach %f {
@@ -662,7 +713,7 @@ transform.with_pdl_patterns {
     pdl.rewrite %0 with "transform.dialect"
   }
 
-  transform.sequence %arg0 {
+  transform.sequence %arg0 failures(propagate) {
   ^bb1(%arg1: !pdl.operation):
     %f = pdl_match @execute_region in %arg1
     %results = transform.foreach %f -> !pdl.operation {
index c63d16d..f7f678e 100644 (file)
@@ -2,7 +2,7 @@
 
 // expected-note @below {{associated payload op}}
 module {
-  transform.sequence {
+  transform.sequence failures(propagate) {
   ^bb0(%arg0: !pdl.operation):
     // expected-remark @below {{extension absent}}
     test_check_if_test_extension_present %arg0
@@ -19,7 +19,7 @@ module {
 
 // expected-note @below {{associated payload op}}
 module {
-  transform.sequence {
+  transform.sequence failures(propagate) {
   ^bb0(%arg0: !pdl.operation):
     test_add_test_extension "A"
     test_remove_test_extension
@@ -33,7 +33,7 @@ module {
 
 // expected-note @below {{associated payload op}}
 module {
-  transform.sequence {
+  transform.sequence failures(propagate) {
   ^bb0(%arg0: !pdl.operation):
     test_add_test_extension "A"
     // expected-remark @below {{extension present, A}}
index 9652163..382b342 100644 (file)
@@ -232,7 +232,7 @@ DiagnosedSilenceableFailure mlir::test::TestEmitRemarkAndEraseOperandOp::apply(
     op->erase();
 
   if (getFailAfterErase())
-    return emitSilenceableError() << "silencable error";
+    return emitSilenceableError() << "silenceable error";
   return DiagnosedSilenceableFailure::success();
 }
 
diff --git a/mlir/test/python/.style.yapf b/mlir/test/python/.style.yapf
new file mode 100644 (file)
index 0000000..9ef1dc1
--- /dev/null
@@ -0,0 +1,4 @@
+[style]
+  based_on_style = google
+  column_limit = 80
+  indent_width = 2
index bb3afb1..c02b82e 100644 (file)
@@ -17,11 +17,12 @@ def run(f):
 
 @run
 def testSequenceOp():
-  sequence = transform.SequenceOp([pdl.OperationType.get()])
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE,
+                                  [pdl.OperationType.get()])
   with InsertionPoint(sequence.body):
     transform.YieldOp([sequence.bodyTarget])
   # CHECK-LABEL: TEST: testSequenceOp
-  # CHECK: = transform.sequence {
+  # CHECK: = transform.sequence failures(propagate) {
   # CHECK: ^{{.*}}(%[[ARG0:.+]]: !pdl.operation):
   # CHECK:   yield %[[ARG0]] : !pdl.operation
   # CHECK: } : !pdl.operation
@@ -29,22 +30,23 @@ def testSequenceOp():
 
 @run
 def testNestedSequenceOp():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
-    nested = transform.SequenceOp(sequence.bodyTarget)
+    nested = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE, sequence.bodyTarget)
     with InsertionPoint(nested.body):
-      doubly_nested = transform.SequenceOp([pdl.OperationType.get()],
-                                           nested.bodyTarget)
+      doubly_nested = transform.SequenceOp(
+          transform.FailurePropagationMode.PROPAGATE,
+          [pdl.OperationType.get()], nested.bodyTarget)
       with InsertionPoint(doubly_nested.body):
         transform.YieldOp([doubly_nested.bodyTarget])
       transform.YieldOp()
     transform.YieldOp()
   # CHECK-LABEL: TEST: testNestedSequenceOp
-  # CHECK: transform.sequence {
+  # CHECK: transform.sequence failures(propagate) {
   # CHECK: ^{{.*}}(%[[ARG0:.+]]: !pdl.operation):
-  # CHECK:   sequence %[[ARG0]] {
+  # CHECK:   sequence %[[ARG0]] failures(propagate) {
   # CHECK:   ^{{.*}}(%[[ARG1:.+]]: !pdl.operation):
-  # CHECK:     = sequence %[[ARG1]] {
+  # CHECK:     = sequence %[[ARG1]] failures(propagate) {
   # CHECK:     ^{{.*}}(%[[ARG2:.+]]: !pdl.operation):
   # CHECK:       yield %[[ARG2]] : !pdl.operation
   # CHECK:     } : !pdl.operation
@@ -56,7 +58,8 @@ def testNestedSequenceOp():
 def testTransformPDLOps():
   withPdl = transform.WithPDLPatternsOp()
   with InsertionPoint(withPdl.body):
-    sequence = transform.SequenceOp([pdl.OperationType.get()],
+    sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE,
+                                    [pdl.OperationType.get()],
                                     withPdl.bodyTarget)
     with InsertionPoint(sequence.body):
       match = transform.PDLMatchOp(sequence.bodyTarget, "pdl_matcher")
@@ -64,7 +67,7 @@ def testTransformPDLOps():
   # CHECK-LABEL: TEST: testTransformPDLOps
   # CHECK: transform.with_pdl_patterns {
   # CHECK: ^{{.*}}(%[[ARG0:.+]]: !pdl.operation):
-  # CHECK:   = sequence %[[ARG0]] {
+  # CHECK:   = sequence %[[ARG0]] failures(propagate) {
   # CHECK:   ^{{.*}}(%[[ARG1:.+]]: !pdl.operation):
   # CHECK:     %[[RES:.+]] = pdl_match @pdl_matcher in %[[ARG1]]
   # CHECK:     yield %[[RES]] : !pdl.operation
@@ -74,7 +77,7 @@ def testTransformPDLOps():
 
 @run
 def testGetClosestIsolatedParentOp():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     transform.GetClosestIsolatedParentOp(sequence.bodyTarget)
     transform.YieldOp()
@@ -86,7 +89,7 @@ def testGetClosestIsolatedParentOp():
 
 @run
 def testMergeHandlesOp():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     transform.MergeHandlesOp([sequence.bodyTarget])
     transform.YieldOp()
@@ -100,7 +103,8 @@ def testMergeHandlesOp():
 def testReplicateOp():
   with_pdl = transform.WithPDLPatternsOp()
   with InsertionPoint(with_pdl.body):
-    sequence = transform.SequenceOp(with_pdl.bodyTarget)
+    sequence = transform.SequenceOp(
+        transform.FailurePropagationMode.PROPAGATE, with_pdl.bodyTarget)
     with InsertionPoint(sequence.body):
       m1 = transform.PDLMatchOp(sequence.bodyTarget, "first")
       m2 = transform.PDLMatchOp(sequence.bodyTarget, "second")
index a324266..4a81115 100644 (file)
@@ -18,7 +18,7 @@ def run(f):
 
 @run
 def getParentLoop():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     loop.GetParentForOp(sequence.bodyTarget, num_loops=2)
     transform.YieldOp()
@@ -29,7 +29,7 @@ def getParentLoop():
 
 @run
 def loopOutline():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     loop.LoopOutlineOp(sequence.bodyTarget, func_name="foo")
     transform.YieldOp()
@@ -40,7 +40,7 @@ def loopOutline():
 
 @run
 def loopPeel():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     loop.LoopPeelOp(sequence.bodyTarget)
     transform.YieldOp()
@@ -50,7 +50,7 @@ def loopPeel():
 
 @run
 def loopPipeline():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     loop.LoopPipelineOp(sequence.bodyTarget, iteration_interval=3)
     transform.YieldOp()
@@ -62,7 +62,7 @@ def loopPipeline():
 
 @run
 def loopUnroll():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     loop.LoopUnrollOp(sequence.bodyTarget, factor=42)
     transform.YieldOp()
index 9d2641c..15c87d6 100644 (file)
@@ -18,7 +18,7 @@ def run(f):
 
 @run
 def testDecompose():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     structured.DecomposeOp(sequence.bodyTarget)
     transform.YieldOp()
@@ -29,7 +29,7 @@ def testDecompose():
 
 @run
 def testGeneralize():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     structured.GeneralizeOp(sequence.bodyTarget)
     transform.YieldOp()
@@ -40,7 +40,7 @@ def testGeneralize():
 
 @run
 def testInterchange():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     structured.InterchangeOp(
         sequence.bodyTarget,
@@ -56,7 +56,7 @@ def testInterchange():
 
 @run
 def testMultitileSizes():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     structured.MultiTileSizesOp(
         sequence.bodyTarget, dimension=1, target_size=42)
@@ -70,7 +70,7 @@ def testMultitileSizes():
 
 @run
 def testPad():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     structured.PadOp(
         sequence.bodyTarget,
@@ -90,7 +90,7 @@ def testPad():
 
 @run
 def testScalarize():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     structured.ScalarizeOp(sequence.bodyTarget)
     transform.YieldOp()
@@ -100,7 +100,7 @@ def testScalarize():
 
 @run
 def testSplit():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     split = structured.SplitOp(sequence.bodyTarget, dimension=1, split_point=42)
     structured.SplitOp(
@@ -113,7 +113,7 @@ def testSplit():
 
 @run
 def testTileCompact():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     structured.TileOp(sequence.bodyTarget, sizes=[4, 8], interchange=[0, 1])
     transform.YieldOp()
@@ -125,7 +125,7 @@ def testTileCompact():
 
 @run
 def testTileAttributes():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   attr = ArrayAttr.get(
       [IntegerAttr.get(IntegerType.get_signless(64), x) for x in [4, 8]])
   ichange = ArrayAttr.get(
@@ -141,7 +141,7 @@ def testTileAttributes():
 
 @run
 def testTileZero():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     structured.TileOp(
         sequence.bodyTarget, sizes=[4, 0, 2, 0], interchange=[0, 1, 2, 3])
@@ -156,7 +156,8 @@ def testTileZero():
 def testTileDynamic():
   with_pdl = transform.WithPDLPatternsOp()
   with InsertionPoint(with_pdl.body):
-    sequence = transform.SequenceOp(with_pdl.bodyTarget)
+    sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE,
+                                    with_pdl.bodyTarget)
     with InsertionPoint(sequence.body):
       m1 = transform.PDLMatchOp(sequence.bodyTarget, "first")
       m2 = transform.PDLMatchOp(sequence.bodyTarget, "second")
@@ -170,7 +171,7 @@ def testTileDynamic():
 
 @run
 def testVectorize():
-  sequence = transform.SequenceOp()
+  sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
   with InsertionPoint(sequence.body):
     structured.VectorizeOp(sequence.bodyTarget, vectorize_padding=True)
     transform.YieldOp()
index 2201af4..dddb4cd 100644 (file)
@@ -7962,6 +7962,28 @@ td_library(
 )
 
 gentbl_cc_library(
+    name = "TransformDialectEnumsIncGen",
+    strip_include_prefix = "include",
+    tbl_outs = [
+        (
+            [
+                "-gen-enum-decls",
+            ],
+            "include/mlir/Dialect/Transform/IR/TransformDialectEnums.h.inc",
+        ),
+        (
+            [
+                "-gen-enum-defs",
+            ],
+            "include/mlir/Dialect/Transform/IR/TransformDialectEnums.cpp.inc",
+        ),
+    ],
+    tblgen = ":mlir-tblgen",
+    td_file = "include/mlir/Dialect/Transform/IR/TransformAttrs.td",
+    deps = [":TransformDialectTdFiles"],
+)
+
+gentbl_cc_library(
     name = "TransformDialectInterfacesIncGen",
     strip_include_prefix = "include",
     tbl_outs = [
@@ -8035,6 +8057,7 @@ cc_library(
         ":Rewrite",
         ":SideEffectInterfaces",
         ":Support",
+        ":TransformDialectEnumsIncGen",
         ":TransformDialectIncGen",
         ":TransformDialectInterfacesIncGen",
         ":TransformOpsIncGen",