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)
--- /dev/null
+//===- 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
} // namespace transform
} // namespace mlir
+#include "mlir/Dialect/Transform/IR/TransformDialectEnums.h.inc"
+
#endif // MLIR_DIALECT_TRANSFORM_IR_TRANSFORMDIALECT_H
#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"
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"
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
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.
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
transform::TransformDialect::getPDLConstraintHooks() const {
return pdlMatchHooks.getConstraintFunctions();
}
+
+#include "mlir/Dialect/Transform/IR/TransformDialectEnums.cpp.inc"
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
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
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
# 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 *
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
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
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}}
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
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}
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 }
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
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
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]
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])
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]
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]
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]
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
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
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
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]}
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]}
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]}
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
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]}
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}}
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"
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 }
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 }
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]}
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}}
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"}}
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
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]
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
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}
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 }
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
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}
// -----
-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)
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
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
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}}
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}}
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]
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
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
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
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
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}}
// 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]}
// -----
-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]}
// -----
-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]}
// -----
-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]}
// -----
-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]]}
// 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]
// 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
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 }
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 }
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}
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}
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
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
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
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}}
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
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}}
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
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
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
"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"() : () -> ()
"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
// -----
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):
}
}
// -----
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):
}
}
"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}}
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
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
// 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):
}
}
// -----
// 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
// -----
// 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
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):
}
}
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):
}
}
// -----
-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
// -----
-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]
}
// -----
-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]
// -----
-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]
}
// -----
-transform.sequence {
+transform.sequence failures(propagate) {
^bb1(%arg1: !pdl.operation):
// expected-error @below {{expects at least one region}}
transform.alternatives
// -----
-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 {
// -----
-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
// 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):
}
}
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 {
// 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):
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]
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
return %1 : tensor<128x128xf32>
}
-transform.sequence {
+transform.sequence failures(propagate) {
^bb0(%arg0: !pdl.operation):
transform.structured.vectorize %arg0
}
// -----
-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"
// -----
-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]
// -----
-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
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"
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 %{{.+}}
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.
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
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
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
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
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 {
}
- 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
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).}}
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)}}
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.
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.
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.}}
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
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<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()
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
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 {
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 {
// 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
// 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
// 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}}
op->erase();
if (getFailAfterErase())
- return emitSilenceableError() << "silencable error";
+ return emitSilenceableError() << "silenceable error";
return DiagnosedSilenceableFailure::success();
}
--- /dev/null
+[style]
+ based_on_style = google
+ column_limit = 80
+ indent_width = 2
@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
@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
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")
# 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
@run
def testGetClosestIsolatedParentOp():
- sequence = transform.SequenceOp()
+ sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
with InsertionPoint(sequence.body):
transform.GetClosestIsolatedParentOp(sequence.bodyTarget)
transform.YieldOp()
@run
def testMergeHandlesOp():
- sequence = transform.SequenceOp()
+ sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
with InsertionPoint(sequence.body):
transform.MergeHandlesOp([sequence.bodyTarget])
transform.YieldOp()
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")
@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()
@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()
@run
def loopPeel():
- sequence = transform.SequenceOp()
+ sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
with InsertionPoint(sequence.body):
loop.LoopPeelOp(sequence.bodyTarget)
transform.YieldOp()
@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()
@run
def loopUnroll():
- sequence = transform.SequenceOp()
+ sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
with InsertionPoint(sequence.body):
loop.LoopUnrollOp(sequence.bodyTarget, factor=42)
transform.YieldOp()
@run
def testDecompose():
- sequence = transform.SequenceOp()
+ sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
with InsertionPoint(sequence.body):
structured.DecomposeOp(sequence.bodyTarget)
transform.YieldOp()
@run
def testGeneralize():
- sequence = transform.SequenceOp()
+ sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
with InsertionPoint(sequence.body):
structured.GeneralizeOp(sequence.bodyTarget)
transform.YieldOp()
@run
def testInterchange():
- sequence = transform.SequenceOp()
+ sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
with InsertionPoint(sequence.body):
structured.InterchangeOp(
sequence.bodyTarget,
@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)
@run
def testPad():
- sequence = transform.SequenceOp()
+ sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
with InsertionPoint(sequence.body):
structured.PadOp(
sequence.bodyTarget,
@run
def testScalarize():
- sequence = transform.SequenceOp()
+ sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
with InsertionPoint(sequence.body):
structured.ScalarizeOp(sequence.bodyTarget)
transform.YieldOp()
@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(
@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()
@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(
@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])
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")
@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()
)
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 = [
":Rewrite",
":SideEffectInterfaces",
":Support",
+ ":TransformDialectEnumsIncGen",
":TransformDialectIncGen",
":TransformDialectInterfacesIncGen",
":TransformOpsIncGen",