[mlir][ods] Rename Confined and AllAttrConstraintsOf

Confined -> ConfinedAttr
AllAttrConstraintsOf -> AllOfAttr

To be in line with ConfinedType and AllOfType.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D131822
This commit is contained in:
Jeff Niu 2022-08-12 21:22:26 -04:00
parent 5c4674d67b
commit e35ca70eb3
16 changed files with 92 additions and 92 deletions

View File

@ -117,8 +117,8 @@ window in `value`.
let arguments = (ins
TF_FpTensor:$value,
Confined<I64ArrayAttr, [ArrayMinCount<4>]>:$ksize,
Confined<I64ArrayAttr, [ArrayMinCount<4>]>:$strides,
ConfinedAttr<I64ArrayAttr, [ArrayMinCount<4>]>:$ksize,
ConfinedAttr<I64ArrayAttr, [ArrayMinCount<4>]>:$strides,
TF_AnyStrAttrOf<["SAME", "VALID"]>:$padding,
DefaultValuedAttr<TF_ConvertDataFormatAttr, "NHWC">:$data_format
);
@ -275,11 +275,11 @@ like `"0.5f"`, and an integer array default value should be specified as like
#### Confining attributes
`Confined` is provided as a general mechanism to help modelling further
`ConfinedAttr` is provided as a general mechanism to help modelling further
constraints on attributes beyond the ones brought by value types. You can use
`Confined` to compose complex constraints out of more primitive ones. For
`ConfinedAttr` to compose complex constraints out of more primitive ones. For
example, a 32-bit integer attribute whose minimum value must be 10 can be
expressed as `Confined<I32Attr, [IntMinValue<10>]>`.
expressed as `ConfinedAttr<I32Attr, [IntMinValue<10>]>`.
Right now, the following primitive constraints are supported:
@ -1287,7 +1287,7 @@ optionality, default values, etc.:
* `DefaultValuedAttr`: specifies the
[default value](#attributes-with-default-values) for an attribute.
* `OptionalAttr`: specifies an attribute as [optional](#optional-attributes).
* `Confined`: adapts an attribute with
* `ConfinedAttr`: adapts an attribute with
[further constraints](#confining-attributes).
### Enum attributes

View File

@ -779,7 +779,7 @@ def AffinePrefetchOp : Affine_Op<"prefetch",
let arguments = (ins AnyMemRef:$memref, Variadic<Index>:$indices,
BoolAttr:$isWrite,
Confined<I32Attr, [IntMinValue<0>,
ConfinedAttr<I32Attr, [IntMinValue<0>,
IntMaxValue<3>]>:$localityHint,
BoolAttr:$isDataCache);

View File

@ -505,7 +505,7 @@ def Async_RuntimeAddRefOp : Async_Op<"runtime.add_ref"> {
}];
let arguments = (ins Async_AnyAsyncType:$operand,
Confined<I64Attr, [IntPositive]>:$count);
ConfinedAttr<I64Attr, [IntPositive]>:$count);
let assemblyFormat = [{
$operand attr-dict `:` type($operand)
@ -520,7 +520,7 @@ def Async_RuntimeDropRefOp : Async_Op<"runtime.drop_ref"> {
}];
let arguments = (ins Async_AnyAsyncType:$operand,
Confined<I64Attr, [IntPositive]>:$count);
ConfinedAttr<I64Attr, [IntPositive]>:$count);
let assemblyFormat = [{
$operand attr-dict `:` type($operand)

View File

@ -1201,7 +1201,7 @@ def LLVM_GlobalOp : LLVM_Op<"mlir.global",
UnitAttr:$thread_local_,
OptionalAttr<AnyAttr>:$value,
OptionalAttr<I64Attr>:$alignment,
DefaultValuedAttr<Confined<I32Attr, [IntNonNegative]>, "0">:$addr_space,
DefaultValuedAttr<ConfinedAttr<I32Attr, [IntNonNegative]>, "0">:$addr_space,
OptionalAttr<UnnamedAddr>:$unnamed_addr,
OptionalAttr<StrAttr>:$section
);

View File

@ -148,7 +148,7 @@ def Linalg_YieldOp : Linalg_Op<"yield", [NoSideEffect, ReturnLike, Terminator]>,
}
def Linalg_IndexOp : Linalg_Op<"index", [NoSideEffect]>,
Arguments<(ins Confined<I64Attr, [IntMinValue<0>]>:$dim)>,
Arguments<(ins ConfinedAttr<I64Attr, [IntMinValue<0>]>:$dim)>,
Results<(outs Index:$result)> {
let summary = "linalg index operation";
let description = [{

View File

@ -66,7 +66,7 @@ class AllocLikeOp<string mnemonic,
// The symbolic operands (the ones in square brackets)
// bind to the symbols of the memref's layout map.
Variadic<Index>:$symbolOperands,
Confined<OptionalAttr<I64Attr>,
ConfinedAttr<OptionalAttr<I64Attr>,
[IntMinValue<0>]>:$alignment);
let results = (outs Res<AnyMemRef, "", [MemAlloc<resource>]>:$memref);
@ -123,7 +123,7 @@ def AssumeAlignmentOp : MemRef_Op<"assume_alignment"> {
optimization only, and the optimization is best-effort.
}];
let arguments = (ins AnyMemRef:$memref,
Confined<I32Attr, [IntPositive]>:$alignment);
ConfinedAttr<I32Attr, [IntPositive]>:$alignment);
let results = (outs);
let assemblyFormat = "$memref `,` $alignment attr-dict `:` type($memref)";
@ -965,7 +965,7 @@ def MemRef_PrefetchOp : MemRef_Op<"prefetch"> {
let arguments = (ins AnyMemRef:$memref, Variadic<Index>:$indices,
BoolAttr:$isWrite,
Confined<I32Attr, [IntMinValue<0>,
ConfinedAttr<I32Attr, [IntMinValue<0>,
IntMaxValue<3>]>:$localityHint,
BoolAttr:$isDataCache);

View File

@ -240,7 +240,7 @@ def SectionsOp : OpenMP_Op<"sections", [AttrSizedOperandSegments,
def SingleOp : OpenMP_Op<"single", [AttrSizedOperandSegments]> {
let summary = "single directive";
let description = [{
The single construct specifies that the associated structured block is
The single construct specifies that the associated structured block is
executed by only one of the threads in the team (not necessarily the
master thread), in the context of its implicit task. The other threads
in the team, which do not execute the block, wait at an implicit barrier
@ -345,7 +345,7 @@ def WsLoopOp : OpenMP_Op<"wsloop", [AttrSizedOperandSegments,
OptionalAttr<ScheduleModifierAttr>:$schedule_modifier,
UnitAttr:$simd_modifier,
UnitAttr:$nowait,
Confined<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$ordered_val,
ConfinedAttr<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$ordered_val,
OptionalAttr<OrderKindAttr>:$order_val,
UnitAttr:$inclusive);
@ -395,17 +395,17 @@ def WsLoopOp : OpenMP_Op<"wsloop", [AttrSizedOperandSegments,
}
//===----------------------------------------------------------------------===//
// Simd construct [2.9.3.1]
// Simd construct [2.9.3.1]
//===----------------------------------------------------------------------===//
def SimdLoopOp : OpenMP_Op<"simdloop", [AttrSizedOperandSegments,
AllTypesMatch<["lowerBound", "upperBound", "step"]>]> {
let summary = "simd loop construct";
let description = [{
The simd construct can be applied to a loop to indicate that the loop can be
transformed into a SIMD loop (that is, multiple iterations of the loop can
be executed concurrently using SIMD instructions).. The lower and upper
bounds specify a half-open range: the range includes the lower bound but
The simd construct can be applied to a loop to indicate that the loop can be
transformed into a SIMD loop (that is, multiple iterations of the loop can
be executed concurrently using SIMD instructions).. The lower and upper
bounds specify a half-open range: the range includes the lower bound but
does not include the upper bound. If the `inclusive` attribute is specified
then the upper bound is also included.
@ -424,7 +424,7 @@ def SimdLoopOp : OpenMP_Op<"simdloop", [AttrSizedOperandSegments,
// block operations
omp.yield
}
```
```
}];
// TODO: Add other clauses
@ -432,10 +432,10 @@ def SimdLoopOp : OpenMP_Op<"simdloop", [AttrSizedOperandSegments,
Variadic<IntLikeType>:$upperBound,
Variadic<IntLikeType>:$step,
Optional<I1>:$if_expr,
Confined<OptionalAttr<I64Attr>, [IntPositive]>:$simdlen,
ConfinedAttr<OptionalAttr<I64Attr>, [IntPositive]>:$simdlen,
UnitAttr:$inclusive
);
let regions = (region AnyRegion:$region);
let assemblyFormat = [{
oilist(`if` `(` $if_expr `)`
@ -449,15 +449,15 @@ def SimdLoopOp : OpenMP_Op<"simdloop", [AttrSizedOperandSegments,
unsigned getNumLoops() { return lowerBound().size(); }
}];
let hasCustomAssemblyFormat = 1;
let hasVerifier = 1;
let hasVerifier = 1;
}
def YieldOp : OpenMP_Op<"yield",
[NoSideEffect, ReturnLike, Terminator,
ParentOneOf<["WsLoopOp", "ReductionDeclareOp",
ParentOneOf<["WsLoopOp", "ReductionDeclareOp",
"AtomicUpdateOp", "SimdLoopOp"]>]> {
let summary = "loop yield and termination operation";
let description = [{
@ -967,7 +967,7 @@ def OrderedOp : OpenMP_Op<"ordered"> {
}];
let arguments = (ins OptionalAttr<ClauseDependAttr>:$depend_type_val,
Confined<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$num_loops_val,
ConfinedAttr<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$num_loops_val,
Variadic<AnyType>:$depend_vec_vars);
let assemblyFormat = [{
@ -1046,7 +1046,7 @@ def AtomicReadOp : OpenMP_Op<"atomic.read", [AllTypesMatch<["x", "v"]>]> {
DefaultValuedAttr<I64Attr, "0">:$hint_val,
OptionalAttr<MemoryOrderKindAttr>:$memory_order_val);
let assemblyFormat = [{
$v `=` $x
$v `=` $x
oilist( `memory_order` `(` custom<ClauseAttr>($memory_order_val) `)`
| `hint` `(` custom<SynchronizationHint>($hint_val) `)`)
`:` type($x) attr-dict
@ -1329,7 +1329,7 @@ def CancellationPointOp : OpenMP_Op<"cancellationpoint"> {
// 2.19.5.7 declare reduction Directive
//===----------------------------------------------------------------------===//
def ReductionDeclareOp : OpenMP_Op<"reduction.declare", [Symbol,
def ReductionDeclareOp : OpenMP_Op<"reduction.declare", [Symbol,
IsolatedFromAbove]> {
let summary = "declares a reduction kind";

View File

@ -369,7 +369,7 @@ def PDL_OperationOp : PDL_Op<"operation", [AttrSizedOperandSegments]> {
/// Returns true if the operation type referenced supports result type
/// inference.
bool hasTypeInference();
/// Returns true if the operation type referenced might support result type
/// inference, i.e. it supports type reference or is currently not
/// registered in the context. Returns false if the root operation name
@ -411,7 +411,7 @@ def PDL_PatternOp : PDL_Op<"pattern", [
```
}];
let arguments = (ins Confined<I16Attr, [IntNonNegative]>:$benefit,
let arguments = (ins ConfinedAttr<I16Attr, [IntNonNegative]>:$benefit,
OptionalAttr<SymbolNameAttr>:$sym_name);
let regions = (region SizedRegion<1>:$body);
let assemblyFormat = [{

View File

@ -236,7 +236,7 @@ def PDLInterp_CheckOperandCountOp
}];
let arguments = (ins PDL_Operation:$inputOp,
Confined<I32Attr, [IntNonNegative]>:$count,
ConfinedAttr<I32Attr, [IntNonNegative]>:$count,
UnitAttr:$compareAtLeast);
let assemblyFormat = [{
`of` $inputOp `is` (`at_least` $compareAtLeast^)? $count attr-dict
@ -293,7 +293,7 @@ def PDLInterp_CheckResultCountOp
}];
let arguments = (ins PDL_Operation:$inputOp,
Confined<I32Attr, [IntNonNegative]>:$count,
ConfinedAttr<I32Attr, [IntNonNegative]>:$count,
UnitAttr:$compareAtLeast);
let assemblyFormat = [{
`of` $inputOp `is` (`at_least` $compareAtLeast^)? $count attr-dict
@ -552,7 +552,7 @@ def PDLInterp_ExtractOp
}];
let arguments = (ins PDL_RangeOf<PDL_AnyType>:$range,
Confined<I32Attr, [IntNonNegative]>:$index);
ConfinedAttr<I32Attr, [IntNonNegative]>:$index);
let results = (outs PDL_AnyType:$result);
let assemblyFormat = "$index `of` $range `:` type($result) attr-dict";
@ -774,7 +774,7 @@ def PDLInterp_GetOperandOp : PDLInterp_Op<"get_operand", [NoSideEffect]> {
}];
let arguments = (ins PDL_Operation:$inputOp,
Confined<I32Attr, [IntNonNegative]>:$index);
ConfinedAttr<I32Attr, [IntNonNegative]>:$index);
let results = (outs PDL_Value:$value);
let assemblyFormat = "$index `of` $inputOp attr-dict";
}
@ -809,7 +809,7 @@ def PDLInterp_GetOperandsOp : PDLInterp_Op<"get_operands", [NoSideEffect]> {
let arguments = (ins
PDL_Operation:$inputOp,
OptionalAttr<Confined<I32Attr, [IntNonNegative]>>:$index
OptionalAttr<ConfinedAttr<I32Attr, [IntNonNegative]>>:$index
);
let results = (outs PDL_InstOrRangeOf<PDL_Value>:$value);
let assemblyFormat = "($index^)? `of` $inputOp `:` type($value) attr-dict";
@ -841,7 +841,7 @@ def PDLInterp_GetResultOp : PDLInterp_Op<"get_result", [NoSideEffect]> {
}];
let arguments = (ins PDL_Operation:$inputOp,
Confined<I32Attr, [IntNonNegative]>:$index);
ConfinedAttr<I32Attr, [IntNonNegative]>:$index);
let results = (outs PDL_Value:$value);
let assemblyFormat = "$index `of` $inputOp attr-dict";
}
@ -876,7 +876,7 @@ def PDLInterp_GetResultsOp : PDLInterp_Op<"get_results", [NoSideEffect]> {
let arguments = (ins
PDL_Operation:$inputOp,
OptionalAttr<Confined<I32Attr, [IntNonNegative]>>:$index
OptionalAttr<ConfinedAttr<I32Attr, [IntNonNegative]>>:$index
);
let results = (outs PDL_InstOrRangeOf<PDL_Value>:$value);
let assemblyFormat = "($index^)? `of` $inputOp `:` type($value) attr-dict";
@ -1019,7 +1019,7 @@ def PDLInterp_RecordMatchOp
SymbolRefAttr:$rewriter,
OptionalAttr<StrAttr>:$rootKind,
OptionalAttr<StrArrayAttr>:$generatedOps,
Confined<I16Attr, [IntNonNegative]>:$benefit);
ConfinedAttr<I16Attr, [IntNonNegative]>:$benefit);
let successors = (successor AnySuccessor:$dest);
let assemblyFormat = [{
$rewriter (`(` $inputs^ `:` type($inputs) `)`)? `:`

View File

@ -31,7 +31,7 @@ def GetParentForOp : Op<Transform_Dialect, "loop.get_parent_for",
let arguments =
(ins PDL_Operation:$target,
DefaultValuedAttr<Confined<I64Attr, [IntPositive]>,
DefaultValuedAttr<ConfinedAttr<I64Attr, [IntPositive]>,
"1">:$num_loops);
let results = (outs PDL_Operation:$parent);
@ -74,7 +74,7 @@ def LoopPeelOp : Op<Transform_Dialect, "loop.peel",
even if the step always divides the range evenly at runtime.
#### Return modes
This operation ignores non-scf::ForOp ops and drops them in the return.
This operation always succeeds and returns the scf::ForOp with the
@ -92,19 +92,19 @@ def LoopPeelOp : Op<Transform_Dialect, "loop.peel",
let arguments =
(ins PDL_Operation:$target,
DefaultValuedAttr<BoolAttr, "false">:$fail_if_already_divisible);
// TODO: Return both the peeled loop and the remainder loop.
// TODO: Return both the peeled loop and the remainder loop.
let results = (outs PDL_Operation:$transformed);
let assemblyFormat = "$target attr-dict";
let extraClassDeclaration = [{
::mlir::DiagnosedSilenceableFailure applyToOne(
::mlir::scf::ForOp target,
::llvm::SmallVector<::mlir::Operation *> &results,
::mlir::scf::ForOp target,
::llvm::SmallVector<::mlir::Operation *> &results,
::mlir::transform::TransformState &state);
}];
}
def LoopPipelineOp : Op<Transform_Dialect, "loop.pipeline",
[FunctionalStyleTransformOpTrait, MemoryEffectsOpInterface,
TransformOpInterface, TransformEachOpTrait]> {
@ -114,20 +114,20 @@ def LoopPipelineOp : Op<Transform_Dialect, "loop.pipeline",
each of them. That is, performs some amount of reads from memory before the
loop rather than inside the loop, the same amount of writes into memory
after the loop, and updates each iteration to read the data for a following
iteration rather than the current one.
The amount is specified by the attributes.
iteration rather than the current one.
The amount is specified by the attributes.
The values read and about to be stored are transferred as loop iteration
arguments. Currently supports memref and vector transfer operations as
arguments. Currently supports memref and vector transfer operations as
memory reads/writes.
#### Return modes
This operation ignores non-scf::For ops and drops them in the return.
If all the operations referred to by the `target` PDLOperation pipeline
properly, the transform succeeds. Otherwise the transform silently fails.
The return handle points to only the subset of successfully produced
The return handle points to only the subset of successfully produced
pipelined loops, which can be empty.
}];
@ -140,8 +140,8 @@ def LoopPipelineOp : Op<Transform_Dialect, "loop.pipeline",
let extraClassDeclaration = [{
::mlir::DiagnosedSilenceableFailure applyToOne(
::mlir::scf::ForOp target,
::llvm::SmallVector<::mlir::Operation *> &results,
::mlir::scf::ForOp target,
::llvm::SmallVector<::mlir::Operation *> &results,
::mlir::transform::TransformState &state);
}];
}
@ -156,24 +156,24 @@ def LoopUnrollOp : Op<Transform_Dialect, "loop.unroll",
than the loop trip count, the latter is used as the unroll factor instead.
#### Return modes
This operation ignores non-scf::For ops and drops them in the return.
If all the operations referred to by the `target` PDLOperation unroll
properly, the transform succeeds. Otherwise the transform silently fails.
Does not return handles as the operation may result in the loop being
removed after a full unrolling.
}];
let arguments = (ins PDL_Operation:$target,
Confined<I64Attr, [IntPositive]>:$factor);
ConfinedAttr<I64Attr, [IntPositive]>:$factor);
let assemblyFormat = "$target attr-dict";
let extraClassDeclaration = [{
::mlir::DiagnosedSilenceableFailure applyToOne(
::mlir::scf::ForOp target,
::llvm::SmallVector<::mlir::Operation *> &results,
::mlir::scf::ForOp target,
::llvm::SmallVector<::mlir::Operation *> &results,
::mlir::transform::TransformState &state);
}];
}

View File

@ -101,7 +101,7 @@ def Tosa_AnyNumber : AnyTypeOf<[Tosa_Int, Tosa_QuantizedInt, Tosa_Float],
def Tosa_Int32Tensor : TensorOf<[Tosa_Int32]>;
def Tosa_Int32Or64Tensor : TensorOf<[Tosa_Int32Or64]>;
// Either ranked or unranked tensor of TOSA supported element types.
// Either ranked or unranked tensor of TOSA supported element types.
def Tosa_Tensor : TensorOf<[Tosa_AnyNumber]>;
// Must be ranked but no further constraints
def Tosa_RankedTensor : RankedTensorOf<[Tosa_AnyNumber]>;
@ -167,21 +167,21 @@ class ArrayMaxCt<int n> : AttrConstraint<
CPred<"$_self.cast<::mlir::ArrayAttr>().size() <= " # n>,
"with at least " # n # " elements">;
def Tosa_Fp32ArrayAttr2 : Confined<F32ArrayAttr, [ArrayCount<2>]>;
def Tosa_Fp32ArrayAttr3 : Confined<F32ArrayAttr, [ArrayCount<3>]>;
def Tosa_Fp32ArrayAttr4 : Confined<F32ArrayAttr, [ArrayCount<4>]>;
def Tosa_Fp32ArrayAttr5 : Confined<F32ArrayAttr, [ArrayCount<5>]>;
def Tosa_Fp32ArrayAttr6 : Confined<F32ArrayAttr, [ArrayCount<6>]>;
def Tosa_Fp32ArrayAttr2 : ConfinedAttr<F32ArrayAttr, [ArrayCount<2>]>;
def Tosa_Fp32ArrayAttr3 : ConfinedAttr<F32ArrayAttr, [ArrayCount<3>]>;
def Tosa_Fp32ArrayAttr4 : ConfinedAttr<F32ArrayAttr, [ArrayCount<4>]>;
def Tosa_Fp32ArrayAttr5 : ConfinedAttr<F32ArrayAttr, [ArrayCount<5>]>;
def Tosa_Fp32ArrayAttr6 : ConfinedAttr<F32ArrayAttr, [ArrayCount<6>]>;
def Tosa_IntArrayAttr2 : Confined<I64ArrayAttr, [ArrayCount<2>]>;
def Tosa_IntArrayAttr3 : Confined<I64ArrayAttr, [ArrayCount<3>]>;
def Tosa_IntArrayAttr4 : Confined<I64ArrayAttr, [ArrayCount<4>]>;
def Tosa_IntArrayAttr5 : Confined<I64ArrayAttr, [ArrayCount<5>]>;
def Tosa_IntArrayAttr6 : Confined<I64ArrayAttr, [ArrayCount<6>]>;
def Tosa_IntArrayAttr2 : ConfinedAttr<I64ArrayAttr, [ArrayCount<2>]>;
def Tosa_IntArrayAttr3 : ConfinedAttr<I64ArrayAttr, [ArrayCount<3>]>;
def Tosa_IntArrayAttr4 : ConfinedAttr<I64ArrayAttr, [ArrayCount<4>]>;
def Tosa_IntArrayAttr5 : ConfinedAttr<I64ArrayAttr, [ArrayCount<5>]>;
def Tosa_IntArrayAttr6 : ConfinedAttr<I64ArrayAttr, [ArrayCount<6>]>;
def Tosa_IntArrayAttrUpto2 : Confined<I64ArrayAttr, [ArrayMaxCt<2>]>;
def Tosa_IntArrayAttrUpto4 : Confined<I64ArrayAttr, [ArrayMaxCt<4>]>;
def Tosa_IntArrayAttrUpto5 : Confined<I64ArrayAttr, [ArrayMaxCt<5>]>;
def Tosa_IntArrayAttrUpto2 : ConfinedAttr<I64ArrayAttr, [ArrayMaxCt<2>]>;
def Tosa_IntArrayAttrUpto4 : ConfinedAttr<I64ArrayAttr, [ArrayMaxCt<4>]>;
def Tosa_IntArrayAttrUpto5 : ConfinedAttr<I64ArrayAttr, [ArrayMaxCt<5>]>;
//===----------------------------------------------------------------------===//
// Iterable attributes.

View File

@ -693,7 +693,7 @@ class UnrankedTensorOf<list<Type> allowedTypes>
// list, and which additionally satisfies an optional list of predicates.
//
// TODO: use `Constraint` instead of `Pred`, so we can generate a better
// default summary (a la `Confined`).
// default summary (a la `ConfinedAttr`).
class TensorOf<
list<Type> allowedTypes,
list<Pred> preds = [],
@ -1585,7 +1585,7 @@ class ConstantStrAttr<Attr attribute, string val>
// A general mechanism to further confine the given `attr` with all the
// `constraints`. This allows to compose complex constraints out of a series
// of more primitive ones.
class Confined<Attr attr, list<AttrConstraint> constraints> : Attr<
class ConfinedAttr<Attr attr, list<AttrConstraint> constraints> : Attr<
And<!listconcat([attr.predicate],
!foreach(pred, constraints, pred.predicate))>,
!foldl(/*init*/attr.summary, /*list*/constraints,
@ -1603,9 +1603,9 @@ class Confined<Attr attr, list<AttrConstraint> constraints> : Attr<
// An AttrConstraint that holds if all attr constraints specified in
// 'constraints' hold.
class AllAttrConstraintsOf<list<AttrConstraint> constraints> : AttrConstraint<
class AllAttrOf<list<AttrConstraint> constraints> : AttrConstraint<
And<!listconcat([!head(constraints).predicate],
!foreach(pred, !tail(constraints), pred.predicate))>,
!foreach(pred, !tail(constraints), pred.predicate))>,
!interleave(!foreach(con, constraints, con.summary), " and ")> {
}

View File

@ -2100,7 +2100,7 @@ void InsertStridedSliceOp::build(OpBuilder &builder, OperationState &result,
result.addAttribute(getStridesAttrStrName(), stridesAttr);
}
// TODO: Should be moved to Tablegen Confined attributes.
// TODO: Should be moved to Tablegen ConfinedAttr attributes.
template <typename OpType>
static LogicalResult isIntegerArrayAttrSmallerThanShape(OpType op,
ArrayAttr arrayAttr,

View File

@ -170,15 +170,15 @@ def AnyAttrOfOp : TEST_Op<"any_attr_of_i32_str"> {
def NonNegIntAttrOp : TEST_Op<"non_negative_int_attr"> {
let arguments = (ins
Confined<I32Attr, [IntNonNegative]>:$i32attr,
Confined<I64Attr, [IntNonNegative]>:$i64attr
ConfinedAttr<I32Attr, [IntNonNegative]>:$i32attr,
ConfinedAttr<I64Attr, [IntNonNegative]>:$i64attr
);
}
def PositiveIntAttrOp : TEST_Op<"positive_int_attr"> {
let arguments = (ins
Confined<I32Attr, [IntPositive]>:$i32attr,
Confined<I64Attr, [IntPositive]>:$i64attr
ConfinedAttr<I32Attr, [IntPositive]>:$i32attr,
ConfinedAttr<I64Attr, [IntPositive]>:$i64attr
);
}
@ -377,7 +377,7 @@ def OpWithBitEnumVerticalBar : TEST_Op<"op_with_bit_enum_vbar"> {
def SymbolRefOp : TEST_Op<"symbol_ref_attr"> {
let arguments = (ins
Confined<FlatSymbolRefAttr, [ReferToOp<"func::FuncOp">]>:$symbol
ConfinedAttr<FlatSymbolRefAttr, [ReferToOp<"func::FuncOp">]>:$symbol
);
}
@ -1127,7 +1127,7 @@ def : Pattern<(OpNativeCodeCall6 $arg1, $arg2),
[(OpNativeCodeCall7 (BindMultipleNativeCodeCallResult:$native__0 $arg1, $arg2)),
(OpNativeCodeCall7 $native__1)]>;
// Test AllAttrConstraintsOf.
// Test AllAttrOf.
def OpAllAttrConstraint1 : TEST_Op<"all_attr_constraint_of1"> {
let arguments = (ins I64ArrayAttr:$attr);
let results = (outs I32);
@ -1144,7 +1144,7 @@ def Constraint1 : AttrConstraint<
CPred<"$_self.cast<ArrayAttr>()[1].cast<::mlir::IntegerAttr>().getInt() == 1">,
"[1] == 1">;
def : Pat<(OpAllAttrConstraint1
AllAttrConstraintsOf<[Constraint0, Constraint1]>:$attr),
AllAttrOf<[Constraint0, Constraint1]>:$attr),
(OpAllAttrConstraint2 $attr)>;
// Op for testing RewritePattern removing op with inner ops.

View File

@ -10,7 +10,7 @@ def OpAllSingle : Op<Test_Dialect, "all_single"> {
let arguments = (ins
I64:$operand,
I64Attr:$attr,
Confined<I64Attr, [IntNonNegative]>:$nonNegativeAttr
ConfinedAttr<I64Attr, [IntNonNegative]>:$nonNegativeAttr
);
let results = (outs I64:$result);
}

View File

@ -50,7 +50,7 @@ def OpB : NS_Op<"op_for_And_PredOpTrait", [
// CHECK: if (!(((first)) && ((second))))
def OpF : NS_Op<"op_for_int_min_val", []> {
let arguments = (ins Confined<I32Attr, [IntMinValue<10>]>:$attr);
let arguments = (ins ConfinedAttr<I32Attr, [IntMinValue<10>]>:$attr);
}
// CHECK-LABEL: OpFAdaptor::verify
@ -58,7 +58,7 @@ def OpF : NS_Op<"op_for_int_min_val", []> {
// CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 10"
def OpFX : NS_Op<"op_for_int_max_val", []> {
let arguments = (ins Confined<I32Attr, [IntMaxValue<10>]>:$attr);
let arguments = (ins ConfinedAttr<I32Attr, [IntMaxValue<10>]>:$attr);
}
// CHECK-LABEL: OpFXAdaptor::verify
@ -66,7 +66,7 @@ def OpFX : NS_Op<"op_for_int_max_val", []> {
// CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: 32-bit signless integer attribute whose maximum value is 10"
def OpG : NS_Op<"op_for_arr_min_count", []> {
let arguments = (ins Confined<ArrayAttr, [ArrayMinCount<8>]>:$attr);
let arguments = (ins ConfinedAttr<ArrayAttr, [ArrayMinCount<8>]>:$attr);
}
// CHECK-LABEL: OpGAdaptor::verify
@ -74,7 +74,7 @@ def OpG : NS_Op<"op_for_arr_min_count", []> {
// CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: array attribute with at least 8 elements"
def OpH : NS_Op<"op_for_arr_value_at_index", []> {
let arguments = (ins Confined<ArrayAttr, [IntArrayNthElemEq<0, 8>]>:$attr);
let arguments = (ins ConfinedAttr<ArrayAttr, [IntArrayNthElemEq<0, 8>]>:$attr);
}
// CHECK-LABEL: OpHAdaptor::verify
@ -82,7 +82,7 @@ def OpH : NS_Op<"op_for_arr_value_at_index", []> {
// CHECK-NEXT: "attribute 'attr' failed to satisfy constraint: array attribute whose 0-th element must be 8"
def OpI: NS_Op<"op_for_arr_min_value_at_index", []> {
let arguments = (ins Confined<ArrayAttr, [IntArrayNthElemMinValue<0, 8>]>:$attr);
let arguments = (ins ConfinedAttr<ArrayAttr, [IntArrayNthElemMinValue<0, 8>]>:$attr);
}
// CHECK-LABEL: OpIAdaptor::verify