[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 let arguments = (ins
TF_FpTensor:$value, TF_FpTensor:$value,
Confined<I64ArrayAttr, [ArrayMinCount<4>]>:$ksize, ConfinedAttr<I64ArrayAttr, [ArrayMinCount<4>]>:$ksize,
Confined<I64ArrayAttr, [ArrayMinCount<4>]>:$strides, ConfinedAttr<I64ArrayAttr, [ArrayMinCount<4>]>:$strides,
TF_AnyStrAttrOf<["SAME", "VALID"]>:$padding, TF_AnyStrAttrOf<["SAME", "VALID"]>:$padding,
DefaultValuedAttr<TF_ConvertDataFormatAttr, "NHWC">:$data_format 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 #### 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 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 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: Right now, the following primitive constraints are supported:
@ -1287,7 +1287,7 @@ optionality, default values, etc.:
* `DefaultValuedAttr`: specifies the * `DefaultValuedAttr`: specifies the
[default value](#attributes-with-default-values) for an attribute. [default value](#attributes-with-default-values) for an attribute.
* `OptionalAttr`: specifies an attribute as [optional](#optional-attributes). * `OptionalAttr`: specifies an attribute as [optional](#optional-attributes).
* `Confined`: adapts an attribute with * `ConfinedAttr`: adapts an attribute with
[further constraints](#confining-attributes). [further constraints](#confining-attributes).
### Enum attributes ### Enum attributes

View File

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

View File

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

View File

@ -1201,7 +1201,7 @@ def LLVM_GlobalOp : LLVM_Op<"mlir.global",
UnitAttr:$thread_local_, UnitAttr:$thread_local_,
OptionalAttr<AnyAttr>:$value, OptionalAttr<AnyAttr>:$value,
OptionalAttr<I64Attr>:$alignment, OptionalAttr<I64Attr>:$alignment,
DefaultValuedAttr<Confined<I32Attr, [IntNonNegative]>, "0">:$addr_space, DefaultValuedAttr<ConfinedAttr<I32Attr, [IntNonNegative]>, "0">:$addr_space,
OptionalAttr<UnnamedAddr>:$unnamed_addr, OptionalAttr<UnnamedAddr>:$unnamed_addr,
OptionalAttr<StrAttr>:$section 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]>, 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)> { Results<(outs Index:$result)> {
let summary = "linalg index operation"; let summary = "linalg index operation";
let description = [{ let description = [{

View File

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

View File

@ -240,7 +240,7 @@ def SectionsOp : OpenMP_Op<"sections", [AttrSizedOperandSegments,
def SingleOp : OpenMP_Op<"single", [AttrSizedOperandSegments]> { def SingleOp : OpenMP_Op<"single", [AttrSizedOperandSegments]> {
let summary = "single directive"; let summary = "single directive";
let description = [{ 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 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 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 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, OptionalAttr<ScheduleModifierAttr>:$schedule_modifier,
UnitAttr:$simd_modifier, UnitAttr:$simd_modifier,
UnitAttr:$nowait, UnitAttr:$nowait,
Confined<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$ordered_val, ConfinedAttr<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$ordered_val,
OptionalAttr<OrderKindAttr>:$order_val, OptionalAttr<OrderKindAttr>:$order_val,
UnitAttr:$inclusive); 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, def SimdLoopOp : OpenMP_Op<"simdloop", [AttrSizedOperandSegments,
AllTypesMatch<["lowerBound", "upperBound", "step"]>]> { AllTypesMatch<["lowerBound", "upperBound", "step"]>]> {
let summary = "simd loop construct"; let summary = "simd loop construct";
let description = [{ let description = [{
The simd construct can be applied to a loop to indicate that the loop can be 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 transformed into a SIMD loop (that is, multiple iterations of the loop can
be executed concurrently using SIMD instructions).. The lower and upper be executed concurrently using SIMD instructions).. The lower and upper
bounds specify a half-open range: the range includes the lower bound but 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 does not include the upper bound. If the `inclusive` attribute is specified
then the upper bound is also included. then the upper bound is also included.
@ -424,7 +424,7 @@ def SimdLoopOp : OpenMP_Op<"simdloop", [AttrSizedOperandSegments,
// block operations // block operations
omp.yield omp.yield
} }
``` ```
}]; }];
// TODO: Add other clauses // TODO: Add other clauses
@ -432,10 +432,10 @@ def SimdLoopOp : OpenMP_Op<"simdloop", [AttrSizedOperandSegments,
Variadic<IntLikeType>:$upperBound, Variadic<IntLikeType>:$upperBound,
Variadic<IntLikeType>:$step, Variadic<IntLikeType>:$step,
Optional<I1>:$if_expr, Optional<I1>:$if_expr,
Confined<OptionalAttr<I64Attr>, [IntPositive]>:$simdlen, ConfinedAttr<OptionalAttr<I64Attr>, [IntPositive]>:$simdlen,
UnitAttr:$inclusive UnitAttr:$inclusive
); );
let regions = (region AnyRegion:$region); let regions = (region AnyRegion:$region);
let assemblyFormat = [{ let assemblyFormat = [{
oilist(`if` `(` $if_expr `)` oilist(`if` `(` $if_expr `)`
@ -449,15 +449,15 @@ def SimdLoopOp : OpenMP_Op<"simdloop", [AttrSizedOperandSegments,
unsigned getNumLoops() { return lowerBound().size(); } unsigned getNumLoops() { return lowerBound().size(); }
}]; }];
let hasCustomAssemblyFormat = 1; let hasCustomAssemblyFormat = 1;
let hasVerifier = 1; let hasVerifier = 1;
} }
def YieldOp : OpenMP_Op<"yield", def YieldOp : OpenMP_Op<"yield",
[NoSideEffect, ReturnLike, Terminator, [NoSideEffect, ReturnLike, Terminator,
ParentOneOf<["WsLoopOp", "ReductionDeclareOp", ParentOneOf<["WsLoopOp", "ReductionDeclareOp",
"AtomicUpdateOp", "SimdLoopOp"]>]> { "AtomicUpdateOp", "SimdLoopOp"]>]> {
let summary = "loop yield and termination operation"; let summary = "loop yield and termination operation";
let description = [{ let description = [{
@ -967,7 +967,7 @@ def OrderedOp : OpenMP_Op<"ordered"> {
}]; }];
let arguments = (ins OptionalAttr<ClauseDependAttr>:$depend_type_val, 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); Variadic<AnyType>:$depend_vec_vars);
let assemblyFormat = [{ let assemblyFormat = [{
@ -1046,7 +1046,7 @@ def AtomicReadOp : OpenMP_Op<"atomic.read", [AllTypesMatch<["x", "v"]>]> {
DefaultValuedAttr<I64Attr, "0">:$hint_val, DefaultValuedAttr<I64Attr, "0">:$hint_val,
OptionalAttr<MemoryOrderKindAttr>:$memory_order_val); OptionalAttr<MemoryOrderKindAttr>:$memory_order_val);
let assemblyFormat = [{ let assemblyFormat = [{
$v `=` $x $v `=` $x
oilist( `memory_order` `(` custom<ClauseAttr>($memory_order_val) `)` oilist( `memory_order` `(` custom<ClauseAttr>($memory_order_val) `)`
| `hint` `(` custom<SynchronizationHint>($hint_val) `)`) | `hint` `(` custom<SynchronizationHint>($hint_val) `)`)
`:` type($x) attr-dict `:` type($x) attr-dict
@ -1329,7 +1329,7 @@ def CancellationPointOp : OpenMP_Op<"cancellationpoint"> {
// 2.19.5.7 declare reduction Directive // 2.19.5.7 declare reduction Directive
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
def ReductionDeclareOp : OpenMP_Op<"reduction.declare", [Symbol, def ReductionDeclareOp : OpenMP_Op<"reduction.declare", [Symbol,
IsolatedFromAbove]> { IsolatedFromAbove]> {
let summary = "declares a reduction kind"; 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 /// Returns true if the operation type referenced supports result type
/// inference. /// inference.
bool hasTypeInference(); bool hasTypeInference();
/// Returns true if the operation type referenced might support result type /// Returns true if the operation type referenced might support result type
/// inference, i.e. it supports type reference or is currently not /// inference, i.e. it supports type reference or is currently not
/// registered in the context. Returns false if the root operation name /// 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); OptionalAttr<SymbolNameAttr>:$sym_name);
let regions = (region SizedRegion<1>:$body); let regions = (region SizedRegion<1>:$body);
let assemblyFormat = [{ let assemblyFormat = [{

View File

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

View File

@ -31,7 +31,7 @@ def GetParentForOp : Op<Transform_Dialect, "loop.get_parent_for",
let arguments = let arguments =
(ins PDL_Operation:$target, (ins PDL_Operation:$target,
DefaultValuedAttr<Confined<I64Attr, [IntPositive]>, DefaultValuedAttr<ConfinedAttr<I64Attr, [IntPositive]>,
"1">:$num_loops); "1">:$num_loops);
let results = (outs PDL_Operation:$parent); 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. even if the step always divides the range evenly at runtime.
#### Return modes #### Return modes
This operation ignores non-scf::ForOp ops and drops them in the return. This operation ignores non-scf::ForOp ops and drops them in the return.
This operation always succeeds and returns the scf::ForOp with the This operation always succeeds and returns the scf::ForOp with the
@ -92,19 +92,19 @@ def LoopPeelOp : Op<Transform_Dialect, "loop.peel",
let arguments = let arguments =
(ins PDL_Operation:$target, (ins PDL_Operation:$target,
DefaultValuedAttr<BoolAttr, "false">:$fail_if_already_divisible); 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 results = (outs PDL_Operation:$transformed);
let assemblyFormat = "$target attr-dict"; let assemblyFormat = "$target attr-dict";
let extraClassDeclaration = [{ let extraClassDeclaration = [{
::mlir::DiagnosedSilenceableFailure applyToOne( ::mlir::DiagnosedSilenceableFailure applyToOne(
::mlir::scf::ForOp target, ::mlir::scf::ForOp target,
::llvm::SmallVector<::mlir::Operation *> &results, ::llvm::SmallVector<::mlir::Operation *> &results,
::mlir::transform::TransformState &state); ::mlir::transform::TransformState &state);
}]; }];
} }
def LoopPipelineOp : Op<Transform_Dialect, "loop.pipeline", def LoopPipelineOp : Op<Transform_Dialect, "loop.pipeline",
[FunctionalStyleTransformOpTrait, MemoryEffectsOpInterface, [FunctionalStyleTransformOpTrait, MemoryEffectsOpInterface,
TransformOpInterface, TransformEachOpTrait]> { 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 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 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 after the loop, and updates each iteration to read the data for a following
iteration rather than the current one. iteration rather than the current one.
The amount is specified by the attributes. The amount is specified by the attributes.
The values read and about to be stored are transferred as loop iteration 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. memory reads/writes.
#### Return modes #### Return modes
This operation ignores non-scf::For ops and drops them in the return. This operation ignores non-scf::For ops and drops them in the return.
If all the operations referred to by the `target` PDLOperation pipeline If all the operations referred to by the `target` PDLOperation pipeline
properly, the transform succeeds. Otherwise the transform silently fails. 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. pipelined loops, which can be empty.
}]; }];
@ -140,8 +140,8 @@ def LoopPipelineOp : Op<Transform_Dialect, "loop.pipeline",
let extraClassDeclaration = [{ let extraClassDeclaration = [{
::mlir::DiagnosedSilenceableFailure applyToOne( ::mlir::DiagnosedSilenceableFailure applyToOne(
::mlir::scf::ForOp target, ::mlir::scf::ForOp target,
::llvm::SmallVector<::mlir::Operation *> &results, ::llvm::SmallVector<::mlir::Operation *> &results,
::mlir::transform::TransformState &state); ::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. than the loop trip count, the latter is used as the unroll factor instead.
#### Return modes #### Return modes
This operation ignores non-scf::For ops and drops them in the return. This operation ignores non-scf::For ops and drops them in the return.
If all the operations referred to by the `target` PDLOperation unroll If all the operations referred to by the `target` PDLOperation unroll
properly, the transform succeeds. Otherwise the transform silently fails. properly, the transform succeeds. Otherwise the transform silently fails.
Does not return handles as the operation may result in the loop being Does not return handles as the operation may result in the loop being
removed after a full unrolling. removed after a full unrolling.
}]; }];
let arguments = (ins PDL_Operation:$target, let arguments = (ins PDL_Operation:$target,
Confined<I64Attr, [IntPositive]>:$factor); ConfinedAttr<I64Attr, [IntPositive]>:$factor);
let assemblyFormat = "$target attr-dict"; let assemblyFormat = "$target attr-dict";
let extraClassDeclaration = [{ let extraClassDeclaration = [{
::mlir::DiagnosedSilenceableFailure applyToOne( ::mlir::DiagnosedSilenceableFailure applyToOne(
::mlir::scf::ForOp target, ::mlir::scf::ForOp target,
::llvm::SmallVector<::mlir::Operation *> &results, ::llvm::SmallVector<::mlir::Operation *> &results,
::mlir::transform::TransformState &state); ::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_Int32Tensor : TensorOf<[Tosa_Int32]>;
def Tosa_Int32Or64Tensor : TensorOf<[Tosa_Int32Or64]>; 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]>; def Tosa_Tensor : TensorOf<[Tosa_AnyNumber]>;
// Must be ranked but no further constraints // Must be ranked but no further constraints
def Tosa_RankedTensor : RankedTensorOf<[Tosa_AnyNumber]>; def Tosa_RankedTensor : RankedTensorOf<[Tosa_AnyNumber]>;
@ -167,21 +167,21 @@ class ArrayMaxCt<int n> : AttrConstraint<
CPred<"$_self.cast<::mlir::ArrayAttr>().size() <= " # n>, CPred<"$_self.cast<::mlir::ArrayAttr>().size() <= " # n>,
"with at least " # n # " elements">; "with at least " # n # " elements">;
def Tosa_Fp32ArrayAttr2 : Confined<F32ArrayAttr, [ArrayCount<2>]>; def Tosa_Fp32ArrayAttr2 : ConfinedAttr<F32ArrayAttr, [ArrayCount<2>]>;
def Tosa_Fp32ArrayAttr3 : Confined<F32ArrayAttr, [ArrayCount<3>]>; def Tosa_Fp32ArrayAttr3 : ConfinedAttr<F32ArrayAttr, [ArrayCount<3>]>;
def Tosa_Fp32ArrayAttr4 : Confined<F32ArrayAttr, [ArrayCount<4>]>; def Tosa_Fp32ArrayAttr4 : ConfinedAttr<F32ArrayAttr, [ArrayCount<4>]>;
def Tosa_Fp32ArrayAttr5 : Confined<F32ArrayAttr, [ArrayCount<5>]>; def Tosa_Fp32ArrayAttr5 : ConfinedAttr<F32ArrayAttr, [ArrayCount<5>]>;
def Tosa_Fp32ArrayAttr6 : Confined<F32ArrayAttr, [ArrayCount<6>]>; def Tosa_Fp32ArrayAttr6 : ConfinedAttr<F32ArrayAttr, [ArrayCount<6>]>;
def Tosa_IntArrayAttr2 : Confined<I64ArrayAttr, [ArrayCount<2>]>; def Tosa_IntArrayAttr2 : ConfinedAttr<I64ArrayAttr, [ArrayCount<2>]>;
def Tosa_IntArrayAttr3 : Confined<I64ArrayAttr, [ArrayCount<3>]>; def Tosa_IntArrayAttr3 : ConfinedAttr<I64ArrayAttr, [ArrayCount<3>]>;
def Tosa_IntArrayAttr4 : Confined<I64ArrayAttr, [ArrayCount<4>]>; def Tosa_IntArrayAttr4 : ConfinedAttr<I64ArrayAttr, [ArrayCount<4>]>;
def Tosa_IntArrayAttr5 : Confined<I64ArrayAttr, [ArrayCount<5>]>; def Tosa_IntArrayAttr5 : ConfinedAttr<I64ArrayAttr, [ArrayCount<5>]>;
def Tosa_IntArrayAttr6 : Confined<I64ArrayAttr, [ArrayCount<6>]>; def Tosa_IntArrayAttr6 : ConfinedAttr<I64ArrayAttr, [ArrayCount<6>]>;
def Tosa_IntArrayAttrUpto2 : Confined<I64ArrayAttr, [ArrayMaxCt<2>]>; def Tosa_IntArrayAttrUpto2 : ConfinedAttr<I64ArrayAttr, [ArrayMaxCt<2>]>;
def Tosa_IntArrayAttrUpto4 : Confined<I64ArrayAttr, [ArrayMaxCt<4>]>; def Tosa_IntArrayAttrUpto4 : ConfinedAttr<I64ArrayAttr, [ArrayMaxCt<4>]>;
def Tosa_IntArrayAttrUpto5 : Confined<I64ArrayAttr, [ArrayMaxCt<5>]>; def Tosa_IntArrayAttrUpto5 : ConfinedAttr<I64ArrayAttr, [ArrayMaxCt<5>]>;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Iterable attributes. // Iterable attributes.

View File

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

View File

@ -2100,7 +2100,7 @@ void InsertStridedSliceOp::build(OpBuilder &builder, OperationState &result,
result.addAttribute(getStridesAttrStrName(), stridesAttr); result.addAttribute(getStridesAttrStrName(), stridesAttr);
} }
// TODO: Should be moved to Tablegen Confined attributes. // TODO: Should be moved to Tablegen ConfinedAttr attributes.
template <typename OpType> template <typename OpType>
static LogicalResult isIntegerArrayAttrSmallerThanShape(OpType op, static LogicalResult isIntegerArrayAttrSmallerThanShape(OpType op,
ArrayAttr arrayAttr, 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"> { def NonNegIntAttrOp : TEST_Op<"non_negative_int_attr"> {
let arguments = (ins let arguments = (ins
Confined<I32Attr, [IntNonNegative]>:$i32attr, ConfinedAttr<I32Attr, [IntNonNegative]>:$i32attr,
Confined<I64Attr, [IntNonNegative]>:$i64attr ConfinedAttr<I64Attr, [IntNonNegative]>:$i64attr
); );
} }
def PositiveIntAttrOp : TEST_Op<"positive_int_attr"> { def PositiveIntAttrOp : TEST_Op<"positive_int_attr"> {
let arguments = (ins let arguments = (ins
Confined<I32Attr, [IntPositive]>:$i32attr, ConfinedAttr<I32Attr, [IntPositive]>:$i32attr,
Confined<I64Attr, [IntPositive]>:$i64attr ConfinedAttr<I64Attr, [IntPositive]>:$i64attr
); );
} }
@ -377,7 +377,7 @@ def OpWithBitEnumVerticalBar : TEST_Op<"op_with_bit_enum_vbar"> {
def SymbolRefOp : TEST_Op<"symbol_ref_attr"> { def SymbolRefOp : TEST_Op<"symbol_ref_attr"> {
let arguments = (ins 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 (BindMultipleNativeCodeCallResult:$native__0 $arg1, $arg2)),
(OpNativeCodeCall7 $native__1)]>; (OpNativeCodeCall7 $native__1)]>;
// Test AllAttrConstraintsOf. // Test AllAttrOf.
def OpAllAttrConstraint1 : TEST_Op<"all_attr_constraint_of1"> { def OpAllAttrConstraint1 : TEST_Op<"all_attr_constraint_of1"> {
let arguments = (ins I64ArrayAttr:$attr); let arguments = (ins I64ArrayAttr:$attr);
let results = (outs I32); let results = (outs I32);
@ -1144,7 +1144,7 @@ def Constraint1 : AttrConstraint<
CPred<"$_self.cast<ArrayAttr>()[1].cast<::mlir::IntegerAttr>().getInt() == 1">, CPred<"$_self.cast<ArrayAttr>()[1].cast<::mlir::IntegerAttr>().getInt() == 1">,
"[1] == 1">; "[1] == 1">;
def : Pat<(OpAllAttrConstraint1 def : Pat<(OpAllAttrConstraint1
AllAttrConstraintsOf<[Constraint0, Constraint1]>:$attr), AllAttrOf<[Constraint0, Constraint1]>:$attr),
(OpAllAttrConstraint2 $attr)>; (OpAllAttrConstraint2 $attr)>;
// Op for testing RewritePattern removing op with inner ops. // 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 let arguments = (ins
I64:$operand, I64:$operand,
I64Attr:$attr, I64Attr:$attr,
Confined<I64Attr, [IntNonNegative]>:$nonNegativeAttr ConfinedAttr<I64Attr, [IntNonNegative]>:$nonNegativeAttr
); );
let results = (outs I64:$result); let results = (outs I64:$result);
} }

View File

@ -50,7 +50,7 @@ def OpB : NS_Op<"op_for_And_PredOpTrait", [
// CHECK: if (!(((first)) && ((second)))) // CHECK: if (!(((first)) && ((second))))
def OpF : NS_Op<"op_for_int_min_val", []> { 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 // 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" // 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", []> { 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 // 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" // 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", []> { 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 // 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" // 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", []> { 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 // 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" // 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", []> { 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 // CHECK-LABEL: OpIAdaptor::verify