diff --git a/mlir/include/mlir/Dialect/Transform/IR/CMakeLists.txt b/mlir/include/mlir/Dialect/Transform/IR/CMakeLists.txt --- a/mlir/include/mlir/Dialect/Transform/IR/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/Transform/IR/CMakeLists.txt @@ -8,6 +8,12 @@ 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 --- /dev/null +++ b/mlir/include/mlir/Dialect/Transform/IR/TransformAttrs.td @@ -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 diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.h b/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.h --- a/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.h +++ b/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.h @@ -193,4 +193,6 @@ } // namespace transform } // namespace mlir +#include "mlir/Dialect/Transform/IR/TransformDialectEnums.h.inc" + #endif // MLIR_DIALECT_TRANSFORM_IR_TRANSFORMDIALECT_H diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.h b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.h --- a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.h +++ b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.h @@ -16,6 +16,13 @@ #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" diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td --- a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td +++ b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td @@ -13,6 +13,7 @@ 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 @@ 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 @@ another sequence. }]; - let arguments = (ins Optional:$root); + let arguments = (ins FailurePropagationMode:$failure_propagation_mode, + Optional:$root); let results = (outs Variadic:$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 @@ 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 diff --git a/mlir/lib/Dialect/Transform/IR/TransformDialect.cpp b/mlir/lib/Dialect/Transform/IR/TransformDialect.cpp --- a/mlir/lib/Dialect/Transform/IR/TransformDialect.cpp +++ b/mlir/lib/Dialect/Transform/IR/TransformDialect.cpp @@ -35,3 +35,5 @@ transform::TransformDialect::getPDLConstraintHooks() const { return pdlMatchHooks.getConstraintFunctions(); } + +#include "mlir/Dialect/Transform/IR/TransformDialectEnums.cpp.inc" diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp --- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp +++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp @@ -489,8 +489,14 @@ for (Operation &transform : getBodyBlock()->without_terminator()) { DiagnosedSilenceableFailure result = state.applyTransform(cast(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 diff --git a/mlir/python/mlir/dialects/_transform_ops_ext.py b/mlir/python/mlir/dialects/_transform_ops_ext.py --- a/mlir/python/mlir/dialects/_transform_ops_ext.py +++ b/mlir/python/mlir/dialects/_transform_ops_ext.py @@ -9,6 +9,7 @@ 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 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 diff --git a/mlir/python/mlir/dialects/transform/__init__.py b/mlir/python/mlir/dialects/transform/__init__.py --- a/mlir/python/mlir/dialects/transform/__init__.py +++ b/mlir/python/mlir/dialects/transform/__init__.py @@ -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 * diff --git a/mlir/test/Dialect/Bufferization/Transforms/transform-ops.mlir b/mlir/test/Dialect/Bufferization/Transforms/transform-ops.mlir --- a/mlir/test/Dialect/Bufferization/Transforms/transform-ops.mlir +++ b/mlir/test/Dialect/Bufferization/Transforms/transform-ops.mlir @@ -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 @@ 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 @@ 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 @@ 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 diff --git a/mlir/test/Dialect/Linalg/multisize-tiling-full.mlir b/mlir/test/Dialect/Linalg/multisize-tiling-full.mlir --- a/mlir/test/Dialect/Linalg/multisize-tiling-full.mlir +++ b/mlir/test/Dialect/Linalg/multisize-tiling-full.mlir @@ -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} diff --git a/mlir/test/Dialect/Linalg/promote.mlir b/mlir/test/Dialect/Linalg/promote.mlir --- a/mlir/test/Dialect/Linalg/promote.mlir +++ b/mlir/test/Dialect/Linalg/promote.mlir @@ -70,7 +70,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 = transform.structured.promote %0 { use_alloca } @@ -143,7 +143,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 = transform.structured.promote %0 @@ -196,7 +196,7 @@ 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 diff --git a/mlir/test/Dialect/Linalg/promotion_options.mlir b/mlir/test/Dialect/Linalg/promotion_options.mlir --- a/mlir/test/Dialect/Linalg/promotion_options.mlir +++ b/mlir/test/Dialect/Linalg/promotion_options.mlir @@ -33,7 +33,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 [16, 16, 16] diff --git a/mlir/test/Dialect/Linalg/tile-to-foreach-thread.mlir b/mlir/test/Dialect/Linalg/tile-to-foreach-thread.mlir --- a/mlir/test/Dialect/Linalg/tile-to-foreach-thread.mlir +++ b/mlir/test/Dialect/Linalg/tile-to-foreach-thread.mlir @@ -34,7 +34,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.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 @@ 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 @@ 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 @@ 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] diff --git a/mlir/test/Dialect/Linalg/transform-op-decompose.mlir b/mlir/test/Dialect/Linalg/transform-op-decompose.mlir --- a/mlir/test/Dialect/Linalg/transform-op-decompose.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-decompose.mlir @@ -40,7 +40,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 interface{LinalgOp} in %arg1 %1 = transform.structured.decompose %0 diff --git a/mlir/test/Dialect/Linalg/transform-op-fuse-into-containing.mlir b/mlir/test/Dialect/Linalg/transform-op-fuse-into-containing.mlir --- a/mlir/test/Dialect/Linalg/transform-op-fuse-into-containing.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-fuse-into-containing.mlir @@ -43,7 +43,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.fill"]} in %arg1 %1 = transform.structured.match ops{["scf.foreach_thread"]} in %arg1 @@ -89,7 +89,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.init_tensor"]} in %arg1 %1 = transform.structured.match ops{["scf.foreach_thread"]} in %arg1 diff --git a/mlir/test/Dialect/Linalg/transform-op-fuse.mlir b/mlir/test/Dialect/Linalg/transform-op-fuse.mlir --- a/mlir/test/Dialect/Linalg/transform-op-fuse.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-fuse.mlir @@ -16,7 +16,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.elemwise_binary"]} in %arg1 %1, %loops:2 = transform.structured.fuse %0 {tile_sizes = [32, 32], tile_interchange = [0, 1]} @@ -45,7 +45,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.elemwise_binary"]} in %arg1 %1, %loops:2 = transform.structured.fuse %0 {tile_sizes = [32, 32], tile_interchange = [0, 1]} @@ -88,7 +88,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, %loops:3 = transform.structured.fuse %0 {tile_sizes = [5, 4, 7], tile_interchange = [0, 2, 1]} diff --git a/mlir/test/Dialect/Linalg/transform-op-generalize.mlir b/mlir/test/Dialect/Linalg/transform-op-generalize.mlir --- a/mlir/test/Dialect/Linalg/transform-op-generalize.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-generalize.mlir @@ -12,7 +12,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.elemwise_unary"]} in %arg1 %1 = transform.structured.generalize %0 diff --git a/mlir/test/Dialect/Linalg/transform-op-interchange.mlir b/mlir/test/Dialect/Linalg/transform-op-interchange.mlir --- a/mlir/test/Dialect/Linalg/transform-op-interchange.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-interchange.mlir @@ -20,7 +20,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 transform.structured.interchange %0 { iterator_interchange = [1, 0]} @@ -37,7 +37,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.matmul"]} in %arg1 // expected-error @below {{transform applied to the wrong op kind}} diff --git a/mlir/test/Dialect/Linalg/transform-op-match.mlir b/mlir/test/Dialect/Linalg/transform-op-match.mlir --- a/mlir/test/Dialect/Linalg/transform-op-match.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-match.mlir @@ -11,7 +11,7 @@ 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" diff --git a/mlir/test/Dialect/Linalg/transform-op-multitile-sizes.mlir b/mlir/test/Dialect/Linalg/transform-op-multitile-sizes.mlir --- a/mlir/test/Dialect/Linalg/transform-op-multitile-sizes.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-multitile-sizes.mlir @@ -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 @@ 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 } diff --git a/mlir/test/Dialect/Linalg/transform-op-pad.mlir b/mlir/test/Dialect/Linalg/transform-op-pad.mlir --- a/mlir/test/Dialect/Linalg/transform-op-pad.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-pad.mlir @@ -33,7 +33,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.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 @@ 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 @@ 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 @@ 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 diff --git a/mlir/test/Dialect/Linalg/transform-op-scalarize.mlir b/mlir/test/Dialect/Linalg/transform-op-scalarize.mlir --- a/mlir/test/Dialect/Linalg/transform-op-scalarize.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-scalarize.mlir @@ -12,7 +12,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.matmul"]} in %arg1 %1, %loops = transform.structured.tile %0 [10, 0, 0] diff --git a/mlir/test/Dialect/Linalg/transform-op-split-reduction-by-scaling.mlir b/mlir/test/Dialect/Linalg/transform-op-split-reduction-by-scaling.mlir --- a/mlir/test/Dialect/Linalg/transform-op-split-reduction-by-scaling.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-split-reduction-by-scaling.mlir @@ -20,7 +20,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.matmul"]} in %arg1 %1:4 = transform.structured.split_reduction %0 diff --git a/mlir/test/Dialect/Linalg/transform-op-split-reduction.mlir b/mlir/test/Dialect/Linalg/transform-op-split-reduction.mlir --- a/mlir/test/Dialect/Linalg/transform-op-split-reduction.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-split-reduction.mlir @@ -19,7 +19,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.matmul"]} in %arg1 %1:4 = transform.structured.split_reduction %0 { split_factor = 4, insert_split_dimension = 2} diff --git a/mlir/test/Dialect/Linalg/transform-op-split.mlir b/mlir/test/Dialect/Linalg/transform-op-split.mlir --- a/mlir/test/Dialect/Linalg/transform-op-split.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-split.mlir @@ -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 @@ 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 @@ 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 @@ // ----- -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.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 @@ 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 @@ 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 @@ 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}} diff --git a/mlir/test/Dialect/Linalg/transform-op-tile.mlir b/mlir/test/Dialect/Linalg/transform-op-tile.mlir --- a/mlir/test/Dialect/Linalg/transform-op-tile.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-tile.mlir @@ -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 @@ 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 diff --git a/mlir/test/Dialect/Linalg/transform-op-vectorize.mlir b/mlir/test/Dialect/Linalg/transform-op-vectorize.mlir --- a/mlir/test/Dialect/Linalg/transform-op-vectorize.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-vectorize.mlir @@ -26,7 +26,7 @@ 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 @@ 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 @@ 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 @@ 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}} diff --git a/mlir/test/Dialect/Linalg/transform-ops-invalid.mlir b/mlir/test/Dialect/Linalg/transform-ops-invalid.mlir --- a/mlir/test/Dialect/Linalg/transform-ops-invalid.mlir +++ b/mlir/test/Dialect/Linalg/transform-ops-invalid.mlir @@ -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 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 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 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 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]]} diff --git a/mlir/test/Dialect/Linalg/transform-ops.mlir b/mlir/test/Dialect/Linalg/transform-ops.mlir --- a/mlir/test/Dialect/Linalg/transform-ops.mlir +++ b/mlir/test/Dialect/Linalg/transform-ops.mlir @@ -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 @@ // 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 diff --git a/mlir/test/Dialect/Linalg/transform-promotion.mlir b/mlir/test/Dialect/Linalg/transform-promotion.mlir --- a/mlir/test/Dialect/Linalg/transform-promotion.mlir +++ b/mlir/test/Dialect/Linalg/transform-promotion.mlir @@ -64,7 +64,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 = transform.structured.promote %0 { operands_to_promote = [0, 1, 2], use_full_tiles_by_default } @@ -127,7 +127,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 = transform.structured.promote %0 { operands_to_promote = [0], use_full_tiles_by_default } @@ -160,7 +160,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.fill"]} in %arg1 %1 = transform.structured.promote %0 { operands_to_promote = [1], use_full_tile_buffers = [false, true], alignment = 32} @@ -194,7 +194,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.fill"]} in %arg1 %1 = transform.structured.promote %0 { operands_to_promote = [1], use_full_tile_buffers = [false, true], alignment = 32} diff --git a/mlir/test/Dialect/Linalg/transform-tile-and-fuse.mlir b/mlir/test/Dialect/Linalg/transform-tile-and-fuse.mlir --- a/mlir/test/Dialect/Linalg/transform-tile-and-fuse.mlir +++ b/mlir/test/Dialect/Linalg/transform-tile-and-fuse.mlir @@ -42,7 +42,7 @@ 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 attribute{"__root__"} in %arg1 @@ -102,7 +102,7 @@ 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 attribute{"__root__"} in %arg1 diff --git a/mlir/test/Dialect/SCF/transform-ops.mlir b/mlir/test/Dialect/SCF/transform-ops.mlir --- a/mlir/test/Dialect/SCF/transform-ops.mlir +++ b/mlir/test/Dialect/SCF/transform-ops.mlir @@ -17,7 +17,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 diff --git a/mlir/test/Dialect/Transform/check-use-after-free.mlir b/mlir/test/Dialect/Transform/check-use-after-free.mlir --- a/mlir/test/Dialect/Transform/check-use-after-free.mlir +++ b/mlir/test/Dialect/Transform/check-use-after-free.mlir @@ -17,7 +17,7 @@ "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 @@ "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_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() { - 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 @@ "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}} diff --git a/mlir/test/Dialect/Transform/expensive-checks.mlir b/mlir/test/Dialect/Transform/expensive-checks.mlir --- a/mlir/test/Dialect/Transform/expensive-checks.mlir +++ b/mlir/test/Dialect/Transform/expensive-checks.mlir @@ -15,7 +15,7 @@ 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 @@ 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 diff --git a/mlir/test/Dialect/Transform/ops-invalid.mlir b/mlir/test/Dialect/Transform/ops-invalid.mlir --- a/mlir/test/Dialect/Transform/ops-invalid.mlir +++ b/mlir/test/Dialect/Transform/ops-invalid.mlir @@ -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 @@ // ----- // 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 @@ // ----- // 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.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 { ^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.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 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 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 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 failures(propagate) { ^bb1(%arg1: !pdl.operation): // expected-error @below {{expects at least one region}} transform.alternatives @@ -164,7 +164,7 @@ // ----- -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.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 diff --git a/mlir/test/Dialect/Transform/ops.mlir b/mlir/test/Dialect/Transform/ops.mlir --- a/mlir/test/Dialect/Transform/ops.mlir +++ b/mlir/test/Dialect/Transform/ops.mlir @@ -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.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 @@ // 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): diff --git a/mlir/test/Dialect/Transform/selective-targeting.mlir b/mlir/test/Dialect/Transform/selective-targeting.mlir --- a/mlir/test/Dialect/Transform/selective-targeting.mlir +++ b/mlir/test/Dialect/Transform/selective-targeting.mlir @@ -74,7 +74,7 @@ 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 @@ 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 @@ return %1 : tensor<128x128xf32> } -transform.sequence { +transform.sequence failures(propagate) { ^bb0(%arg0: !pdl.operation): transform.structured.vectorize %arg0 } diff --git a/mlir/test/Dialect/Transform/test-interpreter.mlir b/mlir/test/Dialect/Transform/test-interpreter.mlir --- a/mlir/test/Dialect/Transform/test-interpreter.mlir +++ b/mlir/test/Dialect/Transform/test-interpreter.mlir @@ -28,9 +28,9 @@ // ----- -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 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 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.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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ } - 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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,13 +563,64 @@ 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 } } +// ----- + +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) -> (%1 : !pdl.range) + 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) -> (%1 : !pdl.range) + 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 { @@ -585,7 +636,7 @@ 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 @@ 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 @@ 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 { diff --git a/mlir/test/Dialect/Transform/transform-state-extension.mlir b/mlir/test/Dialect/Transform/transform-state-extension.mlir --- a/mlir/test/Dialect/Transform/transform-state-extension.mlir +++ b/mlir/test/Dialect/Transform/transform-state-extension.mlir @@ -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 @@ // 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 @@ // 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}} diff --git a/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp b/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp --- a/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp +++ b/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp @@ -232,7 +232,7 @@ 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 --- /dev/null +++ b/mlir/test/python/.style.yapf @@ -0,0 +1,4 @@ +[style] + based_on_style = google + column_limit = 80 + indent_width = 2 diff --git a/mlir/test/python/dialects/transform.py b/mlir/test/python/dialects/transform.py --- a/mlir/test/python/dialects/transform.py +++ b/mlir/test/python/dialects/transform.py @@ -17,11 +17,12 @@ @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 @@ @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 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 @@ # 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 @@ @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 @@ @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 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") diff --git a/mlir/test/python/dialects/transform_loop_ext.py b/mlir/test/python/dialects/transform_loop_ext.py --- a/mlir/test/python/dialects/transform_loop_ext.py +++ b/mlir/test/python/dialects/transform_loop_ext.py @@ -18,7 +18,7 @@ @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 @@ @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 @@ @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 @@ @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 @@ @run def loopUnroll(): - sequence = transform.SequenceOp() + sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE) with InsertionPoint(sequence.body): loop.LoopUnrollOp(sequence.bodyTarget, factor=42) transform.YieldOp() diff --git a/mlir/test/python/dialects/transform_structured_ext.py b/mlir/test/python/dialects/transform_structured_ext.py --- a/mlir/test/python/dialects/transform_structured_ext.py +++ b/mlir/test/python/dialects/transform_structured_ext.py @@ -18,7 +18,7 @@ @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 @@ @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 @@ @run def testInterchange(): - sequence = transform.SequenceOp() + sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE) with InsertionPoint(sequence.body): structured.InterchangeOp( sequence.bodyTarget, @@ -56,7 +56,7 @@ @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 @@ @run def testPad(): - sequence = transform.SequenceOp() + sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE) with InsertionPoint(sequence.body): structured.PadOp( sequence.bodyTarget, @@ -90,7 +90,7 @@ @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 @@ @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 @@ @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 @@ @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 @@ @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 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 @@ @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() diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel @@ -7961,6 +7961,28 @@ ], ) +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", @@ -8035,6 +8057,7 @@ ":Rewrite", ":SideEffectInterfaces", ":Support", + ":TransformDialectEnumsIncGen", ":TransformDialectIncGen", ":TransformDialectInterfacesIncGen", ":TransformOpsIncGen",