diff options
45 files changed, 773 insertions, 773 deletions
diff --git a/mlir/g3doc/Canonicalization.md b/mlir/g3doc/Canonicalization.md index d209ad9bb65..7203ac9b66f 100644 --- a/mlir/g3doc/Canonicalization.md +++ b/mlir/g3doc/Canonicalization.md @@ -53,7 +53,7 @@ These transformation are applied to all levels of IR: These transformations are applied to builtin ops: * `constant` ops are uniqued and hoisted into the entry block of a function. -* (TODO) Merge `affine_apply` instructions that directly feed each other. +* (TODO) Merge `affine.apply` instructions that directly feed each other. ## Standard Ops Canonicalizations diff --git a/mlir/g3doc/Dialects/Affine.md b/mlir/g3doc/Dialects/Affine.md index 80b79d09c3c..6af24668d99 100644 --- a/mlir/g3doc/Dialects/Affine.md +++ b/mlir/g3doc/Dialects/Affine.md @@ -12,28 +12,28 @@ identifier can be bound to an SSA value that is either an argument to the function, a value defined at the top level of that function (outside of all loops and if instructions), the result of a [`constant` operation](LangRef.md#'constant'-operation), or the result of an -[`affine_apply` operation](#'affine_apply'-operation) that recursively takes as +[`affine.apply` operation](#'affine.apply'-operation) that recursively takes as arguments any symbolic identifiers. Dimensions may be bound not only to anything that a symbol is bound to, but also to induction variables of enclosing [for instructions](#'for'-operation), and the result of an -[`affine_apply` operation](#'affine_apply'-operation) (which recursively may use +[`affine.apply` operation](#'affine.apply'-operation) (which recursively may use other dimensions and symbols). ## Operations {#operations} -#### 'affine_apply' operation {#'affine_apply'-operation} +#### 'affine.apply' operation {#'affine.apply'-operation} Syntax: ``` {.ebnf} -operation ::= ssa-id `=` `affine_apply` affine-map dim-and-symbol-use-list +operation ::= ssa-id `=` `affine.apply` affine-map dim-and-symbol-use-list ``` -The `affine_apply` instruction applies an +The `affine.apply` instruction applies an [affine mapping](LangRef.md#affine-expressions) to a list of SSA values, yielding a single SSA value. The number of dimension and symbol arguments to -affine_apply must be equal to the respective number of dimensional and symbolic -inputs to the affine mapping; the `affine_apply` instruction always returns one +affine.apply must be equal to the respective number of dimensional and symbolic +inputs to the affine mapping; the `affine.apply` instruction always returns one value. The input operands and result must all have 'index' type. Example: @@ -41,10 +41,10 @@ Example: ```mlir {.mlir} #map10 = (d0, d1) -> (floordiv(d0,8) + floordiv(d1,128)) ... -%1 = affine_apply #map10 (%s, %t) +%1 = affine.apply #map10 (%s, %t) // Inline example. -%2 = affine_apply (i)[s0] -> (i+s0) (%42)[%n] +%2 = affine.apply (i)[s0] -> (i+s0) (%42)[%n] ``` #### 'for' operation {#'for'-operation} @@ -96,7 +96,7 @@ func @simple_example(%A: memref<?x?xf32>, %B: memref<?x?xf32>) { %N = dim %A, 0 : memref<?x?xf32> for %i = 0 to %N step 1 { for %j = 0 to %N { // implicitly steps by 1 - %0 = affine_apply #map57(%j)[%N] + %0 = affine.apply #map57(%j)[%N] %tmp = call @F1(%A, %i, %0) : (memref<?x?xf32>, index, index)->(f32) call @F2(%tmp, %B, %i, %0) : (f32, memref<?x?xf32>, index, index)->() } @@ -132,10 +132,10 @@ Example: func @reduced_domain_example(%A, %X, %N) : (memref<10xi32>, i32, i32) { for %i = 0 to %N { for %j = 0 to %N { - %0 = affine_apply #map42(%j) + %0 = affine.apply #map42(%j) %tmp = call @S1(%X, %i, %0) if #set(%i, %j)[%N] { - %1 = affine_apply #map43(%i, %j) + %1 = affine.apply #map43(%i, %j) call @S2(%tmp, %A, %i, %1) } } diff --git a/mlir/g3doc/LangRef.md b/mlir/g3doc/LangRef.md index 55fa366c48e..1858b7515eb 100644 --- a/mlir/g3doc/LangRef.md +++ b/mlir/g3doc/LangRef.md @@ -332,7 +332,7 @@ dimension indices and symbols into a list of results, with affine expressions combining the indices and symbols. Affine maps distinguish between [indices and symbols](#dimensions-and-symbols) because indices are inputs to the affine map when the latter may be called through an operation, such as -[affine_apply](Dialects/Affine.md#'affine_apply'-operation) operation, whereas +[affine.apply](Dialects/Affine.md#'affine.apply'-operation) operation, whereas symbols are bound when an affine mapping is established (e.g. when a memref is formed, establishing a memory [layout map](#layout-map)). @@ -1216,7 +1216,7 @@ Example: // Create memref which reshapes from 16x?xf32 to 16x4x?xf32. #imapDR = (i, j, k)[S0] -> (i, j * S0 + k) size (16, 4 * S0) -%N4 = affine_apply (S -> floordiv(S,4)) (%N) +%N4 = affine.apply (S -> floordiv(S,4)) (%N) %DR = reshape %D : memref<16x?xf32, #lmapD, hbm> (%N4)[%N4] to (memref<16x?xf32, #lmapD, hbm> -> memref<16x4x?xf32, #imapDR, hbm>) @@ -1438,26 +1438,26 @@ In an `if` or `for` body, the indices of a load are restricted to SSA values bound to surrounding loop induction variables, [symbols](#dimensions-and-symbols), results of a [`constant` operation](#'constant'-operation), or the result of an -`affine_apply` operation that can in turn take as arguments all of the -aforementioned SSA values or the recursively result of such an `affine_apply` +`affine.apply` operation that can in turn take as arguments all of the +aforementioned SSA values or the recursively result of such an `affine.apply` operation. Example: ```mlir {.mlir} -%1 = affine_apply (d0, d1) -> (3*d0) (%i, %j) -%2 = affine_apply (d0, d1) -> (d1+1) (%i, %j) +%1 = affine.apply (d0, d1) -> (3*d0) (%i, %j) +%2 = affine.apply (d0, d1) -> (d1+1) (%i, %j) %12 = load %A[%1, %2] : memref<8x?xi32, #layout, hbm> // Example of an indirect load (treated as non-affine) -%3 = affine_apply (d0) -> (2*d0 + 1)(%12) +%3 = affine.apply (d0) -> (2*d0 + 1)(%12) %13 = load %A[%3, %2] : memref<4x?xi32, #layout, hbm> ``` **Context:** The `load` and `store` instructions are specifically crafted to fully resolve a reference to an element of a memref, and (in affine `if` and `for` instructions) the compiler can follow use-def chains (e.g. through -[`affine_apply`](Dialects/Affine.md#'affine_apply'-operation) operations) to +[`affine.apply`](Dialects/Affine.md#'affine.apply'-operation) operations) to precisely analyze references at compile-time using polyhedral techniques. This is possible because of the [restrictions on dimensions and symbols](Dialects/Affine.md#restrictions-on-dimensions-and-symbols) @@ -1480,9 +1480,9 @@ In an affine context, the indices of a store are restricted to SSA values bound to surrounding loop induction variables, [symbols](Dialect/Affine.md#restrictions-on-dimensions-and-symbols), results of a [`constant` operation](#'constant'-operation), or the result of an -[`affine_apply`](Dialect/Affine.md#'affine_apply'-operation) operation that can +[`affine.apply`](Dialect/Affine.md#'affine.apply'-operation) operation that can in turn take as arguments all of the aforementioned SSA values or the -recursively result of such an `affine_apply` operation. +recursively result of such an `affine.apply` operation. Example: @@ -1493,7 +1493,7 @@ store %100, %A[%1, 1023] : memref<4x?xf32, #layout, hbm> **Context:** The `load` and `store` instructions are specifically crafted to fully resolve a reference to an element of a memref, and (in polyhedral `if` and `for` instructions) the compiler can follow use-def chains (e.g. through -[`affine_apply`](Dialects/Affine.md#'affine_apply'-operation) operations) to +[`affine.apply`](Dialects/Affine.md#'affine.apply'-operation) operations) to precisely analyze references at compile-time using polyhedral techniques. This is possible because of the [restrictions on dimensions and symbols](Dialect/Affine.md#restrictions-on-dimensions-and-symbols) diff --git a/mlir/g3doc/Passes.md b/mlir/g3doc/Passes.md index ad682e8ede3..18f6b7b1c23 100644 --- a/mlir/g3doc/Passes.md +++ b/mlir/g3doc/Passes.md @@ -13,12 +13,12 @@ Loop statements are converted to a subgraph of blocks (initialization, condition checking, subgraph of body blocks) with loop induction variable being passed as the block argument of the condition checking block. Conditional statements are converted to a subgraph of blocks (chain of condition checking with -short-circuit logic, subgraphs of 'then' and 'else' body blocks). `affine_apply` +short-circuit logic, subgraphs of 'then' and 'else' body blocks). `affine.apply` operations are converted into sequences of primitive arithmetic operations that have the same effect, using operands of the `index` type. Consequently, named maps and sets may be removed from the module. -For example, `%r = affine_apply (d0, d1)[s0] -> (d0 + 2*d1 + s0)(%d0, %d1)[%s0]` +For example, `%r = affine.apply (d0, d1)[s0] -> (d0 + 2*d1 + s0)(%d0, %d1)[%s0]` can be converted into: ```mlir @@ -49,7 +49,7 @@ present before the pass. - The semantics of the other functions is preserved. - Individual operations other than those mentioned above are not modified if they do not depend on the loop iterator value or on the result of - `affine_apply`. + `affine.apply`. ## Standard+Builtin to LLVM IR dialect conversion (`-convert-to-llvmir`) {#convert-to-llvmir} diff --git a/mlir/g3doc/Rationale.md b/mlir/g3doc/Rationale.md index cbf93621646..58ad1670d15 100644 --- a/mlir/g3doc/Rationale.md +++ b/mlir/g3doc/Rationale.md @@ -116,7 +116,7 @@ n-ranked tensor. This disallows the equivalent of pointer arithmetic or the ability to index into the same memref in other ways (something which C arrays allow for example). Furthermore, in an affine construct, the compiler can follow use-def chains (e.g. through -[affine_apply instructions](Dialects/Affine.md#'affine_apply'-operation)) to +[affine.apply instructions](Dialects/Affine.md#'affine.apply'-operation)) to precisely analyze references at compile-time using polyhedral techniques. This is possible because of the [restrictions on dimensions and symbols](Dialects/Affine.md#restrictions-on-dimensions-and-symbols). @@ -238,7 +238,7 @@ LLVM 2.0. Index types are not allowed as elements of `vector`, `tensor` or `memref` type. Index types are intended to be used for platform-specific "size" values and may appear in subscripts, sizes of aggregate types and affine expressions. They are -also tightly coupled with `affine_apply` and load/store operations; having +also tightly coupled with `affine.apply` and load/store operations; having `index` type is a necessary precondition of a value to be acceptable by these operations. While it may be useful to have `memref<?xindex>` to express indirect accesses in MLFunctions, e.g. sparse matrix manipulations or lookup tables, it @@ -567,7 +567,7 @@ func @search_body(%A: memref<?x?xi32>, %S: memref<?xi32>, %key: i32) { ``` As per the [MLIR spec](LangRef.md), the restrictions on dimensions and symbol -identifiers to be used with the affine_apply instruction only apply to accesses +identifiers to be used with the affine.apply instruction only apply to accesses inside `for` and `if` instructions. However, an analysis of accesses inside the called function (`@search_body`) is necessary to determine if the `%i` loop could be parallelized: such function access analysis is calling context @@ -657,18 +657,18 @@ func @conv2d(memref<16x1024x1024x3xf32, #lm0, vmem> %input, for %kw = 0 to %kernel_width { for %if = 0 to %input_feature { // Calculate input indices. - %1_0 = affine_apply #map1_0 (%0#1, %0#2, %0#4, %0#5) + %1_0 = affine.apply #map1_0 (%0#1, %0#2, %0#4, %0#5) [%h_stride, %w_stride, %h_kernel_dilation, %w_kernel_dilation, %h_pad_low, %w_pad_low] - %1_1 = affine_apply #map1_1 (%0#1, %0#2, %0#4, %0#5) + %1_1 = affine.apply #map1_1 (%0#1, %0#2, %0#4, %0#5) [%h_stride, %w_stride, %h_kernel_dilation, %w_kernel_dilation, %h_pad_low, %w_pad_low] // Check if access is not in padding. if #domain(%1_0, %1_1) [%h_base_dilation, %w_kernel_dilation, %h_bound, %w_bound] { - %2_0 = affine_apply #map2 (%1_0, %1_1) - %2_1 = affine_apply #map2 (%1_0, %1_1) + %2_0 = affine.apply #map2 (%1_0, %1_1) + %2_1 = affine.apply #map2 (%1_0, %1_1) // Compute: output[output_indices] += input[input_indices] * kernel[kernel_indices] call @multiply_accumulate(%input, %kernel, %output, %b, %oh, %ow, %of, %kh, %kw, %if, %2_0, %2_1) } @@ -750,27 +750,27 @@ func @matmul(%A, %B, %C, %M, %N, %K) : (...) { // %M, N, K are symbols // t1, t2, t3, t4, t5, t6 are abstract polyhedral loops mldim %t1 : {S1,S2,S3,S4,S5} floordiv (i, 128) { mldim %t2 : {S1,S2,S3,S4,S5} floordiv (j, 128) { - // (%i, %j) = affine_apply (d0, d1) -> (128*d0, 128*d1) (%t1, %t2) + // (%i, %j) = affine.apply (d0, d1) -> (128*d0, 128*d1) (%t1, %t2) call dma_hbm_to_vmem(%C, %i, %j, %M, %N, %K) with @intset_ij(%i, %j) [%M, %N, %K] mldim %t3 : {S2,S3,S4,S5} floordiv (k, 128) { - // (%i, %j, %k) = affine_apply (d0, d1, d2) + // (%i, %j, %k) = affine.apply (d0, d1, d2) // -> (128*d0, 128*d1, 128*d2) (%t1, %t2, %t3) call dma_hbm_to_vmem(%A, ...) with #inset_ijk (%i, %j, %k) [%M, %N, %K] - // (%i, %j, %k) = affine_apply (d0, d1, d2) + // (%i, %j, %k) = affine.apply (d0, d1, d2) // -> (128*d0, 128*d1, 128*d2) (%t1, %t2, %t3) call dma_hbm_to_vmem(%B, ...) with #inset_ijk (%i, %j, %k) [%M, %N, %K] mldim %t4 : {S4} i mod 128 { mldim %t5 : {S4} j mod 128 { mldim %t6 : {S4} k mod 128 { - // (%i, %j, %k) = affine_apply #map0 (%t1, %t2, %t3, %t4, %t5, %t6) + // (%i, %j, %k) = affine.apply #map0 (%t1, %t2, %t3, %t4, %t5, %t6) call matmul_body(A, B, C, %i, %j, %k, %M, %N, %K) with #inset_ijk(%i, %j, %k) [%M, %N, %K] } // end mld4im t6 } // end mldim t5 } // end mldim t4 } // end mldim t3 - // (%i, %j) = affine_apply (d0, d1) -> (128*d0, 128*d1) (%t1, %t2) + // (%i, %j) = affine.apply (d0, d1) -> (128*d0, 128*d1) (%t1, %t2) call $dma_vmem_to_hbm_C ... with #intset(%i, %j) [%M, %N, %K] } // end mldim t2 } // end mldim t1 diff --git a/mlir/g3doc/RationaleSimplifiedPolyhedralForm.md b/mlir/g3doc/RationaleSimplifiedPolyhedralForm.md index f42bee0303f..f51eff45633 100644 --- a/mlir/g3doc/RationaleSimplifiedPolyhedralForm.md +++ b/mlir/g3doc/RationaleSimplifiedPolyhedralForm.md @@ -187,7 +187,7 @@ Our simple example above would be represented as: for %i = 0 ... %N step 1 { for %j = 0 ... %N step 1 { // identity noop in this case, but can exist in general. - %0,%1 = affine_apply #57(%i, %j) + %0,%1 = affine.apply #57(%i, %j) %tmp = call @S1(%X, %0, %1) @@ -212,7 +212,7 @@ The example with the reduced domain would be represented with an if instruction: if (10 <= %i < %N-10), (10 <= %j < %N-10) { - %2,%3 = affine_apply(%i, %j) // identity noop in this case + %2,%3 = affine.apply(%i, %j) // identity noop in this case call @S2(%tmp, %A, %2, %3) } diff --git a/mlir/include/mlir/AffineOps/AffineOps.h b/mlir/include/mlir/AffineOps/AffineOps.h index bd5e314de35..0ae43426db0 100644 --- a/mlir/include/mlir/AffineOps/AffineOps.h +++ b/mlir/include/mlir/AffineOps/AffineOps.h @@ -38,19 +38,19 @@ public: AffineOpsDialect(MLIRContext *context); }; -/// The "affine_apply" operation applies an affine map to a list of operands, +/// The "affine.apply" operation applies an affine map to a list of operands, /// yielding a single result. The operand list must be the same size as the /// number of arguments to the affine mapping. All operands and the result are /// of type 'Index'. This operation requires a single affine map attribute named /// "map". For example: /// -/// %y = "affine_apply" (%x) { map: (d0) -> (d0 + 1) } : +/// %y = "affine.apply" (%x) { map: (d0) -> (d0 + 1) } : /// (index) -> (index) /// /// equivalently: /// /// #map42 = (d0)->(d0+1) -/// %y = affine_apply #map42(%x) +/// %y = affine.apply #map42(%x) /// class AffineApplyOp : public Op<AffineApplyOp, OpTrait::VariadicOperands, OpTrait::OneResult, OpTrait::HasNoSideEffect> { @@ -73,7 +73,7 @@ public: /// Returns true if the result of this operation is a symbol. bool isValidSymbol() const; - static StringRef getOperationName() { return "affine_apply"; } + static StringRef getOperationName() { return "affine.apply"; } // Hooks to customize behavior of this op. static bool parse(OpAsmParser *parser, OperationState *result); diff --git a/mlir/include/mlir/Analysis/Utils.h b/mlir/include/mlir/Analysis/Utils.h index d6a67f65c7c..3371daf99fd 100644 --- a/mlir/include/mlir/Analysis/Utils.h +++ b/mlir/include/mlir/Analysis/Utils.h @@ -124,7 +124,7 @@ struct MemRefRegion { /// identifiers as the rank of the memref, and *potentially* additional /// symbolic identifiers which could include any of the loop IVs surrounding /// opInst up until 'loopDepth' and another additional Function symbols - /// involved with the access (for eg., those appear in affine_apply's, loop + /// involved with the access (for eg., those appear in affine.apply's, loop /// bounds, etc.). If 'sliceState' is non-null, operands from 'sliceState' /// are added as symbols, and the following constraints are added to the /// system: diff --git a/mlir/include/mlir/Transforms/Utils.h b/mlir/include/mlir/Transforms/Utils.h index 339e1e070e0..3b828db6ae9 100644 --- a/mlir/include/mlir/Transforms/Utils.h +++ b/mlir/include/mlir/Transforms/Utils.h @@ -95,26 +95,26 @@ Instruction *createComposedAffineApplyOp(FuncBuilder *builder, Location loc, /// Before /// /// for %i = 0 to #map(%N) -/// %idx = affine_apply (d0) -> (d0 mod 2) (%i) +/// %idx = affine.apply (d0) -> (d0 mod 2) (%i) /// send %A[%idx], ... /// %v = "compute"(%idx, ...) /// /// After /// /// for %i = 0 to #map(%N) -/// %idx = affine_apply (d0) -> (d0 mod 2) (%i) +/// %idx = affine.apply (d0) -> (d0 mod 2) (%i) /// send %A[%idx], ... -/// %idx_ = affine_apply (d0) -> (d0 mod 2) (%i) +/// %idx_ = affine.apply (d0) -> (d0 mod 2) (%i) /// %v = "compute"(%idx_, ...) /// This allows the application of different transformations on send and /// compute (for eg. / different shifts/delays) /// /// Returns nullptr either if none of opInst's operands were the result of an -/// affine_apply (i.e., there was no affine computation slice to create), or if -/// all the affine_apply op's supplying operands to this opInst did not have any +/// affine.apply (i.e., there was no affine computation slice to create), or if +/// all the affine.apply op's supplying operands to this opInst did not have any /// uses other than those in this opInst. The method otherwise returns the list -/// of affine_apply operations created in output argument `sliceOps`. +/// of affine.apply operations created in output argument `sliceOps`. void createAffineComputationSlice( Instruction *opInst, SmallVectorImpl<OpPointer<AffineApplyOp>> *sliceOps); diff --git a/mlir/lib/AffineOps/AffineOps.cpp b/mlir/lib/AffineOps/AffineOps.cpp index d8fd02a9251..249b09f41cd 100644 --- a/mlir/lib/AffineOps/AffineOps.cpp +++ b/mlir/lib/AffineOps/AffineOps.cpp @@ -109,7 +109,7 @@ bool AffineApplyOp::parse(OpAsmParser *parser, OperationState *result) { void AffineApplyOp::print(OpAsmPrinter *p) const { auto map = getAffineMap(); - *p << "affine_apply " << map; + *p << "affine.apply " << map; printDimAndSymbolList(operand_begin(), operand_end(), map.getNumDims(), p); p->printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/"map"); } @@ -185,13 +185,13 @@ namespace { /// simplifications such as: /// /// ```mlir -/// %1 = affine_apply (d0, d1) -> (d0 - d1) (%0, %0) +/// %1 = affine.apply (d0, d1) -> (d0 - d1) (%0, %0) /// ``` /// /// into: /// /// ```mlir -/// %1 = affine_apply () -> (0) +/// %1 = affine.apply () -> (0) /// ``` struct AffineApplyNormalizer { AffineApplyNormalizer(AffineMap map, ArrayRef<Value *> operands); diff --git a/mlir/lib/Analysis/AffineAnalysis.cpp b/mlir/lib/Analysis/AffineAnalysis.cpp index 0a5c4727eb1..9d2ea691bdd 100644 --- a/mlir/lib/Analysis/AffineAnalysis.cpp +++ b/mlir/lib/Analysis/AffineAnalysis.cpp @@ -758,7 +758,7 @@ void MemRefAccess::getAccessMap(AffineValueMap *accessMap) const { // // for %i0 = 0 to 100 { // for %i1 = 0 to 50 { -// %a0 = affine_apply +// %a0 = affine.apply // (d0, d1) -> (d0 * 2 - d1 * 4 + s1, d1 * 3 - s0) (%i0, %i1)[%M, %N] // // Source memref access. // store %v0, %m[%a0#0, %a0#1] : memref<4x4xf32> @@ -767,7 +767,7 @@ void MemRefAccess::getAccessMap(AffineValueMap *accessMap) const { // // for %i2 = 0 to 100 { // for %i3 = 0 to 50 { -// %a1 = affine_apply +// %a1 = affine.apply // (d0, d1) -> (d0 * 7 + d1 * 9 - s1, d1 * 11 + s0) (%i2, %i3)[%K, %M] // // Destination memref access. // %v1 = load %m[%a1#0, %a1#1] : memref<4x4xf32> diff --git a/mlir/lib/StandardOps/StandardOps.cpp b/mlir/lib/StandardOps/StandardOps.cpp index 2c9929463e1..abe86e7d414 100644 --- a/mlir/lib/StandardOps/StandardOps.cpp +++ b/mlir/lib/StandardOps/StandardOps.cpp @@ -1250,7 +1250,7 @@ bool LoadOp::verify() const { // TODO: Verify we have the right number of indices. // TODO: in Function verify that the indices are parameters, IV's, or the - // result of an affine_apply. + // result of an affine.apply. return false; } @@ -1561,7 +1561,7 @@ bool StoreOp::verify() const { // TODO: Verify we have the right number of indices. // TODO: in Function verify that the indices are parameters, IV's, or the - // result of an affine_apply. + // result of an affine.apply. return false; } diff --git a/mlir/lib/Transforms/DmaGeneration.cpp b/mlir/lib/Transforms/DmaGeneration.cpp index 7fd9128b358..855ff37f60f 100644 --- a/mlir/lib/Transforms/DmaGeneration.cpp +++ b/mlir/lib/Transforms/DmaGeneration.cpp @@ -407,7 +407,7 @@ bool DmaGeneration::generateDma(const MemRefRegion ®ion, Block *block, // access indices (subtracting out lower bound offsets for each dimension). // Ex: to replace load %A[%i, %j] with load %Abuf[%i - %iT, %j - %jT], // index remap will be (%i, %j) -> (%i - %iT, %j - %jT), - // i.e., affine_apply (d0, d1, d2, d3) -> (d2-d0, d3-d1) (%iT, %jT, %i, %j), + // i.e., affine.apply (d0, d1, d2, d3) -> (d2-d0, d3-d1) (%iT, %jT, %i, %j), // and (%iT, %jT) will be the 'extraOperands' for 'rep all memref uses with'. // d2, d3 correspond to the original indices (%i, %j). SmallVector<AffineExpr, 4> remapExprs; diff --git a/mlir/lib/Transforms/LowerAffine.cpp b/mlir/lib/Transforms/LowerAffine.cpp index 88ccc90c18b..0d8eb8a4761 100644 --- a/mlir/lib/Transforms/LowerAffine.cpp +++ b/mlir/lib/Transforms/LowerAffine.cpp @@ -414,7 +414,7 @@ bool LowerAffinePass::lowerAffineFor(OpPointer<AffineForOp> forOp) { // +--------------------------------+ // | <code before the AffineIfOp> | // | %zero = constant 0 : index | -// | %v = affine_apply #expr1(%ops) | +// | %v = affine.apply #expr1(%ops) | // | %c = cmpi "sge" %v, %zero | // | cond_br %c, %next, %else | // +--------------------------------+ @@ -516,7 +516,7 @@ bool LowerAffinePass::lowerAffineIf(AffineIfOp *ifOp) { auto integerSet = ifOp->getIntegerSet(); // Implement short-circuit logic. For each affine expression in the 'if' - // condition, convert it into an affine map and call `affine_apply` to obtain + // condition, convert it into an affine map and call `affine.apply` to obtain // the resulting value. Perform the equality or the greater-than-or-equality // test between this value and zero depending on the equality flag of the // condition. If the test fails, jump immediately to the false branch, which @@ -573,7 +573,7 @@ bool LowerAffinePass::lowerAffineIf(AffineIfOp *ifOp) { return false; } -// Convert an "affine_apply" operation into a sequence of arithmetic +// Convert an "affine.apply" operation into a sequence of arithmetic // instructions using the StandardOps dialect. Return true on error. bool LowerAffinePass::lowerAffineApply(AffineApplyOp *op) { FuncBuilder builder(op->getInstruction()); diff --git a/mlir/lib/Transforms/MaterializeVectors.cpp b/mlir/lib/Transforms/MaterializeVectors.cpp index f55c2154f08..be5a03bc416 100644 --- a/mlir/lib/Transforms/MaterializeVectors.cpp +++ b/mlir/lib/Transforms/MaterializeVectors.cpp @@ -124,25 +124,25 @@ /// for %i1 = 0 to %arg1 step 4 { /// for %i2 = 0 to %arg2 { /// for %i3 = 0 to %arg3 step 4 { -/// %1 = affine_apply (d0, d1, d2, d3) -> (d0, d1, d2, d3) +/// %1 = affine.apply (d0, d1, d2, d3) -> (d0, d1, d2, d3) /// (%i0, %i1, %i2, %i3) /// vector_transfer_write f1, %0, %1#0, %1#1, %1#2, %1#3 /// {permutation_map: (d0, d1, d2, d3) -> (d1, d0)} : /// vector<4x4xf32>, memref<?x?x?x?xf32>, /// index, index, index, index -/// %2 = affine_apply (d0, d1, d2, d3) -> (d0, d1, d2, d3 + 1) +/// %2 = affine.apply (d0, d1, d2, d3) -> (d0, d1, d2, d3 + 1) /// (%i0, %i1, %i2, %i3) /// vector_transfer_write {{.*}}, %0, %2#0, %2#1, %2#2, %2#3 /// {permutation_map: (d0, d1, d2, d3) -> (d1, d0)} : /// vector<4x4xf32>, memref<?x?x?x?xf32>, /// index, index, index, index -/// %3 = affine_apply (d0, d1, d2, d3) -> (d0, d1, d2, d3 + 2) +/// %3 = affine.apply (d0, d1, d2, d3) -> (d0, d1, d2, d3 + 2) /// (%i0, %i1, %i2, %i3) /// vector_transfer_write {{.*}}, %0, %3#0, %3#1, %3#2, %3#3 /// {permutation_map: (d0, d1, d2, d3) -> (d1, d0)} : /// vector<4x4xf32>, memref<?x?x?x?xf32>, /// index, index, index, index -/// %4 = affine_apply (d0, d1, d2, d3) -> (d0, d1, d2, d3 + 3) +/// %4 = affine.apply (d0, d1, d2, d3) -> (d0, d1, d2, d3 + 3) /// (%i0, %i1, %i2, %i3) /// vector_transfer_write {{.*}}, %0, %4#0, %4#1, %4#2, %4#3 /// {permutation_map: (d0, d1, d2, d3) -> (d1, d0)} : diff --git a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp index 9c9db30d163..d9f940a01f3 100644 --- a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp +++ b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp @@ -147,7 +147,7 @@ void MemRefDataFlowOpt::forwardStoreToLoad(OpPointer<LoadOp> loadOp) { // common surrounding loop. As an example this filters out cases like: // for %i0 // for %i1 - // %idx = affine_apply (d0) -> (d0 + 1) (%i0) + // %idx = affine.apply (d0) -> (d0 + 1) (%i0) // store %A[%idx] // load %A[%i0] // diff --git a/mlir/lib/Transforms/PipelineDataTransfer.cpp b/mlir/lib/Transforms/PipelineDataTransfer.cpp index 4ca48a53485..cfa045f2279 100644 --- a/mlir/lib/Transforms/PipelineDataTransfer.cpp +++ b/mlir/lib/Transforms/PipelineDataTransfer.cpp @@ -324,7 +324,7 @@ PipelineDataTransfer::runOnAffineForOp(OpPointer<AffineForOp> forOp) { instShiftMap[sliceOp->getInstruction()] = 0; } } else { - // If a slice wasn't created, the reachable affine_apply op's from its + // If a slice wasn't created, the reachable affine.apply op's from its // operands are the ones that go with it. SmallVector<Instruction *, 4> affineApplyInsts; SmallVector<Value *, 4> operands(dmaStartInst->getOperands()); diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp index 95875adca6e..a1903ace026 100644 --- a/mlir/lib/Transforms/Utils/LoopUtils.cpp +++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp @@ -113,7 +113,7 @@ bool mlir::promoteIfSingleIteration(OpPointer<AffineForOp> forOp) { SmallVector<Value *, 4> lbOperands(lb.operand_begin(), lb.operand_end()); FuncBuilder builder(forInst->getBlock(), Block::iterator(forInst)); if (lb.getMap() == builder.getDimIdentityMap()) { - // No need of generating an affine_apply. + // No need of generating an affine.apply. iv->replaceAllUsesWith(lbOperands[0]); } else { auto affineApplyOp = builder.create<AffineApplyOp>( diff --git a/mlir/lib/Transforms/Utils/Utils.cpp b/mlir/lib/Transforms/Utils/Utils.cpp index 4b6147f447b..41689be52fc 100644 --- a/mlir/lib/Transforms/Utils/Utils.cpp +++ b/mlir/lib/Transforms/Utils/Utils.cpp @@ -195,25 +195,25 @@ bool mlir::replaceAllMemRefUsesWith(const Value *oldMemRef, Value *newMemRef, /// Before /// /// for %i = 0 to #map(%N) -/// %idx = affine_apply (d0) -> (d0 mod 2) (%i) +/// %idx = affine.apply (d0) -> (d0 mod 2) (%i) /// "send"(%idx, %A, ...) /// "compute"(%idx) /// /// After /// /// for %i = 0 to #map(%N) -/// %idx = affine_apply (d0) -> (d0 mod 2) (%i) +/// %idx = affine.apply (d0) -> (d0 mod 2) (%i) /// "send"(%idx, %A, ...) -/// %idx_ = affine_apply (d0) -> (d0 mod 2) (%i) +/// %idx_ = affine.apply (d0) -> (d0 mod 2) (%i) /// "compute"(%idx_) /// /// This allows applying different transformations on send and compute (for eg. /// different shifts/delays). /// /// Returns nullptr either if none of opInst's operands were the result of an -/// affine_apply and thus there was no affine computation slice to create, or if -/// all the affine_apply op's supplying operands to this opInst did not have any -/// uses besides this opInst; otherwise returns the list of affine_apply +/// affine.apply and thus there was no affine computation slice to create, or if +/// all the affine.apply op's supplying operands to this opInst did not have any +/// uses besides this opInst; otherwise returns the list of affine.apply /// operations created in output argument `sliceOps`. void mlir::createAffineComputationSlice( Instruction *opInst, SmallVectorImpl<OpPointer<AffineApplyOp>> *sliceOps) { @@ -255,7 +255,7 @@ void mlir::createAffineComputationSlice( auto composedMap = builder.getMultiDimIdentityMap(composedOpOperands.size()); fullyComposeAffineMapAndOperands(&composedMap, &composedOpOperands); - // Create an affine_apply for each of the map results. + // Create an affine.apply for each of the map results. sliceOps->reserve(composedMap.getNumResults()); for (auto resultExpr : composedMap.getResults()) { auto singleResMap = builder.getAffineMap( diff --git a/mlir/test/AffineOps/canonicalize.mlir b/mlir/test/AffineOps/canonicalize.mlir index b42ba90bbf2..ad6f39f3496 100644 --- a/mlir/test/AffineOps/canonicalize.mlir +++ b/mlir/test/AffineOps/canonicalize.mlir @@ -35,39 +35,39 @@ func @compose_affine_maps_1dto2d_no_symbols() { for %i0 = 0 to 15 { // Test load[%x, %x] - %x0 = affine_apply (d0) -> (d0 - 1) (%i0) - %x1_0 = affine_apply (d0, d1) -> (d0) (%x0, %x0) - %x1_1 = affine_apply (d0, d1) -> (d1) (%x0, %x0) + %x0 = affine.apply (d0) -> (d0 - 1) (%i0) + %x1_0 = affine.apply (d0, d1) -> (d0) (%x0, %x0) + %x1_1 = affine.apply (d0, d1) -> (d1) (%x0, %x0) - // CHECK: [[I0A:%[0-9]+]] = affine_apply [[MAP0]](%i0) - // CHECK-NEXT: [[I0B:%[0-9]+]] = affine_apply [[MAP0]](%i0) + // CHECK: [[I0A:%[0-9]+]] = affine.apply [[MAP0]](%i0) + // CHECK-NEXT: [[I0B:%[0-9]+]] = affine.apply [[MAP0]](%i0) // CHECK-NEXT: load %0{{\[}}[[I0A]], [[I0B]]{{\]}} %v0 = load %0[%x1_0, %x1_1] : memref<4x4xf32> // Test load[%y, %y] - %y0 = affine_apply (d0) -> (d0 + 1) (%i0) - %y1_0 = affine_apply (d0, d1) -> (d0) (%y0, %y0) - %y1_1 = affine_apply (d0, d1) -> (d1) (%y0, %y0) + %y0 = affine.apply (d0) -> (d0 + 1) (%i0) + %y1_0 = affine.apply (d0, d1) -> (d0) (%y0, %y0) + %y1_1 = affine.apply (d0, d1) -> (d1) (%y0, %y0) - // CHECK-NEXT: [[I1A:%[0-9]+]] = affine_apply [[MAP1]](%i0) - // CHECK-NEXT: [[I1B:%[0-9]+]] = affine_apply [[MAP1]](%i0) + // CHECK-NEXT: [[I1A:%[0-9]+]] = affine.apply [[MAP1]](%i0) + // CHECK-NEXT: [[I1B:%[0-9]+]] = affine.apply [[MAP1]](%i0) // CHECK-NEXT: load %0{{\[}}[[I1A]], [[I1B]]{{\]}} %v1 = load %0[%y1_0, %y1_1] : memref<4x4xf32> // Test load[%x, %y] - %xy_0 = affine_apply (d0, d1) -> (d0) (%x0, %y0) - %xy_1 = affine_apply (d0, d1) -> (d1) (%x0, %y0) + %xy_0 = affine.apply (d0, d1) -> (d0) (%x0, %y0) + %xy_1 = affine.apply (d0, d1) -> (d1) (%x0, %y0) - // CHECK-NEXT: [[I2A:%[0-9]+]] = affine_apply [[MAP0]](%i0) - // CHECK-NEXT: [[I2B:%[0-9]+]] = affine_apply [[MAP1]](%i0) + // CHECK-NEXT: [[I2A:%[0-9]+]] = affine.apply [[MAP0]](%i0) + // CHECK-NEXT: [[I2B:%[0-9]+]] = affine.apply [[MAP1]](%i0) // CHECK-NEXT: load %0{{\[}}[[I2A]], [[I2B]]{{\]}} %v2 = load %0[%xy_0, %xy_1] : memref<4x4xf32> // Test load[%y, %x] - %yx_0 = affine_apply (d0, d1) -> (d0) (%y0, %x0) - %yx_1 = affine_apply (d0, d1) -> (d1) (%y0, %x0) - // CHECK-NEXT: [[I3A:%[0-9]+]] = affine_apply [[MAP1]](%i0) - // CHECK-NEXT: [[I3B:%[0-9]+]] = affine_apply [[MAP0]](%i0) + %yx_0 = affine.apply (d0, d1) -> (d0) (%y0, %x0) + %yx_1 = affine.apply (d0, d1) -> (d1) (%y0, %x0) + // CHECK-NEXT: [[I3A:%[0-9]+]] = affine.apply [[MAP1]](%i0) + // CHECK-NEXT: [[I3B:%[0-9]+]] = affine.apply [[MAP0]](%i0) // CHECK-NEXT: load %0{{\[}}[[I3A]], [[I3B]]{{\]}} %v3 = load %0[%yx_0, %yx_1] : memref<4x4xf32> } @@ -81,30 +81,30 @@ func @compose_affine_maps_1dto2d_with_symbols() { for %i0 = 0 to 15 { // Test load[%x0, %x0] with symbol %c4 %c4 = constant 4 : index - %x0 = affine_apply (d0)[s0] -> (d0 - s0) (%i0)[%c4] + %x0 = affine.apply (d0)[s0] -> (d0 - s0) (%i0)[%c4] - // CHECK: [[I0:%[0-9]+]] = affine_apply [[MAP4]](%i0)[%c4] + // CHECK: [[I0:%[0-9]+]] = affine.apply [[MAP4]](%i0)[%c4] // CHECK-NEXT: load %{{[0-9]+}}{{\[}}[[I0]], [[I0]]{{\]}} %v0 = load %0[%x0, %x0] : memref<4x4xf32> // Test load[%x0, %x1] with symbol %c4 captured by '%x0' map. - %x1 = affine_apply (d0) -> (d0 + 1) (%i0) - %y1 = affine_apply (d0, d1) -> (d0+d1) (%x0, %x1) - // CHECK-NEXT: [[I1:%[0-9]+]] = affine_apply [[MAP6]](%i0)[%c4] + %x1 = affine.apply (d0) -> (d0 + 1) (%i0) + %y1 = affine.apply (d0, d1) -> (d0+d1) (%x0, %x1) + // CHECK-NEXT: [[I1:%[0-9]+]] = affine.apply [[MAP6]](%i0)[%c4] // CHECK-NEXT: load %{{[0-9]+}}{{\[}}[[I1]], [[I1]]{{\]}} %v1 = load %0[%y1, %y1] : memref<4x4xf32> // Test load[%x1, %x0] with symbol %c4 captured by '%x0' map. - %y2 = affine_apply (d0, d1) -> (d0 + d1) (%x1, %x0) - // CHECK-NEXT: [[I2:%[0-9]+]] = affine_apply [[MAP6]](%i0)[%c4] + %y2 = affine.apply (d0, d1) -> (d0 + d1) (%x1, %x0) + // CHECK-NEXT: [[I2:%[0-9]+]] = affine.apply [[MAP6]](%i0)[%c4] // CHECK-NEXT: load %{{[0-9]+}}{{\[}}[[I2]], [[I2]]{{\]}} %v2 = load %0[%y2, %y2] : memref<4x4xf32> // Test load[%x2, %x0] with symbol %c4 from '%x0' and %c5 from '%x2' %c5 = constant 5 : index - %x2 = affine_apply (d0)[s0] -> (d0 + s0) (%i0)[%c5] - %y3 = affine_apply (d0, d1) -> (d0 + d1) (%x2, %x0) - // CHECK: [[I3:%[0-9]+]] = affine_apply [[MAP7]](%i0)[%c5, %c4] + %x2 = affine.apply (d0)[s0] -> (d0 + s0) (%i0)[%c5] + %y3 = affine.apply (d0, d1) -> (d0 + d1) (%x2, %x0) + // CHECK: [[I3:%[0-9]+]] = affine.apply [[MAP7]](%i0)[%c5, %c4] // CHECK-NEXT: load %{{[0-9]+}}{{\[}}[[I3]], [[I3]]{{\]}} %v3 = load %0[%y3, %y3] : memref<4x4xf32> } @@ -120,20 +120,20 @@ func @compose_affine_maps_2d_tile() { %c8 = constant 8 : index for %i0 = 0 to 3 { - %x0 = affine_apply (d0)[s0] -> (d0 ceildiv s0) (%i0)[%c4] + %x0 = affine.apply (d0)[s0] -> (d0 ceildiv s0) (%i0)[%c4] for %i1 = 0 to 3 { - %x1 = affine_apply (d0)[s0] -> (d0 ceildiv s0) (%i1)[%c8] + %x1 = affine.apply (d0)[s0] -> (d0 ceildiv s0) (%i1)[%c8] for %i2 = 0 to 3 { - %x2 = affine_apply (d0)[s0] -> (d0 mod s0) (%i2)[%c4] + %x2 = affine.apply (d0)[s0] -> (d0 mod s0) (%i2)[%c4] for %i3 = 0 to 3 { - %x3 = affine_apply (d0)[s0] -> (d0 mod s0) (%i3)[%c8] + %x3 = affine.apply (d0)[s0] -> (d0 mod s0) (%i3)[%c8] - %x40 = affine_apply (d0, d1, d2, d3)[s0, s1] -> + %x40 = affine.apply (d0, d1, d2, d3)[s0, s1] -> ((d0 * s0) + d2) (%x0, %x1, %x2, %x3)[%c4, %c8] - %x41 = affine_apply (d0, d1, d2, d3)[s0, s1] -> + %x41 = affine.apply (d0, d1, d2, d3)[s0, s1] -> ((d1 * s1) + d3) (%x0, %x1, %x2, %x3)[%c4, %c8] - // CHECK: [[I0:%[0-9]+]] = affine_apply [[MAP8]](%i0, %i2)[%c4] - // CHECK: [[I1:%[0-9]+]] = affine_apply [[MAP8]](%i1, %i3)[%c8] + // CHECK: [[I0:%[0-9]+]] = affine.apply [[MAP8]](%i0, %i2)[%c4] + // CHECK: [[I1:%[0-9]+]] = affine.apply [[MAP8]](%i1, %i3)[%c8] // CHECK-NEXT: [[L0:%[0-9]+]] = load %{{[0-9]+}}{{\[}}[[I0]], [[I1]]{{\]}} %v0 = load %0[%x40, %x41] : memref<16x32xf32> @@ -157,16 +157,16 @@ func @compose_affine_maps_dependent_loads() { %c3 = constant 3 : index %c7 = constant 7 : index - %x00 = affine_apply (d0, d1, d2)[s0, s1] -> (d0 + s0) + %x00 = affine.apply (d0, d1, d2)[s0, s1] -> (d0 + s0) (%i0, %i1, %i2)[%c3, %c7] - %x01 = affine_apply (d0, d1, d2)[s0, s1] -> (d1 - s1) + %x01 = affine.apply (d0, d1, d2)[s0, s1] -> (d1 - s1) (%i0, %i1, %i2)[%c3, %c7] - %x02 = affine_apply (d0, d1, d2)[s0, s1] -> (d2 * s0) + %x02 = affine.apply (d0, d1, d2)[s0, s1] -> (d2 * s0) (%i0, %i1, %i2)[%c3, %c7] - // CHECK: [[I0:%[0-9]+]] = affine_apply [[MAP9]](%i0)[%c3] - // CHECK: [[I1:%[0-9]+]] = affine_apply [[MAP4]](%i1)[%c7] - // CHECK: [[I2:%[0-9]+]] = affine_apply [[MAP10]](%i2)[%c3] + // CHECK: [[I0:%[0-9]+]] = affine.apply [[MAP9]](%i0)[%c3] + // CHECK: [[I1:%[0-9]+]] = affine.apply [[MAP4]](%i1)[%c7] + // CHECK: [[I2:%[0-9]+]] = affine.apply [[MAP10]](%i2)[%c3] // CHECK-NEXT: load %{{[0-9]+}}{{\[}}[[I0]], [[I1]]{{\]}} %v0 = load %0[%x00, %x01] : memref<16x32xf32> @@ -178,13 +178,13 @@ func @compose_affine_maps_dependent_loads() { %v2 = load %0[%x01, %x00] : memref<16x32xf32> // Swizzle %x00, %x01 and %c3, %c7 - %x10 = affine_apply (d0, d1)[s0, s1] -> (d0 * s1) + %x10 = affine.apply (d0, d1)[s0, s1] -> (d0 * s1) (%x01, %x00)[%c7, %c3] - %x11 = affine_apply (d0, d1)[s0, s1] -> (d1 ceildiv s0) + %x11 = affine.apply (d0, d1)[s0, s1] -> (d1 ceildiv s0) (%x01, %x00)[%c7, %c3] - // CHECK-NEXT: [[I2A:%[0-9]+]] = affine_apply [[MAP12]](%i1)[%c7] - // CHECK-NEXT: [[I2B:%[0-9]+]] = affine_apply [[MAP11]](%i0)[%c3, %c7] + // CHECK-NEXT: [[I2A:%[0-9]+]] = affine.apply [[MAP12]](%i1)[%c7] + // CHECK-NEXT: [[I2B:%[0-9]+]] = affine.apply [[MAP11]](%i0)[%c3, %c7] // CHECK-NEXT: load %{{[0-9]+}}{{\[}}[[I2A]], [[I2B]]{{\]}} %v3 = load %0[%x10, %x11] : memref<16x32xf32> } @@ -198,13 +198,13 @@ func @compose_affine_maps_diamond_dependency() { %0 = alloc() : memref<4x4xf32> for %i0 = 0 to 15 { - %a = affine_apply (d0) -> (d0 - 1) (%i0) - %b = affine_apply (d0) -> (d0 + 7) (%a) - %c = affine_apply (d0) -> (d0 * 4) (%a) - %d0 = affine_apply (d0, d1) -> (d0 ceildiv 8) (%b, %c) - %d1 = affine_apply (d0, d1) -> (d1 floordiv 3) (%b, %c) - // CHECK: [[I0:%[0-9]+]] = affine_apply [[MAP13A]](%i0) - // CHECK: [[I1:%[0-9]+]] = affine_apply [[MAP13B]](%i0) + %a = affine.apply (d0) -> (d0 - 1) (%i0) + %b = affine.apply (d0) -> (d0 + 7) (%a) + %c = affine.apply (d0) -> (d0 * 4) (%a) + %d0 = affine.apply (d0, d1) -> (d0 ceildiv 8) (%b, %c) + %d1 = affine.apply (d0, d1) -> (d1 floordiv 3) (%b, %c) + // CHECK: [[I0:%[0-9]+]] = affine.apply [[MAP13A]](%i0) + // CHECK: [[I1:%[0-9]+]] = affine.apply [[MAP13B]](%i0) // CHECK-NEXT: load %{{[0-9]+}}{{\[}}[[I0]], [[I1]]{{\]}} %v = load %0[%d0, %d1] : memref<4x4xf32> } @@ -219,11 +219,11 @@ func @arg_used_as_dim_and_symbol(%arg0: memref<100x100xf32>, %arg1: index) { %2 = alloc() : memref<1xi32> for %i0 = 0 to 100 { for %i1 = 0 to 100 { - %3 = affine_apply (d0, d1)[s0, s1] -> (d1 + s0 + s1) + %3 = affine.apply (d0, d1)[s0, s1] -> (d1 + s0 + s1) (%i0, %i1)[%arg1, %c9] - %4 = affine_apply (d0, d1, d3) -> (d3 - (d0 + d1)) + %4 = affine.apply (d0, d1, d3) -> (d3 - (d0 + d1)) (%arg1, %c9, %3) - // CHECK: [[I0:%[0-9]+]] = affine_apply [[MAP14]](%arg1, %c9, %i1)[%arg1, %c9] + // CHECK: [[I0:%[0-9]+]] = affine.apply [[MAP14]](%arg1, %c9, %i1)[%arg1, %c9] // CHECK-NEXT: load %{{[0-9]+}}{{\[}}[[I0]], %arg1{{\]}} %5 = load %1[%4, %arg1] : memref<100x100xf32, 1> } @@ -233,17 +233,17 @@ func @arg_used_as_dim_and_symbol(%arg0: memref<100x100xf32>, %arg1: index) { // CHECK-LABEL: func @trivial_maps func @trivial_maps() { - // CHECK-NOT: affine_apply + // CHECK-NOT: affine.apply %0 = alloc() : memref<10xf32> %c0 = constant 0 : index %cst = constant 0.000000e+00 : f32 for %i1 = 0 to 10 { - %1 = affine_apply ()[s0] -> (s0)()[%c0] + %1 = affine.apply ()[s0] -> (s0)()[%c0] store %cst, %0[%1] : memref<10xf32> %2 = load %0[%c0] : memref<10xf32> - %3 = affine_apply ()[] -> (0)()[] + %3 = affine.apply ()[] -> (0)()[] store %cst, %0[%3] : memref<10xf32> %4 = load %0[%c0] : memref<10xf32> } @@ -252,11 +252,11 @@ func @trivial_maps() { // CHECK-LABEL: func @partial_fold_map func @partial_fold_map(%arg0: memref<index>, %arg1: index, %arg2: index) { - // TODO: Constant fold one index into affine_apply + // TODO: Constant fold one index into affine.apply %c42 = constant 42 : index - %2 = affine_apply (d0, d1) -> (d0 - d1) (%arg1, %c42) + %2 = affine.apply (d0, d1) -> (d0 - d1) (%arg1, %c42) store %2, %arg0[] : memref<index> - // CHECK: [[X:%[0-9]+]] = affine_apply [[MAP15]](%arg1, %c42) + // CHECK: [[X:%[0-9]+]] = affine.apply [[MAP15]](%arg1, %c42) // CHECK-NEXT: store [[X]], %arg0 return @@ -274,7 +274,7 @@ func @constant_fold_bounds(%N : index) { %c9 = constant 9 : index %c1 = constant 1 : index %c2 = constant 2 : index - %c3 = affine_apply (d0, d1) -> (d0 + d1) (%c1, %c2) + %c3 = affine.apply (d0, d1) -> (d0 + d1) (%c1, %c2) %l = "foo"() : () -> index // CHECK: for %i0 = 5 to 7 { diff --git a/mlir/test/IR/affine-map.mlir b/mlir/test/IR/affine-map.mlir index a1f80f2439d..9e67b234b9c 100644 --- a/mlir/test/IR/affine-map.mlir +++ b/mlir/test/IR/affine-map.mlir @@ -9,7 +9,7 @@ // CHECK: #map{{[0-9]+}} = () -> (0) // A map may have 0 inputs. -// However, an affine_apply always takes at least one input. +// However, an affine.apply always takes at least one input. #map2 = () -> (0) // All the maps in the following block are equivalent and are unique'd as one diff --git a/mlir/test/IR/core-ops.mlir b/mlir/test/IR/core-ops.mlir index cb6d92d9670..179f5a010d8 100644 --- a/mlir/test/IR/core-ops.mlir +++ b/mlir/test/IR/core-ops.mlir @@ -207,12 +207,12 @@ func @affine_apply() { %i = "constant"() {value: 0: index} : () -> index %j = "constant"() {value: 1: index} : () -> index - // CHECK: affine_apply #map0(%c0) - %a = "affine_apply" (%i) { map: (d0) -> (d0 + 1) } : + // CHECK: affine.apply #map0(%c0) + %a = "affine.apply" (%i) { map: (d0) -> (d0 + 1) } : (index) -> (index) - // CHECK: affine_apply #map1()[%c0] - %b = affine_apply ()[x] -> (x+1)()[%i] + // CHECK: affine.apply #map1()[%c0] + %b = affine.apply ()[x] -> (x+1)()[%i] return } @@ -307,7 +307,7 @@ func @test_dimop(%arg0: tensor<4x4x?xf32>) { // CHECK: %0 = dim %arg0, 2 : tensor<4x4x?xf32> %0 = dim %arg0, 2 : tensor<4x4x?xf32> // use dim as an affine_int to ensure type correctness - %1 = affine_apply (d0) -> (d0)(%0) + %1 = affine.apply (d0) -> (d0)(%0) return } diff --git a/mlir/test/IR/invalid-ops.mlir b/mlir/test/IR/invalid-ops.mlir index 9e536493b07..66160430cf4 100644 --- a/mlir/test/IR/invalid-ops.mlir +++ b/mlir/test/IR/invalid-ops.mlir @@ -43,7 +43,7 @@ func @constant_out_of_range() { func @affine_apply_no_map() { ^bb0: %i = "constant"() {value: 0} : () -> index - %x = "affine_apply" (%i) { } : (index) -> (index) // expected-error {{'affine_apply' op requires an affine map}} + %x = "affine.apply" (%i) { } : (index) -> (index) // expected-error {{'affine.apply' op requires an affine map}} return } @@ -52,7 +52,7 @@ func @affine_apply_no_map() { func @affine_apply_wrong_operand_count() { ^bb0: %i = "constant"() {value: 0} : () -> index - %x = "affine_apply" (%i) {map: (d0, d1) -> ((d0 + 1), (d1 + 2))} : (index) -> (index) // expected-error {{'affine_apply' op operand count and affine map dimension and symbol count must match}} + %x = "affine.apply" (%i) {map: (d0, d1) -> ((d0 + 1), (d1 + 2))} : (index) -> (index) // expected-error {{'affine.apply' op operand count and affine map dimension and symbol count must match}} return } @@ -62,7 +62,7 @@ func @affine_apply_wrong_result_count() { ^bb0: %i = "constant"() {value: 0} : () -> index %j = "constant"() {value: 1} : () -> index - %x = "affine_apply" (%i, %j) {map: (d0, d1) -> ((d0 + 1), (d1 + 2))} : (index,index) -> (index) // expected-error {{'affine_apply' op mapping must produce one value}} + %x = "affine.apply" (%i, %j) {map: (d0, d1) -> ((d0 + 1), (d1 + 2))} : (index,index) -> (index) // expected-error {{'affine.apply' op mapping must produce one value}} return } diff --git a/mlir/test/IR/invalid.mlir b/mlir/test/IR/invalid.mlir index b7c695c8eb3..30fae330787 100644 --- a/mlir/test/IR/invalid.mlir +++ b/mlir/test/IR/invalid.mlir @@ -816,7 +816,7 @@ func @invalid_tensor_literal() { func @invalid_affine_structure() { %c0 = constant 0 : index - %idx = affine_apply (d0, d1) (%c0, %c0) // expected-error {{expected '->' or ':'}} + %idx = affine.apply (d0, d1) (%c0, %c0) // expected-error {{expected '->' or ':'}} return } diff --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir index 4b1b21473b2..1ec62b9a77d 100644 --- a/mlir/test/IR/parser.mlir +++ b/mlir/test/IR/parser.mlir @@ -279,18 +279,18 @@ func @loop_bounds(%N : index) { for %i = %s to %N { // CHECK: for %i1 = #map{{[0-9]+}}(%i0) to 0 for %j = (d0)[]->(d0)(%i)[] to 0 step 1 { - // CHECK: %1 = affine_apply #map{{.*}}(%i0, %i1)[%0] - %w1 = affine_apply(d0, d1)[s0] -> (d0+d1) (%i, %j) [%s] - // CHECK: %2 = affine_apply #map{{.*}}(%i0, %i1)[%0] - %w2 = affine_apply(d0, d1)[s0] -> (s0+1) (%i, %j) [%s] + // CHECK: %1 = affine.apply #map{{.*}}(%i0, %i1)[%0] + %w1 = affine.apply(d0, d1)[s0] -> (d0+d1) (%i, %j) [%s] + // CHECK: %2 = affine.apply #map{{.*}}(%i0, %i1)[%0] + %w2 = affine.apply(d0, d1)[s0] -> (s0+1) (%i, %j) [%s] // CHECK: for %i2 = #map{{.*}}(%1, %i0)[%arg0] to #map{{.*}}(%2, %i1)[%0] { for %k = #bound_map1 (%w1, %i)[%N] to (i, j)[s] -> (i + j + s) (%w2, %j)[%s] { // CHECK: "foo"(%i0, %i1, %i2) : (index, index, index) -> () "foo"(%i, %j, %k) : (index, index, index)->() // CHECK: %c30 = constant 30 : index %c = constant 30 : index - // CHECK: %3 = affine_apply #map{{.*}}(%arg0, %c30) - %u = affine_apply (d0, d1)->(d0+d1) (%N, %c) + // CHECK: %3 = affine.apply #map{{.*}}(%arg0, %c30) + %u = affine.apply (d0, d1)->(d0+d1) (%N, %c) // CHECK: for %i3 = max #map{{.*}}(%i0)[%3] to min #map{{.*}}(%i2)[%c30] { for %l = max #bound_map2(%i)[%u] to min #bound_map2(%k)[%c] { // CHECK: "bar"(%i3) : (index) -> () @@ -315,8 +315,8 @@ func @ifinst(%N: index) { if (i)[N] : (i - 2 >= 0, 4 - i >= 0)(%i)[%N] { // CHECK if (#set1(%i0)[%arg0]) { // CHECK: %c1 = constant 1 : index %u = constant 1 : index - // CHECK: %2 = affine_apply #map{{.*}}(%i0, %i0)[%c1] - %w = affine_apply (d0,d1)[s0] -> (d0+d1+s0) (%i, %i) [%u] + // CHECK: %2 = affine.apply #map{{.*}}(%i0, %i0)[%c1] + %w = affine.apply (d0,d1)[s0] -> (d0+d1+s0) (%i, %i) [%u] } else { // CHECK } else { %v = constant 3 : i32 // %c3_i32 = constant 3 : i32 } diff --git a/mlir/test/Transforms/Vectorize/lower_vector_transfers.mlir b/mlir/test/Transforms/Vectorize/lower_vector_transfers.mlir index 3e78ae833e6..b82ac08fe59 100644 --- a/mlir/test/Transforms/Vectorize/lower_vector_transfers.mlir +++ b/mlir/test/Transforms/Vectorize/lower_vector_transfers.mlir @@ -9,11 +9,11 @@ func @materialize_read_1d() { for %i0 = 0 to 7 step 4 { for %i1 = 0 to 42 step 4 { %f1 = vector_transfer_read %A, %i0, %i1 {permutation_map: (d0, d1) -> (d0)} : (memref<7x42xf32>, index, index) -> vector<4xf32> - %ip1 = affine_apply (d0) -> (d0 + 1) (%i1) + %ip1 = affine.apply (d0) -> (d0 + 1) (%i1) %f2 = vector_transfer_read %A, %i0, %ip1 {permutation_map: (d0, d1) -> (d0)} : (memref<7x42xf32>, index, index) -> vector<4xf32> - %ip2 = affine_apply (d0) -> (d0 + 2) (%i1) + %ip2 = affine.apply (d0) -> (d0 + 2) (%i1) %f3 = vector_transfer_read %A, %i0, %ip2 {permutation_map: (d0, d1) -> (d0)} : (memref<7x42xf32>, index, index) -> vector<4xf32> - %ip3 = affine_apply (d0) -> (d0 + 3) (%i1) + %ip3 = affine.apply (d0) -> (d0 + 3) (%i1) %f4 = vector_transfer_read %A, %i0, %ip3 {permutation_map: (d0, d1) -> (d0)} : (memref<7x42xf32>, index, index) -> vector<4xf32> // Both accesses in the load must be clipped otherwise %i1 + 2 and %i1 + 3 will go out of bounds. // CHECK: {{.*}} = select @@ -35,7 +35,7 @@ func @materialize_read_1d_partially_specialized(%dyn1 : index, %dyn2 : index, %d for %i3 = 0 to 42 step 2 { for %i4 = 0 to %dyn4 { %f1 = vector_transfer_read %A, %i0, %i1, %i2, %i3, %i4 {permutation_map: (d0, d1, d2, d3, d4) -> (d3)} : ( memref<7x?x?x42x?xf32>, index, index, index, index, index) -> vector<4xf32> - %i3p1 = affine_apply (d0) -> (d0 + 1) (%i3) + %i3p1 = affine.apply (d0) -> (d0 + 1) (%i3) %f2 = vector_transfer_read %A, %i0, %i1, %i2, %i3p1, %i4 {permutation_map: (d0, d1, d2, d3, d4) -> (d3)} : ( memref<7x?x?x42x?xf32>, index, index, index, index, index) -> vector<4xf32> } } @@ -69,30 +69,30 @@ func @materialize_read(%M: index, %N: index, %O: index, %P: index) { // CHECK-NEXT: for %[[I4:.*]] = 0 to 3 { // CHECK-NEXT: for %[[I5:.*]] = 0 to 4 { // CHECK-NEXT: for %[[I6:.*]] = 0 to 5 { - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]] + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]] // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}}, %[[C0]] : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]] + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]] // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}} : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]] - // CHECK-NEXT: {{.*}} = affine_apply #[[SUB]] + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]] + // CHECK-NEXT: {{.*}} = affine.apply #[[SUB]] // CHECK-NEXT: {{.*}} = select // CHECK-NEXT: {{.*}} = select // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}} : index // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}} : index - // CHECK-NEXT: {{.*}} = affine_apply #[[SUB]] + // CHECK-NEXT: {{.*}} = affine.apply #[[SUB]] // CHECK-NEXT: {{.*}} = select // CHECK-NEXT: {{.*}} = select // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}} : index // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}} : index - // CHECK-NEXT: {{.*}} = affine_apply #[[SUB]] + // CHECK-NEXT: {{.*}} = affine.apply #[[SUB]] // CHECK-NEXT: {{.*}} = select // CHECK-NEXT: {{.*}} = select - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]] + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]] // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}}, %[[C0]] : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]] + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]] // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}}, {{.*}} : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]] - // CHECK-NEXT: {{.*}} = affine_apply #[[SUB]] + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]] + // CHECK-NEXT: {{.*}} = affine.apply #[[SUB]] // CHECK-NEXT: {{.*}} = select {{.*}} : index // CHECK-NEXT: {{.*}} = select {{.*}} : index // CHECK-NEXT: {{.*}} = load %0[{{.*}}] : memref<?x?x?x?xf32> @@ -142,33 +142,33 @@ func @materialize_write(%M: index, %N: index, %O: index, %P: index) { // CHECK-NEXT: for %[[I5:.*]] = 0 to 4 { // CHECK-NEXT: for %[[I6:.*]] = 0 to 5 { // CHECK-NEXT: {{.*}} = load {{.*}}[%[[I6]], %[[I5]], %[[I4]]] : memref<5x4x3xf32> - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]](%[[I0]], %[[I4]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]](%[[I0]], %[[I4]]) // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}}, %[[C0]] : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]](%[[I0]], %[[I4]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]](%[[I0]], %[[I4]]) // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}}, {{.*}} : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]](%[[I0]], %[[I4]]) - // CHECK-NEXT: {{.*}} = affine_apply #[[SUB]]({{.*}}, %[[C1]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]](%[[I0]], %[[I4]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[SUB]]({{.*}}, %[[C1]]) // CHECK-NEXT: {{.*}} = select {{.*}}, {{.*}}, {{.*}} : index // CHECK-NEXT: {{.*}} = select {{.*}}, %[[C0]], {{.*}} : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]](%[[I1]], %[[I5]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]](%[[I1]], %[[I5]]) // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}}, %[[C0]] : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]](%[[I1]], %[[I5]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]](%[[I1]], %[[I5]]) // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}}, {{.*}} : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]](%[[I1]], %[[I5]]) - // CHECK-NEXT: {{.*}} = affine_apply #[[SUB]]({{.*}}, %[[C1]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]](%[[I1]], %[[I5]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[SUB]]({{.*}}, %[[C1]]) // CHECK-NEXT: {{.*}} = select {{.*}}, {{.*}}, {{.*}} : index // CHECK-NEXT: {{.*}} = select {{.*}}, %[[C0]], {{.*}} : index // CHECK-NEXT: {{.*}} = cmpi "slt", %[[I2]], %[[C0]] : index // CHECK-NEXT: {{.*}} = cmpi "slt", %[[I2]], %3 : index - // CHECK-NEXT: {{.*}} = affine_apply #map{{.*}}(%3, %[[C1]]) + // CHECK-NEXT: {{.*}} = affine.apply #map{{.*}}(%3, %[[C1]]) // CHECK-NEXT: {{.*}} = select {{.*}}, %[[I2]], {{.*}} : index // CHECK-NEXT: {{.*}} = select {{.*}}, %[[C0]], {{.*}} : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]](%[[I3]], %[[I6]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]](%[[I3]], %[[I6]]) // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}}, %[[C0]] : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]](%[[I3]], %[[I6]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]](%[[I3]], %[[I6]]) // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}}, {{.*}} : index - // CHECK-NEXT: {{.*}} = affine_apply #[[ADD]](%[[I3]], %[[I6]]) - // CHECK-NEXT: {{.*}} = affine_apply #[[SUB]]({{.*}}, %[[C1]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[ADD]](%[[I3]], %[[I6]]) + // CHECK-NEXT: {{.*}} = affine.apply #[[SUB]]({{.*}}, %[[C1]]) // CHECK-NEXT: {{.*}} = select {{.*}}, {{.*}}, {{.*}} : index // CHECK-NEXT: {{.*}} = select {{.*}}, %[[C0]], {{.*}} : index // CHECK-NEXT: store {{.*}}, {{.*}}[{{.*}}, {{.*}}, {{.*}}, {{.*}}] : memref<?x?x?x?xf32> diff --git a/mlir/test/Transforms/Vectorize/materialize_vectors_1d_to_1d.mlir b/mlir/test/Transforms/Vectorize/materialize_vectors_1d_to_1d.mlir index 100822ea455..b5f771d7e62 100644 --- a/mlir/test/Transforms/Vectorize/materialize_vectors_1d_to_1d.mlir +++ b/mlir/test/Transforms/Vectorize/materialize_vectors_1d_to_1d.mlir @@ -21,17 +21,17 @@ func @vector_add_2d(%M : index, %N : index) -> f32 { // CHECK-NEXT: [[CST1:%.*]] = constant splat<vector<8xf32>, 1.000000e+00> : vector<8xf32> // CHECK-NEXT: [[CST2:%.*]] = constant splat<vector<8xf32>, 1.000000e+00> : vector<8xf32> // CHECK-NEXT: [[CST3:%.*]] = constant splat<vector<8xf32>, 1.000000e+00> : vector<8xf32> - // CHECK-NEXT: [[VAL00:%.*]] = affine_apply [[ID1]]{{.*}} - // CHECK-NEXT: [[VAL01:%.*]] = affine_apply [[ID1]]{{.*}} + // CHECK-NEXT: [[VAL00:%.*]] = affine.apply [[ID1]]{{.*}} + // CHECK-NEXT: [[VAL01:%.*]] = affine.apply [[ID1]]{{.*}} // CHECK-NEXT: vector_transfer_write [[CST0]], {{.*}}, [[VAL00]], [[VAL01]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> - // CHECK-NEXT: [[VAL10:%.*]] = affine_apply [[ID1]]{{.*}} - // CHECK-NEXT: [[VAL11:%.*]] = affine_apply [[D0P8]]{{.*}} + // CHECK-NEXT: [[VAL10:%.*]] = affine.apply [[ID1]]{{.*}} + // CHECK-NEXT: [[VAL11:%.*]] = affine.apply [[D0P8]]{{.*}} // CHECK-NEXT: vector_transfer_write [[CST1]], {{.*}}, [[VAL10]], [[VAL11]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> - // CHECK-NEXT: [[VAL20:%.*]] = affine_apply [[ID1]]{{.*}} - // CHECK-NEXT: [[VAL21:%.*]] = affine_apply [[D0P16]]{{.*}} + // CHECK-NEXT: [[VAL20:%.*]] = affine.apply [[ID1]]{{.*}} + // CHECK-NEXT: [[VAL21:%.*]] = affine.apply [[D0P16]]{{.*}} // CHECK-NEXT: vector_transfer_write [[CST2]], {{.*}}, [[VAL20]], [[VAL21]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> - // CHECK-NEXT: [[VAL30:%.*]] = affine_apply [[ID1]]{{.*}} - // CHECK-NEXT: [[VAL31:%.*]] = affine_apply [[D0P24]]{{.*}} + // CHECK-NEXT: [[VAL30:%.*]] = affine.apply [[ID1]]{{.*}} + // CHECK-NEXT: [[VAL31:%.*]] = affine.apply [[D0P24]]{{.*}} // CHECK-NEXT: vector_transfer_write [[CST3]], {{.*}}, [[VAL30]], [[VAL31]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> // for %i0 = 0 to %M { @@ -47,17 +47,17 @@ func @vector_add_2d(%M : index, %N : index) -> f32 { // CHECK-NEXT: [[CST1:%.*]] = constant splat<vector<8xf32>, 2.000000e+00> : vector<8xf32> // CHECK-NEXT: [[CST2:%.*]] = constant splat<vector<8xf32>, 2.000000e+00> : vector<8xf32> // CHECK-NEXT: [[CST3:%.*]] = constant splat<vector<8xf32>, 2.000000e+00> : vector<8xf32> - // CHECK-NEXT: [[VAL00:%.*]] = affine_apply [[ID1]]{{.*}} - // CHECK-NEXT: [[VAL01:%.*]] = affine_apply [[ID1]]{{.*}} + // CHECK-NEXT: [[VAL00:%.*]] = affine.apply [[ID1]]{{.*}} + // CHECK-NEXT: [[VAL01:%.*]] = affine.apply [[ID1]]{{.*}} // CHECK-NEXT: vector_transfer_write [[CST0]], {{.*}}, [[VAL00]], [[VAL01]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> - // CHECK-NEXT: [[VAL10:%.*]] = affine_apply [[ID1]]{{.*}} - // CHECK-NEXT: [[VAL11:%.*]] = affine_apply [[D0P8]]{{.*}} + // CHECK-NEXT: [[VAL10:%.*]] = affine.apply [[ID1]]{{.*}} + // CHECK-NEXT: [[VAL11:%.*]] = affine.apply [[D0P8]]{{.*}} // CHECK-NEXT: vector_transfer_write [[CST1]], {{.*}}, [[VAL10]], [[VAL11]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> - // CHECK-NEXT: [[VAL20:%.*]] = affine_apply [[ID1]]{{.*}} - // CHECK-NEXT: [[VAL21:%.*]] = affine_apply [[D0P16]]{{.*}} + // CHECK-NEXT: [[VAL20:%.*]] = affine.apply [[ID1]]{{.*}} + // CHECK-NEXT: [[VAL21:%.*]] = affine.apply [[D0P16]]{{.*}} // CHECK-NEXT: vector_transfer_write [[CST2]], {{.*}}, [[VAL20]], [[VAL21]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> - // CHECK-NEXT: [[VAL30:%.*]] = affine_apply [[ID1]]{{.*}} - // CHECK-NEXT: [[VAL31:%.*]] = affine_apply [[D0P24]]{{.*}} + // CHECK-NEXT: [[VAL30:%.*]] = affine.apply [[ID1]]{{.*}} + // CHECK-NEXT: [[VAL31:%.*]] = affine.apply [[D0P24]]{{.*}} // CHECK-NEXT: vector_transfer_write [[CST3]], {{.*}}, [[VAL30]], [[VAL31]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> // for %i2 = 0 to %M { @@ -69,45 +69,45 @@ func @vector_add_2d(%M : index, %N : index) -> f32 { // 4x unroll (jammed by construction). // CHECK: for %i4 = 0 to %arg0 { // CHECK-NEXT: for %i5 = 0 to %arg1 step 32 { - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read // CHECK-NEXT: {{.*}} = addf {{.*}} : vector<8xf32> // CHECK-NEXT: {{.*}} = addf {{.*}} : vector<8xf32> // CHECK-NEXT: {{.*}} = addf {{.*}} : vector<8xf32> // CHECK-NEXT: {{.*}} = addf {{.*}} : vector<8xf32> - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write // for %i4 = 0 to %M { diff --git a/mlir/test/Transforms/Vectorize/materialize_vectors_2d_to_1d.mlir b/mlir/test/Transforms/Vectorize/materialize_vectors_2d_to_1d.mlir index cfabd5bd025..92df49fa8fa 100644 --- a/mlir/test/Transforms/Vectorize/materialize_vectors_2d_to_1d.mlir +++ b/mlir/test/Transforms/Vectorize/materialize_vectors_2d_to_1d.mlir @@ -23,23 +23,23 @@ func @vector_add_2d(%M : index, %N : index) -> f32 { // CHECK-NEXT: {{.*}} = constant splat<vector<8xf32>, 1.000000e+00> : vector<8xf32> // CHECK-NEXT: {{.*}} = constant splat<vector<8xf32>, 1.000000e+00> : vector<8xf32> // CHECK-NEXT: {{.*}} = constant splat<vector<8xf32>, 1.000000e+00> : vector<8xf32> - // CHECK-NEXT: [[VAL00:%.*]] = affine_apply [[ID1]](%i0) - // CHECK-NEXT: [[VAL01:%.*]] = affine_apply [[ID1]](%i1) + // CHECK-NEXT: [[VAL00:%.*]] = affine.apply [[ID1]](%i0) + // CHECK-NEXT: [[VAL01:%.*]] = affine.apply [[ID1]](%i1) // CHECK-NEXT: vector_transfer_write {{.*}}, {{.*}}, [[VAL00]], [[VAL01]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> - // CHECK-NEXT: [[VAL10:%.*]] = affine_apply [[ID1]](%i0) - // CHECK-NEXT: [[VAL11:%.*]] = affine_apply [[D0P8]](%i1) + // CHECK-NEXT: [[VAL10:%.*]] = affine.apply [[ID1]](%i0) + // CHECK-NEXT: [[VAL11:%.*]] = affine.apply [[D0P8]](%i1) // CHECK-NEXT: vector_transfer_write {{.*}}, {{.*}}, [[VAL10]], [[VAL11]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> - // CHECK-NEXT: [[VAL20:%.*]] = affine_apply [[D0P1]](%i0) - // CHECK-NEXT: [[VAL21:%.*]] = affine_apply [[ID1]](%i1) + // CHECK-NEXT: [[VAL20:%.*]] = affine.apply [[D0P1]](%i0) + // CHECK-NEXT: [[VAL21:%.*]] = affine.apply [[ID1]](%i1) // CHECK-NEXT: vector_transfer_write {{.*}}, {{.*}}, [[VAL20]], [[VAL21]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> - // CHECK-NEXT: [[VAL30:%.*]] = affine_apply [[D0P1]](%i0) - // CHECK-NEXT: [[VAL31:%.*]] = affine_apply [[D0P8]](%i1) + // CHECK-NEXT: [[VAL30:%.*]] = affine.apply [[D0P1]](%i0) + // CHECK-NEXT: [[VAL31:%.*]] = affine.apply [[D0P8]](%i1) // CHECK-NEXT: vector_transfer_write {{.*}}, {{.*}}, [[VAL30]], [[VAL31]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> - // CHECK-NEXT: [[VAL40:%.*]] = affine_apply [[D0P2]](%i0) - // CHECK-NEXT: [[VAL41:%.*]] = affine_apply [[ID1]](%i1) + // CHECK-NEXT: [[VAL40:%.*]] = affine.apply [[D0P2]](%i0) + // CHECK-NEXT: [[VAL41:%.*]] = affine.apply [[ID1]](%i1) // CHECK-NEXT: vector_transfer_write {{.*}}, {{.*}}, [[VAL40]], [[VAL41]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> - // CHECK-NEXT: [[VAL50:%.*]] = affine_apply [[D0P2]](%i0) - // CHECK-NEXT: [[VAL51:%.*]] = affine_apply [[D0P8]](%i1) + // CHECK-NEXT: [[VAL50:%.*]] = affine.apply [[D0P2]](%i0) + // CHECK-NEXT: [[VAL51:%.*]] = affine.apply [[D0P8]](%i1) // CHECK-NEXT: vector_transfer_write {{.*}}, {{.*}}, [[VAL50]], [[VAL51]] {permutation_map: [[D0D1TOD1]]} : vector<8xf32> for %i0 = 0 to %M { for %i1 = 0 to %N { @@ -61,41 +61,41 @@ func @vector_add_2d(%M : index, %N : index) -> f32 { // (3x2)x unroll (jammed by construction). // CHECK: for %i4 = 0 to %arg0 step 3 { // CHECK-NEXT: for %i5 = 0 to %arg1 step 16 { - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read // CHECK-NEXT: {{.*}} = addf {{.*}} : vector<8xf32> // CHECK-NEXT: {{.*}} = addf {{.*}} : vector<8xf32> @@ -103,23 +103,23 @@ func @vector_add_2d(%M : index, %N : index) -> f32 { // CHECK-NEXT: {{.*}} = addf {{.*}} : vector<8xf32> // CHECK-NEXT: {{.*}} = addf {{.*}} : vector<8xf32> // CHECK-NEXT: {{.*}} = addf {{.*}} : vector<8xf32> - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write // for %i4 = 0 to %M { diff --git a/mlir/test/Transforms/Vectorize/materialize_vectors_2d_to_2d.mlir b/mlir/test/Transforms/Vectorize/materialize_vectors_2d_to_2d.mlir index 82cfd85d2dc..36ec96e30b4 100644 --- a/mlir/test/Transforms/Vectorize/materialize_vectors_2d_to_2d.mlir +++ b/mlir/test/Transforms/Vectorize/materialize_vectors_2d_to_2d.mlir @@ -17,11 +17,11 @@ func @vector_add_2d(%M : index, %N : index) -> f32 { // CHECK-NEXT: for %i1 = 0 to %arg1 step 32 { // CHECK-NEXT: {{.*}} = constant splat<vector<3x16xf32>, 1.000000e+00> : vector<3x16xf32> // CHECK-NEXT: {{.*}} = constant splat<vector<3x16xf32>, 1.000000e+00> : vector<3x16xf32> - // CHECK-NEXT: [[VAL00:%.*]] = affine_apply [[ID1]](%i0) - // CHECK-NEXT: [[VAL01:%.*]] = affine_apply [[ID1]](%i1) + // CHECK-NEXT: [[VAL00:%.*]] = affine.apply [[ID1]](%i0) + // CHECK-NEXT: [[VAL01:%.*]] = affine.apply [[ID1]](%i1) // CHECK-NEXT: vector_transfer_write {{.*}}, {{.*}}, [[VAL00]], [[VAL01]] {permutation_map: [[ID2]]} : vector<3x16xf32> - // CHECK-NEXT: [[VAL10:%.*]] = affine_apply [[ID1]](%i0) - // CHECK-NEXT: [[VAL11:%.*]] = affine_apply [[D0P16]](%i1) + // CHECK-NEXT: [[VAL10:%.*]] = affine.apply [[ID1]](%i0) + // CHECK-NEXT: [[VAL11:%.*]] = affine.apply [[D0P16]](%i1) // CHECK-NEXT: vector_transfer_write {{.*}}, {{.*}}, [[VAL10]], [[VAL11]] {permutation_map: [[ID2]]} : vector<3x16xf32> // for %i0 = 0 to %M { @@ -35,11 +35,11 @@ func @vector_add_2d(%M : index, %N : index) -> f32 { // CHECK-NEXT: for %i3 = 0 to %arg1 step 32 { // CHECK-NEXT: {{.*}} = constant splat<vector<3x16xf32>, 2.000000e+00> : vector<3x16xf32> // CHECK-NEXT: {{.*}} = constant splat<vector<3x16xf32>, 2.000000e+00> : vector<3x16xf32> - // CHECK-NEXT: [[VAL00:%.*]] = affine_apply [[ID1]](%i2) - // CHECK-NEXT: [[VAL01:%.*]] = affine_apply [[ID1]](%i3) + // CHECK-NEXT: [[VAL00:%.*]] = affine.apply [[ID1]](%i2) + // CHECK-NEXT: [[VAL01:%.*]] = affine.apply [[ID1]](%i3) // CHECK-NEXT: vector_transfer_write {{.*}}, {{.*}}, [[VAL00]], [[VAL01]] {permutation_map: [[ID2]]} : vector<3x16xf32> - // CHECK-NEXT: [[VAL10:%.*]] = affine_apply [[ID1]](%i2) - // CHECK-NEXT: [[VAL11:%.*]] = affine_apply [[D0P16]](%i3) + // CHECK-NEXT: [[VAL10:%.*]] = affine.apply [[ID1]](%i2) + // CHECK-NEXT: [[VAL11:%.*]] = affine.apply [[D0P16]](%i3) // CHECK-NEXT: vector_transfer_write {{.*}}, {{.*}}, [[VAL10]], [[VAL11]] {permutation_map: [[ID2]]} : vector<3x16xf32> // for %i2 = 0 to %M { @@ -51,25 +51,25 @@ func @vector_add_2d(%M : index, %N : index) -> f32 { // 2x unroll (jammed by construction). // CHECK: for %i4 = 0 to %arg0 step 3 { // CHECK-NEXT: for %i5 = 0 to %arg1 step 32 { - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: {{.*}} = vector_transfer_read // CHECK-NEXT: {{.*}} = addf {{.*}} : vector<3x16xf32> // CHECK-NEXT: {{.*}} = addf {{.*}} : vector<3x16xf32> - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write - // CHECK-NEXT: {{.*}} = affine_apply - // CHECK-NEXT: {{.*}} = affine_apply + // CHECK-NEXT: {{.*}} = affine.apply + // CHECK-NEXT: {{.*}} = affine.apply // CHECK-NEXT: vector_transfer_write // for %i4 = 0 to %M { diff --git a/mlir/test/Transforms/Vectorize/normalize_maps.mlir b/mlir/test/Transforms/Vectorize/normalize_maps.mlir index b5af6ab6ef1..9569dbe07fe 100644 --- a/mlir/test/Transforms/Vectorize/normalize_maps.mlir +++ b/mlir/test/Transforms/Vectorize/normalize_maps.mlir @@ -10,49 +10,49 @@ // CHECK-LABEL: func @simple() func @simple() { for %i0 = 0 to 7 { - %0 = affine_apply (d0) -> (d0) (%i0) - %1 = affine_apply (d0) -> (d0) (%0) - %2 = affine_apply (d0, d1) -> (d0 + d1) (%0, %0) - %3 = affine_apply (d0, d1) -> (d0 - d1) (%0, %0) + %0 = affine.apply (d0) -> (d0) (%i0) + %1 = affine.apply (d0) -> (d0) (%0) + %2 = affine.apply (d0, d1) -> (d0 + d1) (%0, %0) + %3 = affine.apply (d0, d1) -> (d0 - d1) (%0, %0) } // CHECK-NEXT: for %i0 = 0 to 7 - // CHECK-NEXT: {{.*}} affine_apply #[[ID1]](%i0) - // CHECK-NEXT: {{.*}} affine_apply #[[D0TIMES2]](%i0) - // CHECK-NEXT: {{.*}} affine_apply #[[ZERO]]() + // CHECK-NEXT: {{.*}} affine.apply #[[ID1]](%i0) + // CHECK-NEXT: {{.*}} affine.apply #[[D0TIMES2]](%i0) + // CHECK-NEXT: {{.*}} affine.apply #[[ZERO]]() for %i1 = 0 to 7 { for %i2 = 0 to 42 { - %20 = affine_apply (d0, d1) -> (d1) (%i1, %i2) - %21 = affine_apply (d0, d1) -> (d0) (%i1, %i2) - %22 = affine_apply (d0, d1) -> (d0 + d1) (%20, %21) - %23 = affine_apply (d0, d1) -> (d0 - d1) (%20, %21) - %24 = affine_apply (d0, d1) -> (-d0 + d1) (%20, %21) + %20 = affine.apply (d0, d1) -> (d1) (%i1, %i2) + %21 = affine.apply (d0, d1) -> (d0) (%i1, %i2) + %22 = affine.apply (d0, d1) -> (d0 + d1) (%20, %21) + %23 = affine.apply (d0, d1) -> (d0 - d1) (%20, %21) + %24 = affine.apply (d0, d1) -> (-d0 + d1) (%20, %21) } } // CHECK: for %i1 = 0 to 7 // CHECK-NEXT: for %i2 = 0 to 42 - // CHECK-NEXT: {{.*}} affine_apply #[[D0PLUSD1]](%i1, %i2) - // CHECK-NEXT: {{.*}} affine_apply #[[MINSD0PLUSD1]](%i1, %i2) - // CHECK-NEXT: {{.*}} affine_apply #[[D0MINUSD1]](%i1, %i2) + // CHECK-NEXT: {{.*}} affine.apply #[[D0PLUSD1]](%i1, %i2) + // CHECK-NEXT: {{.*}} affine.apply #[[MINSD0PLUSD1]](%i1, %i2) + // CHECK-NEXT: {{.*}} affine.apply #[[D0MINUSD1]](%i1, %i2) for %i3 = 0 to 16 { for %i4 = 0 to 47 step 2 { for %i5 = 0 to 78 step 16 { - %50 = affine_apply (d0) -> (d0) (%i3) - %51 = affine_apply (d0) -> (d0) (%i4) - %52 = affine_apply (d0) -> (d0) (%i5) - %53 = affine_apply (d0, d1, d2) -> (d0) (%50, %51, %52) - %54 = affine_apply (d0, d1, d2) -> (d1) (%50, %51, %52) - %55 = affine_apply (d0, d1, d2) -> (d2) (%50, %51, %52) + %50 = affine.apply (d0) -> (d0) (%i3) + %51 = affine.apply (d0) -> (d0) (%i4) + %52 = affine.apply (d0) -> (d0) (%i5) + %53 = affine.apply (d0, d1, d2) -> (d0) (%50, %51, %52) + %54 = affine.apply (d0, d1, d2) -> (d1) (%50, %51, %52) + %55 = affine.apply (d0, d1, d2) -> (d2) (%50, %51, %52) } } } // CHECK: for %i3 = 0 to 16 // CHECK-NEXT: for %i4 = 0 to 47 step 2 // CHECK-NEXT: for %i5 = 0 to 78 step 16 - // CHECK-NEXT: {{.*}} affine_apply #[[ID1]](%i3) - // CHECK-NEXT: {{.*}} affine_apply #[[ID1]](%i4) - // CHECK-NEXT: {{.*}} affine_apply #[[ID1]](%i5) + // CHECK-NEXT: {{.*}} affine.apply #[[ID1]](%i3) + // CHECK-NEXT: {{.*}} affine.apply #[[ID1]](%i4) + // CHECK-NEXT: {{.*}} affine.apply #[[ID1]](%i5) return } diff --git a/mlir/test/Transforms/Vectorize/vectorize_1d.mlir b/mlir/test/Transforms/Vectorize/vectorize_1d.mlir index 478200edf7a..da69e8dd26d 100644 --- a/mlir/test/Transforms/Vectorize/vectorize_1d.mlir +++ b/mlir/test/Transforms/Vectorize/vectorize_1d.mlir @@ -34,27 +34,27 @@ func @vec1d(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) { // // CHECK: for %i{{[0-9]*}} = 0 to [[ARG_M]] { for %i2 = 0 to %M { // not vectorized, would vectorize with --test-fastest-varying=1 - %r2 = affine_apply (d0) -> (d0) (%i2) + %r2 = affine.apply (d0) -> (d0) (%i2) %a2 = load %A[%r2#0, %cst0] : memref<?x?xf32> } // // CHECK:for [[IV3:%[a-zA-Z0-9]+]] = 0 to [[ARG_M]] step 128 -// CHECK-NEXT: [[APP3:%[a-zA-Z0-9]+]] = affine_apply {{.*}}[[IV3]] +// CHECK-NEXT: [[APP3:%[a-zA-Z0-9]+]] = affine.apply {{.*}}[[IV3]] // CHECK-NEXT: {{.*}} = vector_transfer_read %arg0, [[C0]], [[APP3]] {permutation_map: #[[map_proj_d0d1_d1]]} : {{.*}} -> vector<128xf32> for %i3 = 0 to %M { // vectorized - %r3 = affine_apply (d0) -> (d0) (%i3) + %r3 = affine.apply (d0) -> (d0) (%i3) %a3 = load %A[%cst0, %r3#0] : memref<?x?xf32> } // // CHECK:for [[IV4:%[i0-9]+]] = 0 to [[ARG_M]] step 128 { // CHECK-NEXT: for [[IV5:%[i0-9]*]] = 0 to [[ARG_N]] { -// CHECK-NEXT: [[APP50:%[0-9]+]] = affine_apply {{.*}}([[IV4]], [[IV5]]) -// CHECK-NEXT: [[APP51:%[0-9]+]] = affine_apply {{.*}}([[IV4]], [[IV5]]) +// CHECK-NEXT: [[APP50:%[0-9]+]] = affine.apply {{.*}}([[IV4]], [[IV5]]) +// CHECK-NEXT: [[APP51:%[0-9]+]] = affine.apply {{.*}}([[IV4]], [[IV5]]) // CHECK-NEXT: {{.*}} = vector_transfer_read %arg0, [[APP50]], [[APP51]] {permutation_map: #[[map_proj_d0d1_d1]]} : {{.*}} -> vector<128xf32> for %i4 = 0 to %M { // vectorized for %i5 = 0 to %N { // not vectorized, would vectorize with --test-fastest-varying=1 - %r50 = affine_apply (d0, d1) -> (d1) (%i4, %i5) - %r51 = affine_apply (d0, d1) -> (d0) (%i4, %i5) + %r50 = affine.apply (d0, d1) -> (d1) (%i4, %i5) + %r51 = affine.apply (d0, d1) -> (d0) (%i4, %i5) %a5 = load %A[%r50, %r51] : memref<?x?xf32> } } @@ -63,21 +63,21 @@ func @vec1d(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) { // CHECK-NEXT: for [[IV7:%[i0-9]*]] = 0 to [[ARG_N]] { for %i6 = 0 to %M { // not vectorized, would vectorize with --test-fastest-varying=1 for %i7 = 0 to %N { // not vectorized, can never vectorize - %r70 = affine_apply (d0, d1) -> (d1 + d0) (%i6, %i7) - %r71 = affine_apply (d0, d1) -> (d0) (%i6, %i7) + %r70 = affine.apply (d0, d1) -> (d1 + d0) (%i6, %i7) + %r71 = affine.apply (d0, d1) -> (d0) (%i6, %i7) %a7 = load %A[%r70, %r71] : memref<?x?xf32> } } // // CHECK:for [[IV8:%[i0-9]+]] = 0 to [[ARG_M]] step 128 // CHECK-NEXT: for [[IV9:%[i0-9]*]] = 0 to [[ARG_N]] { -// CHECK-NEXT: [[APP9_0:%[0-9]+]] = affine_apply {{.*}}([[IV8]], [[IV9]]) -// CHECK-NEXT: [[APP9_1:%[0-9]+]] = affine_apply {{.*}}([[IV8]], [[IV9]]) +// CHECK-NEXT: [[APP9_0:%[0-9]+]] = affine.apply {{.*}}([[IV8]], [[IV9]]) +// CHECK-NEXT: [[APP9_1:%[0-9]+]] = affine.apply {{.*}}([[IV8]], [[IV9]]) // CHECK-NEXT: {{.*}} = vector_transfer_read %arg0, [[APP9_0]], [[APP9_1]] {permutation_map: #[[map_proj_d0d1_d1]]} : {{.*}} -> vector<128xf32> for %i8 = 0 to %M { // vectorized for %i9 = 0 to %N { - %r90 = affine_apply (d0, d1) -> (d1) (%i8, %i9) - %r91 = affine_apply (d0, d1) -> (d0 + d1) (%i8, %i9) + %r90 = affine.apply (d0, d1) -> (d1) (%i8, %i9) + %r91 = affine.apply (d0, d1) -> (d0 + d1) (%i8, %i9) %a9 = load %A[%r90, %r91] : memref<?x?xf32> } } @@ -86,11 +86,11 @@ func @vec1d(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) { // CHECK: for [[IV11:%[i0-9]*]] = 0 to %{{[0-9]*}} { for %i10 = 0 to %M { // not vectorized, need per load transposes for %i11 = 0 to %N { // not vectorized, need per load transposes - %r11_0 = affine_apply (d0, d1) -> (d0) (%i10, %i11) - %r11_1 = affine_apply (d0, d1) -> (d1) (%i10, %i11) + %r11_0 = affine.apply (d0, d1) -> (d0) (%i10, %i11) + %r11_1 = affine.apply (d0, d1) -> (d1) (%i10, %i11) %a11 = load %A[%r11_0, %r11_1] : memref<?x?xf32> - %r12_0 = affine_apply (d0, d1) -> (d1) (%i10, %i11) - %r12_1 = affine_apply (d0, d1) -> (d0) (%i10, %i11) + %r12_0 = affine.apply (d0, d1) -> (d1) (%i10, %i11) + %r12_1 = affine.apply (d0, d1) -> (d0) (%i10, %i11) store %a11, %A[%r12_0, %r12_1] : memref<?x?xf32> } } @@ -101,9 +101,9 @@ func @vec1d(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) { for %i12 = 0 to %M { // not vectorized, can never vectorize for %i13 = 0 to %N { // not vectorized, can never vectorize for %i14 = 0 to %P { // vectorized - %r14_0 = affine_apply (d0, d1, d2) -> (d1) (%i12, %i13, %i14) - %r14_1 = affine_apply (d0, d1, d2) -> (d0 + d1) (%i12, %i13, %i14) - %r14_2 = affine_apply (d0, d1, d2) -> (d0 + d2) (%i12, %i13, %i14) + %r14_0 = affine.apply (d0, d1, d2) -> (d1) (%i12, %i13, %i14) + %r14_1 = affine.apply (d0, d1, d2) -> (d0 + d1) (%i12, %i13, %i14) + %r14_2 = affine.apply (d0, d1, d2) -> (d0 + d2) (%i12, %i13, %i14) %a14 = load %B[%r14_0, %r14_1, %r14_2] : memref<?x?x?xf32> } } diff --git a/mlir/test/Transforms/canonicalize.mlir b/mlir/test/Transforms/canonicalize.mlir index dfc34cd66a5..29accf4ffc1 100644 --- a/mlir/test/Transforms/canonicalize.mlir +++ b/mlir/test/Transforms/canonicalize.mlir @@ -255,8 +255,8 @@ func @hoist_constant(%arg0: memref<8xi32>) { func @const_fold_propagate() -> memref<?x?xf32> { %VT_i = constant 512 : index - %VT_i_s = affine_apply (d0) -> (d0 floordiv 8) (%VT_i) - %VT_k_l = affine_apply (d0) -> (d0 floordiv 16) (%VT_i) + %VT_i_s = affine.apply (d0) -> (d0 floordiv 8) (%VT_i) + %VT_k_l = affine.apply (d0) -> (d0 floordiv 16) (%VT_i) // CHECK: = alloc() : memref<64x32xf32> %Av = alloc(%VT_i_s, %VT_k_l) : memref<?x?xf32> diff --git a/mlir/test/Transforms/constant-fold.mlir b/mlir/test/Transforms/constant-fold.mlir index 67f2333ddbe..6043e478c5a 100644 --- a/mlir/test/Transforms/constant-fold.mlir +++ b/mlir/test/Transforms/constant-fold.mlir @@ -121,13 +121,13 @@ func @affine_apply(%variable : index) -> (index, index, index) { // CHECK: %c1159 = constant 1159 : index // CHECK: %c1152 = constant 1152 : index - %x0 = affine_apply (d0, d1)[S0] -> ( (d0 + 128 * S0) floordiv 128 + d1 mod 128) + %x0 = affine.apply (d0, d1)[S0] -> ( (d0 + 128 * S0) floordiv 128 + d1 mod 128) (%c177, %c211)[%N] - %x1 = affine_apply (d0, d1)[S0] -> (128 * (S0 ceildiv 128)) + %x1 = affine.apply (d0, d1)[S0] -> (128 * (S0 ceildiv 128)) (%c177, %c211)[%N] // CHECK: %c42 = constant 42 : index - %y = affine_apply (d0) -> (42) (%variable) + %y = affine.apply (d0) -> (42) (%variable) // CHECK: return %c1159, %c1152, %c42 return %x0, %x1, %y : index, index, index @@ -321,7 +321,7 @@ func @fold_extract_element(%arg0 : index) -> (f32, f16, f16, i32) { // --------------------------------------------------------------------------// // IMPORTANT NOTE: the operations in this test are exactly those produced by -// lowering affine_apply (i) -> (i mod 42) to standard operations. Please only +// lowering affine.apply (i) -> (i mod 42) to standard operations. Please only // change these operations together with the affine lowering pass tests. // --------------------------------------------------------------------------// // CHECK-LABEL: @lowered_affine_mod @@ -347,7 +347,7 @@ func @lowered_affine_mod() -> (index, index) { // --------------------------------------------------------------------------// // IMPORTANT NOTE: the operations in this test are exactly those produced by -// lowering affine_apply (i) -> (i mod 42) to standard operations. Please only +// lowering affine.apply (i) -> (i mod 42) to standard operations. Please only // change these operations together with the affine lowering pass tests. // --------------------------------------------------------------------------// // CHECK-LABEL: func @lowered_affine_floordiv @@ -379,7 +379,7 @@ func @lowered_affine_floordiv() -> (index, index) { // --------------------------------------------------------------------------// // IMPORTANT NOTE: the operations in this test are exactly those produced by -// lowering affine_apply (i) -> (i mod 42) to standard operations. Please only +// lowering affine.apply (i) -> (i mod 42) to standard operations. Please only // change these operations together with the affine lowering pass tests. // --------------------------------------------------------------------------// // CHECK-LABEL: func @lowered_affine_ceildiv diff --git a/mlir/test/Transforms/cse.mlir b/mlir/test/Transforms/cse.mlir index ff5c5af92ce..c4c0da7053e 100644 --- a/mlir/test/Transforms/cse.mlir +++ b/mlir/test/Transforms/cse.mlir @@ -29,9 +29,9 @@ func @basic_ml() -> (index, index) { %c0 = constant 0 : index %c1 = constant 0 : index - // CHECK-NEXT: %0 = affine_apply #map0(%c0) - %0 = affine_apply #map0(%c0) - %1 = affine_apply #map0(%c1) + // CHECK-NEXT: %0 = affine.apply #map0(%c0) + %0 = affine.apply #map0(%c0) + %1 = affine.apply #map0(%c1) // CHECK-NEXT: return %0, %0 : index, index return %0, %1 : index, index diff --git a/mlir/test/Transforms/dma-generate.mlir b/mlir/test/Transforms/dma-generate.mlir index cdc7441b14e..a954bdb96a1 100644 --- a/mlir/test/Transforms/dma-generate.mlir +++ b/mlir/test/Transforms/dma-generate.mlir @@ -34,8 +34,8 @@ func @loop_nest_1d() { // CHECK-NEXT: dma_wait %6[%c0], %c256_0 : memref<1xi32> // CHECK: for %i0 = 0 to 256 { // CHECK-NEXT: %7 = load %3[%i0] : memref<256xf32, 1> - // CHECK: %8 = affine_apply [[MAP_PLUS_256]](%i0) - // CHECK: %9 = affine_apply [[MAP_MINUS_256]](%8) + // CHECK: %8 = affine.apply [[MAP_PLUS_256]](%i0) + // CHECK: %9 = affine.apply [[MAP_MINUS_256]](%8) // CHECK-NEXT: %10 = load %5[%9] : memref<256xf32, 1> // Already in faster memory space. // CHECK: %11 = load %2[%i0] : memref<256xf32, 1> @@ -43,7 +43,7 @@ func @loop_nest_1d() { // CHECK-NEXT: return for %i = 0 to 256 { load %A[%i] : memref<256 x f32> - %idx = affine_apply (d0) -> (d0 + 256)(%i) + %idx = affine.apply (d0) -> (d0 + 256)(%i) load %B[%idx] : memref<512 x f32> load %F[%i] : memref<256 x f32, 1> } @@ -72,18 +72,18 @@ func @loop_nest_1d() { // CHECK-NEXT: for %i1 = 0 to 32 { // CHECK-NEXT: for %i2 = 0 to 32 { // CHECK-NEXT: for %i3 = 0 to 16 { -// CHECK-NEXT: %7 = affine_apply #map{{[0-9]+}}(%i1, %i3) +// CHECK-NEXT: %7 = affine.apply #map{{[0-9]+}}(%i1, %i3) // CHECK-NEXT: %8 = load [[BUFB]][%7, %i0] : memref<512x32xf32, 1> // CHECK-NEXT: "foo"(%8) : (f32) -> () // CHECK-NEXT: } // CHECK-NEXT: for %i4 = 0 to 16 { -// CHECK-NEXT: %9 = affine_apply #map{{[0-9]+}}(%i2, %i4) +// CHECK-NEXT: %9 = affine.apply #map{{[0-9]+}}(%i2, %i4) // CHECK-NEXT: %10 = load [[BUFA]][%9, %i1] : memref<512x32xf32, 1> // CHECK-NEXT: "bar"(%10) : (f32) -> () // CHECK-NEXT: } // CHECK-NEXT: for %i5 = 0 to 16 { // CHECK-NEXT: %11 = "abc_compute"() : () -> f32 -// CHECK-NEXT: %12 = affine_apply #map{{[0-9]+}}(%i2, %i5) +// CHECK-NEXT: %12 = affine.apply #map{{[0-9]+}}(%i2, %i5) // CHECK-NEXT: %13 = load [[BUFC]][%12, %i0] : memref<512x32xf32, 1> // CHECK-NEXT: %14 = "addf32"(%11, %13) : (f32, f32) -> f32 // CHECK-NEXT: store %14, [[BUFC]][%12, %i0] : memref<512x32xf32, 1> @@ -106,18 +106,18 @@ func @loop_nest_high_d(%A: memref<512 x 32 x f32>, for %kT = 0 to 32 { for %iT = 0 to 32 { for %kk = 0 to 16 { // k intratile - %k = affine_apply (d0, d1) -> (16*d0 + d1) (%kT, %kk) + %k = affine.apply (d0, d1) -> (16*d0 + d1) (%kT, %kk) %v0 = load %B[%k, %jT] : memref<512 x 32 x f32> "foo"(%v0) : (f32) -> () } for %ii = 0 to 16 { // i intratile. - %i = affine_apply (d0, d1) -> (16*d0 + d1)(%iT, %ii) + %i = affine.apply (d0, d1) -> (16*d0 + d1)(%iT, %ii) %v1 = load %A[%i, %kT] : memref<512 x 32 x f32> "bar"(%v1) : (f32) -> () } for %ii_ = 0 to 16 { // i intratile. %v2 = "abc_compute"() : () -> f32 - %i_ = affine_apply (d0, d1) -> (16*d0 + d1)(%iT, %ii_) + %i_ = affine.apply (d0, d1) -> (16*d0 + d1)(%iT, %ii_) %v3 = load %C[%i_, %jT] : memref<512 x 32 x f32> %v4 = "addf32"(%v2, %v3) : (f32, f32) -> (f32) store %v4, %C[%i_, %jT] : memref<512 x 32 x f32> @@ -135,7 +135,7 @@ func @loop_nest_high_d(%A: memref<512 x 32 x f32>, // CHECK-LABEL: func @loop_nest_modulo() { // CHECK: %0 = alloc() : memref<256x8xf32> // CHECK-NEXT: for %i0 = 0 to 32 step 4 { -// CHECK-NEXT: %1 = affine_apply #map{{[0-9]+}}(%i0) +// CHECK-NEXT: %1 = affine.apply #map{{[0-9]+}}(%i0) // CHECK-NEXT: %2 = alloc() : memref<1x2xf32, 1> // CHECK-NEXT: %3 = alloc() : memref<1xi32> // CHECK-NEXT: dma_start %0[%1, %c0], %2[%c0, %c0], %c2, %3[%c0] : memref<256x8xf32>, memref<1x2xf32, 1>, memref<1xi32> @@ -151,7 +151,7 @@ func @loop_nest_modulo() { for %i = 0 to 32 step 4 { // DMAs will be performed at this level (%j is the first unit stride loop) for %j = 0 to 8 { - %idx = affine_apply (d0) -> (d0 mod 2) (%j) + %idx = affine.apply (d0) -> (d0 mod 2) (%j) // A buffer of size 32 x 2 will be allocated (original buffer was 256 x 8). %v = load %A[%i, %idx] : memref<256 x 8 x f32> } @@ -175,8 +175,8 @@ func @loop_nest_tiled() -> memref<256x1024xf32> { // CHECK-NEXT: for %i3 = #map for %i2 = (d0) -> (d0)(%i0) to (d0) -> (d0 + 32)(%i0) { for %i3 = (d0) -> (d0)(%i1) to (d0) -> (d0 + 32)(%i1) { - // CHECK-NEXT: %5 = affine_apply [[MAP_INDEX_DIFF_EVEN]](%i0, %i1, %i2, %i3) - // CHECK-NEXT: %6 = affine_apply [[MAP_INDEX_DIFF_ODD]](%i0, %i1, %i2, %i3) + // CHECK-NEXT: %5 = affine.apply [[MAP_INDEX_DIFF_EVEN]](%i0, %i1, %i2, %i3) + // CHECK-NEXT: %6 = affine.apply [[MAP_INDEX_DIFF_ODD]](%i0, %i1, %i2, %i3) // CHECK-NEXT: %7 = load %3[%5, %6] : memref<32x32xf32, 1> %1 = load %0[%i2, %i3] : memref<256x1024xf32> } // CHECK-NEXT: } @@ -198,8 +198,8 @@ func @dma_constant_dim_access(%A : memref<100x100xf32>) { // CHECK-NEXT: dma_wait %1[%c0], %c100 : memref<1xi32> for %i = 0 to 100 { for %j = 0 to ()[s0] -> (s0) ()[%N] { - // CHECK: %2 = affine_apply [[MAP_D0_MINUS_ONE]](%c1_0, %i1) - // CHECK: %3 = affine_apply [[MAP_D1]](%c1_0, %i1) + // CHECK: %2 = affine.apply [[MAP_D0_MINUS_ONE]](%c1_0, %i1) + // CHECK: %3 = affine.apply [[MAP_D1]](%c1_0, %i1) // CHECK-NEXT: %4 = load %0[%2, %3] : memref<1x100xf32, 1> load %A[%one, %j] : memref<100 x 100 x f32> } @@ -212,7 +212,7 @@ func @dma_with_symbolic_accesses(%A : memref<100x100xf32>, %M : index) { %N = constant 9 : index for %i = 0 to 100 { for %j = 0 to 100 { - %idy = affine_apply (d0, d1) [s0, s1] -> (d1 + s0 + s1)(%i, %j)[%M, %N] + %idy = affine.apply (d0, d1) [s0, s1] -> (d1 + s0 + s1)(%i, %j)[%M, %N] load %A[%i, %idy] : memref<100 x 100 x f32> } } @@ -223,9 +223,9 @@ func @dma_with_symbolic_accesses(%A : memref<100x100xf32>, %M : index) { // CHECK-NEXT: dma_wait %2[%c0], %c10000 // CHECK-NEXT: for %i0 = 0 to 100 { // CHECK-NEXT: for %i1 = 0 to 100 { -// CHECK-NEXT: %3 = affine_apply [[MAP_SYM_SHIFT]](%i0, %i1)[%arg1, %c9] -// CHECK-NEXT: %4 = affine_apply [[MAP_3D_D1]](%arg1, %i0, %3) -// CHECK-NEXT: %5 = affine_apply [[MAP_SUB_OFFSET]](%arg1, %i0, %3) +// CHECK-NEXT: %3 = affine.apply [[MAP_SYM_SHIFT]](%i0, %i1)[%arg1, %c9] +// CHECK-NEXT: %4 = affine.apply [[MAP_3D_D1]](%arg1, %i0, %3) +// CHECK-NEXT: %5 = affine.apply [[MAP_SUB_OFFSET]](%arg1, %i0, %3) // CHECK-NEXT: %6 = load %1[%4, %5] : memref<100x100xf32, 1> // CHECK-NEXT: } // CHECK-NEXT: } @@ -243,7 +243,7 @@ func @dma_with_symbolic_loop_bounds(%A : memref<100x100xf32>, %M : index, %N: in // CHECK-NEXT: dma_wait %1[%c0], %c10000 : memref<1xi32> for %i = 0 to 100 { for %j = %M to %N { - %idy = affine_apply (d1) [s0] -> (d1 + s0)(%j)[%K] + %idy = affine.apply (d1) [s0] -> (d1 + s0)(%j)[%K] load %A[%i, %idy] : memref<100 x 100 x f32> } } @@ -275,9 +275,9 @@ func @dma_memref_3d(%arg0: memref<1024x1024x1024xf32>) { for %i = 0 to 1024 { for %j = 0 to 1024 { for %k = 0 to 1024 { - %idx = affine_apply (d0) -> (d0 mod 128)(%i) - %idy = affine_apply (d0) -> (d0 mod 128)(%j) - %idz = affine_apply (d0) -> (d0 mod 128)(%k) + %idx = affine.apply (d0) -> (d0 mod 128)(%i) + %idy = affine.apply (d0) -> (d0 mod 128)(%j) + %idz = affine.apply (d0) -> (d0 mod 128)(%k) // DMA with nested striding (or emulating with loop around strided DMA) // not yet implemented. // CHECK: %5 = load %arg0[%2, %3, %4] : memref<1024x1024x1024xf32> @@ -310,16 +310,16 @@ func @multi_load_store_union() { %A = alloc() : memref<512 x 512 x f32> for %i = 0 to 256 { for %j = 0 to 256 { - %idx = affine_apply (d0) -> (d0 + 64)(%i) - %idy = affine_apply (d0) -> (d0 + 128)(%j) - %ishift = affine_apply (d0) -> (d0 + 2)(%i) - %jshift = affine_apply (d0) -> (d0 + 2)(%j) + %idx = affine.apply (d0) -> (d0 + 64)(%i) + %idy = affine.apply (d0) -> (d0 + 128)(%j) + %ishift = affine.apply (d0) -> (d0 + 2)(%i) + %jshift = affine.apply (d0) -> (d0 + 2)(%j) %u = load %A[%ishift, %idy] : memref<512 x 512 x f32> %v = load %A[%idx, %jshift] : memref<512 x 512 x f32> - %sidx = affine_apply (d0) -> (d0 + 128)(%i) - %sidy = affine_apply (d0) -> (d0 + 192)(%j) + %sidx = affine.apply (d0) -> (d0 + 128)(%i) + %sidy = affine.apply (d0) -> (d0 + 192)(%j) store %u, %A[%ishift, %sidy] : memref<512 x 512 x f32> store %v, %A[%sidx, %jshift] : memref<512 x 512 x f32> @@ -335,23 +335,23 @@ func @multi_load_store_union() { // CHECK-NEXT: %3 = alloc() : memref<1xi32> // CHECK-NEXT: for %i0 = 0 to 256 { // CHECK-NEXT: for %i1 = 0 to 256 { -// CHECK-NEXT: %4 = affine_apply [[MAP_PLUS_64]](%i0) -// CHECK-NEXT: %5 = affine_apply [[MAP_PLUS_128]](%i1) -// CHECK-NEXT: %6 = affine_apply [[MAP_PLUS_2]](%i0) -// CHECK-NEXT: %7 = affine_apply [[MAP_PLUS_2]](%i1) -// CHECK-NEXT: %8 = affine_apply [[MAP_D0_MINUS_2]](%6, %5) -// CHECK-NEXT: %9 = affine_apply [[MAP_D1_MINUS_2]](%6, %5) +// CHECK-NEXT: %4 = affine.apply [[MAP_PLUS_64]](%i0) +// CHECK-NEXT: %5 = affine.apply [[MAP_PLUS_128]](%i1) +// CHECK-NEXT: %6 = affine.apply [[MAP_PLUS_2]](%i0) +// CHECK-NEXT: %7 = affine.apply [[MAP_PLUS_2]](%i1) +// CHECK-NEXT: %8 = affine.apply [[MAP_D0_MINUS_2]](%6, %5) +// CHECK-NEXT: %9 = affine.apply [[MAP_D1_MINUS_2]](%6, %5) // CHECK-NEXT: %10 = load %1[%8, %9] : memref<382x446xf32, 1> -// CHECK-NEXT: %11 = affine_apply [[MAP_D0_MINUS_2]](%4, %7) -// CHECK-NEXT: %12 = affine_apply [[MAP_D1_MINUS_2]](%4, %7) +// CHECK-NEXT: %11 = affine.apply [[MAP_D0_MINUS_2]](%4, %7) +// CHECK-NEXT: %12 = affine.apply [[MAP_D1_MINUS_2]](%4, %7) // CHECK-NEXT: %13 = load %1[%11, %12] : memref<382x446xf32, 1> -// CHECK-NEXT: %14 = affine_apply [[MAP_PLUS_128]](%i0) -// CHECK-NEXT: %15 = affine_apply [[MAP_PLUS_192]](%i1) -// CHECK-NEXT: %16 = affine_apply [[MAP_D0_MINUS_2]](%6, %15) -// CHECK-NEXT: %17 = affine_apply [[MAP_D1_MINUS_2]](%6, %15) +// CHECK-NEXT: %14 = affine.apply [[MAP_PLUS_128]](%i0) +// CHECK-NEXT: %15 = affine.apply [[MAP_PLUS_192]](%i1) +// CHECK-NEXT: %16 = affine.apply [[MAP_D0_MINUS_2]](%6, %15) +// CHECK-NEXT: %17 = affine.apply [[MAP_D1_MINUS_2]](%6, %15) // CHECK-NEXT: store %10, %1[%16, %17] : memref<382x446xf32, 1> -// CHECK-NEXT: %18 = affine_apply [[MAP_D0_MINUS_2]](%14, %7) -// CHECK-NEXT: %19 = affine_apply [[MAP_D1_MINUS_2]](%14, %7) +// CHECK-NEXT: %18 = affine.apply [[MAP_D0_MINUS_2]](%14, %7) +// CHECK-NEXT: %19 = affine.apply [[MAP_D1_MINUS_2]](%14, %7) // CHECK-NEXT: store %13, %1[%18, %19] : memref<382x446xf32, 1> // CHECK-NEXT: } // CHECK-NEXT: } @@ -390,7 +390,7 @@ func @dma_loop_straightline_interspersed() { // CHECK-NEXT: dma_start %0[%c1_0], %4[%c0], %c254, %5[%c0] : memref<256xf32>, memref<254xf32, 1>, memref<1xi32> // CHECK-NEXT: dma_wait %5[%c0], %c254 : memref<1xi32> // CHECK-NEXT: for %i0 = 1 to 255 { -// CHECK-NEXT: %6 = affine_apply [[MAP_MINUS_ONE]](%i0) +// CHECK-NEXT: %6 = affine.apply [[MAP_MINUS_ONE]](%i0) // CHECK-NEXT: %7 = load %4[%6] : memref<254xf32, 1> // CHECK-NEXT: } // CHECK-NEXT: %8 = alloc() : memref<256xf32, 1> diff --git a/mlir/test/Transforms/loop-fusion.mlir b/mlir/test/Transforms/loop-fusion.mlir index 57c1ec4ceed..2071c6023e8 100644 --- a/mlir/test/Transforms/loop-fusion.mlir +++ b/mlir/test/Transforms/loop-fusion.mlir @@ -23,9 +23,9 @@ func @should_fuse_raw_dep_for_locality() { %v0 = load %m[%i1] : memref<10xf32> } // CHECK: for %i0 = 0 to 10 { - // CHECK-NEXT: %1 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %1 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %cst, %0[%1] : memref<1xf32> - // CHECK-NEXT: %2 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %2 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %3 = load %0[%2] : memref<1xf32> // CHECK-NEXT: } // CHECK-NEXT: return @@ -61,14 +61,14 @@ func @should_fuse_reduction_to_pointwise() { // is not used in the access function of the store/load on %b. // CHECK: for %i0 = 0 to 10 { // CHECK-NEXT: for %i1 = 0 to 10 { - // CHECK-NEXT: %3 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %3 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %4 = load %0[%3] : memref<1xf32> // CHECK-NEXT: %5 = load %1[%i0, %i1] : memref<10x10xf32> // CHECK-NEXT: %6 = addf %4, %5 : f32 - // CHECK-NEXT: %7 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %7 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %6, %0[%7] : memref<1xf32> // CHECK-NEXT: } - // CHECK-NEXT: %8 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %8 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %9 = load %0[%8] : memref<1xf32> // CHECK-NEXT: store %9, %2[%i0] : memref<10xf32> // CHECK-NEXT: } @@ -90,8 +90,8 @@ func @should_fuse_loop_nests_with_shifts() { for %i0 = 0 to 9 { for %i1 = 0 to 9 { - %idx = affine_apply (d0) -> (d0 + 1) (%i0) - %idy = affine_apply (d0) -> (d0 + 1) (%i1) + %idx = affine.apply (d0) -> (d0 + 1) (%i0) + %idy = affine.apply (d0) -> (d0 + 1) (%i1) store %cf7, %a[%idx, %idy] : memref<10x10xf32> } } @@ -111,15 +111,15 @@ func @should_fuse_loop_nests_with_shifts() { // NOTE: Should create a private memref with reduced shape 9x9xf32. // CHECK: for %i0 = 1 to 10 { // CHECK-NEXT: for %i1 = 1 to 10 { - // CHECK-NEXT: %1 = affine_apply [[MAP_SHIFT_MINUS_ONE_R1]](%i0) - // CHECK-NEXT: %2 = affine_apply [[MAP_SHIFT_MINUS_ONE_R1]](%i1) - // CHECK-NEXT: %3 = affine_apply [[MAP_SHIFT_BY_ONE]](%1) - // CHECK-NEXT: %4 = affine_apply [[MAP_SHIFT_BY_ONE]](%2) - // CHECK-NEXT: %5 = affine_apply [[MAP_SHIFT_MINUS_IV_R2_EVEN]](%i0, %i1, %3, %4) - // CHECK-NEXT: %6 = affine_apply [[MAP_SHIFT_MINUS_IV_R2_ODD]](%i0, %i1, %3, %4) + // CHECK-NEXT: %1 = affine.apply [[MAP_SHIFT_MINUS_ONE_R1]](%i0) + // CHECK-NEXT: %2 = affine.apply [[MAP_SHIFT_MINUS_ONE_R1]](%i1) + // CHECK-NEXT: %3 = affine.apply [[MAP_SHIFT_BY_ONE]](%1) + // CHECK-NEXT: %4 = affine.apply [[MAP_SHIFT_BY_ONE]](%2) + // CHECK-NEXT: %5 = affine.apply [[MAP_SHIFT_MINUS_IV_R2_EVEN]](%i0, %i1, %3, %4) + // CHECK-NEXT: %6 = affine.apply [[MAP_SHIFT_MINUS_IV_R2_ODD]](%i0, %i1, %3, %4) // CHECK-NEXT: store %cst, %0[%5, %6] : memref<1x1xf32> - // CHECK-NEXT: %7 = affine_apply [[MAP_SHIFT_MINUS_IV_R2_EVEN]](%i0, %i1, %i0, %i1) - // CHECK-NEXT: %8 = affine_apply [[MAP_SHIFT_MINUS_IV_R2_ODD]](%i0, %i1, %i0, %i1) + // CHECK-NEXT: %7 = affine.apply [[MAP_SHIFT_MINUS_IV_R2_EVEN]](%i0, %i1, %i0, %i1) + // CHECK-NEXT: %8 = affine.apply [[MAP_SHIFT_MINUS_IV_R2_ODD]](%i0, %i1, %i0, %i1) // CHECK-NEXT: %9 = load %0[%7, %8] : memref<1x1xf32> // CHECK-NEXT: } // CHECK-NEXT: } @@ -159,17 +159,17 @@ func @should_fuse_loop_nest() { // CHECK-DAG: [[NEWB:%[0-9]+]] = alloc() : memref<1x1xf32> // CHECK: for %i0 = 0 to 10 { // CHECK-NEXT: for %i1 = 0 to 10 { - // CHECK-NEXT: %2 = affine_apply [[MAP_D2_D0_DIFF]](%i1, %i0, %i1, %i0) - // CHECK-NEXT: %3 = affine_apply [[MAP_D3_D1_DIFF]](%i1, %i0, %i1, %i0) + // CHECK-NEXT: %2 = affine.apply [[MAP_D2_D0_DIFF]](%i1, %i0, %i1, %i0) + // CHECK-NEXT: %3 = affine.apply [[MAP_D3_D1_DIFF]](%i1, %i0, %i1, %i0) // CHECK-NEXT: store %cst, [[NEWA]][%2, %3] : memref<1x1xf32> - // CHECK-NEXT: %4 = affine_apply [[MAP_D2_D0_DIFF]](%i1, %i0, %i1, %i0) - // CHECK-NEXT: %5 = affine_apply [[MAP_D3_D1_DIFF]](%i1, %i0, %i1, %i0) + // CHECK-NEXT: %4 = affine.apply [[MAP_D2_D0_DIFF]](%i1, %i0, %i1, %i0) + // CHECK-NEXT: %5 = affine.apply [[MAP_D3_D1_DIFF]](%i1, %i0, %i1, %i0) // CHECK-NEXT: %6 = load [[NEWA]][%4, %5] : memref<1x1xf32> - // CHECK-NEXT: %7 = affine_apply [[MAP_D2_D0_DIFF]](%i0, %i1, %i0, %i1) - // CHECK-NEXT: %8 = affine_apply [[MAP_D3_D1_DIFF]](%i0, %i1, %i0, %i1) + // CHECK-NEXT: %7 = affine.apply [[MAP_D2_D0_DIFF]](%i0, %i1, %i0, %i1) + // CHECK-NEXT: %8 = affine.apply [[MAP_D3_D1_DIFF]](%i0, %i1, %i0, %i1) // CHECK-NEXT: store %6, [[NEWB]][%7, %8] : memref<1x1xf32> - // CHECK-NEXT: %9 = affine_apply [[MAP_D2_D0_DIFF]](%i0, %i1, %i0, %i1) - // CHECK-NEXT: %10 = affine_apply [[MAP_D3_D1_DIFF]](%i0, %i1, %i0, %i1) + // CHECK-NEXT: %9 = affine.apply [[MAP_D2_D0_DIFF]](%i0, %i1, %i0, %i1) + // CHECK-NEXT: %10 = affine.apply [[MAP_D3_D1_DIFF]](%i0, %i1, %i0, %i1) // CHECK-NEXT: %11 = load [[NEWB]][%9, %10] : memref<1x1xf32> // CHECK-NEXT: } // CHECK-NEXT: } @@ -207,9 +207,9 @@ func @should_fuse_across_intermediate_loop_with_no_deps() { // CHECK-NEXT: } // CHECK: for %i1 = 0 to 10 { // CHECK-NEXT: %3 = load %1[%i1] : memref<10xf32> - // CHECK-NEXT: %4 = affine_apply [[MAP0]](%i1, %i1) + // CHECK-NEXT: %4 = affine.apply [[MAP0]](%i1, %i1) // CHECK-NEXT: store %3, %0[%4] : memref<1xf32> - // CHECK-NEXT: %5 = affine_apply [[MAP0]](%i1, %i1) + // CHECK-NEXT: %5 = affine.apply [[MAP0]](%i1, %i1) // CHECK-NEXT: %6 = load %0[%5] : memref<1xf32> // CHECK-NEXT: } // CHECK-NEXT: return @@ -243,13 +243,13 @@ func @should_fuse_all_loops() { // CHECK-DAG: [[NEWA:%[0-9]+]] = alloc() : memref<1xf32> // CHECK-DAG: [[NEWB:%[0-9]+]] = alloc() : memref<1xf32> // CHECK: for %i0 = 0 to 10 { - // CHECK-NEXT: %2 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %2 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %cst, [[NEWA]][%2] : memref<1xf32> - // CHECK-NEXT: %3 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %3 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %cst, [[NEWB]][%3] : memref<1xf32> - // CHECK-NEXT: %4 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %4 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %5 = load [[NEWA]][%4] : memref<1xf32> - // CHECK-NEXT: %6 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %6 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %7 = load [[NEWB]][%6] : memref<1xf32> // CHECK-NEXT: } // CHECK-NEXT: return @@ -282,9 +282,9 @@ func @should_fuse_first_and_second_loops() { // Should fuse first loop into the second (last loop should not be fused). // Should create private memref '%2' for fused loop. // CHECK: for %i0 = 0 to 10 { - // CHECK-NEXT: %3 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %3 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %cst, %0[%3] : memref<1xf32> - // CHECK-NEXT: %4 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %4 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %5 = load %0[%4] : memref<1xf32> // CHECK-NEXT: store %cst, %1[%i0] : memref<10xf32> // CHECK-NEXT: } @@ -394,9 +394,9 @@ func @should_fuse_and_move_to_preserve_war_dep() { // the WAR dependence from load '%a' in '%i0' to the store '%a' in loop '%i1'. // CHECK: for %i0 = 0 to 10 { // CHECK-NEXT: %2 = load %1[%i0] : memref<10xf32> - // CHECK-NEXT: %3 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %3 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %2, %0[%3] : memref<1xf32> - // CHECK-NEXT: %4 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %4 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %5 = load %0[%4] : memref<1xf32> // CHECK-NEXT: } // CHECK-NEXT: for %i1 = 0 to 10 { @@ -429,9 +429,9 @@ func @should_fuse_with_private_memref_if_top_level_access() { // CHECK-NEXT: store %cst, %1[%i0] : memref<10xf32> // CHECK-NEXT: } // CHECK-NEXT: for %i1 = 0 to 10 { - // CHECK-NEXT: %2 = affine_apply [[MAP0]](%i1, %i1) + // CHECK-NEXT: %2 = affine.apply [[MAP0]](%i1, %i1) // CHECK-NEXT: store %cst, %0[%2] : memref<1xf32> - // CHECK-NEXT: %3 = affine_apply [[MAP0]](%i1, %i1) + // CHECK-NEXT: %3 = affine.apply [[MAP0]](%i1, %i1) // CHECK-NEXT: %4 = load %0[%3] : memref<1xf32> // CHECK-NEXT: } return @@ -453,9 +453,9 @@ func @should_fuse_no_top_level_access() { %v0 = load %m[%i1] : memref<10xf32> } // CHECK: for %i0 = 0 to 10 { - // CHECK-NEXT: %1 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %1 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %cst, %0[%1] : memref<1xf32> - // CHECK-NEXT: %2 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %2 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %3 = load %0[%2] : memref<1xf32> // CHECK-NEXT: } // CHECK-NEXT: return @@ -550,13 +550,13 @@ func @permute_and_fuse() { // CHECK: for %i0 = 0 to 30 { // CHECK-NEXT: for %i1 = 0 to 10 { // CHECK-NEXT: for %i2 = 0 to 20 { -// CHECK-NEXT: %1 = affine_apply [[MAP0]](%i1, %i2, %i0, %i1, %i2, %i0) -// CHECK-NEXT: %2 = affine_apply [[MAP1]](%i1, %i2, %i0, %i1, %i2, %i0) -// CHECK-NEXT: %3 = affine_apply [[MAP2]](%i1, %i2, %i0, %i1, %i2, %i0) +// CHECK-NEXT: %1 = affine.apply [[MAP0]](%i1, %i2, %i0, %i1, %i2, %i0) +// CHECK-NEXT: %2 = affine.apply [[MAP1]](%i1, %i2, %i0, %i1, %i2, %i0) +// CHECK-NEXT: %3 = affine.apply [[MAP2]](%i1, %i2, %i0, %i1, %i2, %i0) // CHECK-NEXT: store %cst, %0[%1, %2, %3] : memref<1x1x1xf32> -// CHECK-NEXT: %4 = affine_apply [[MAP0]](%i1, %i2, %i0, %i1, %i2, %i0) -// CHECK-NEXT: %5 = affine_apply [[MAP1]](%i1, %i2, %i0, %i1, %i2, %i0) -// CHECK-NEXT: %6 = affine_apply [[MAP2]](%i1, %i2, %i0, %i1, %i2, %i0) +// CHECK-NEXT: %4 = affine.apply [[MAP0]](%i1, %i2, %i0, %i1, %i2, %i0) +// CHECK-NEXT: %5 = affine.apply [[MAP1]](%i1, %i2, %i0, %i1, %i2, %i0) +// CHECK-NEXT: %6 = affine.apply [[MAP2]](%i1, %i2, %i0, %i1, %i2, %i0) // CHECK-NEXT: %7 = load %0[%4, %5, %6] : memref<1x1x1xf32> // CHECK-NEXT: "foo"(%7) : (f32) -> () // CHECK-NEXT: } @@ -580,8 +580,8 @@ func @fuse_reshape_64_16_4(%in : memref<64xf32>) { for %i0 = 0 to 64 { %v = load %in[%i0] : memref<64xf32> - %idx = affine_apply (d0) -> (d0 floordiv 4) (%i0) - %idy = affine_apply (d0) -> (d0 mod 4) (%i0) + %idx = affine.apply (d0) -> (d0 floordiv 4) (%i0) + %idy = affine.apply (d0) -> (d0 mod 4) (%i0) store %v, %out[%idx, %idy] : memref<16x4xf32> } @@ -615,7 +615,7 @@ func @fuse_reshape_16_4_64() { for %i0 = 0 to 16 { for %i1 = 0 to 4 { %v = load %in[%i0, %i1] : memref<16x4xf32> - %idx = affine_apply (d0, d1) -> (4*d0 + d1) (%i0, %i1) + %idx = affine.apply (d0, d1) -> (4*d0 + d1) (%i0, %i1) store %v, %out[%idx] : memref<64xf32> } } @@ -625,13 +625,13 @@ func @fuse_reshape_16_4_64() { "foo"(%w) : (f32) -> () } // CHECK: for %i0 = 0 to 64 { -// CHECK-NEXT: %2 = affine_apply [[MAP0]](%i0) -// CHECK-NEXT: %3 = affine_apply [[MAP1]](%i0) +// CHECK-NEXT: %2 = affine.apply [[MAP0]](%i0) +// CHECK-NEXT: %3 = affine.apply [[MAP1]](%i0) // CHECK-NEXT: %4 = load %1[%2, %3] : memref<16x4xf32> -// CHECK-NEXT: %5 = affine_apply [[MAP2]](%2, %3) -// CHECK-NEXT: %6 = affine_apply [[MAP3]](%i0, %5) +// CHECK-NEXT: %5 = affine.apply [[MAP2]](%2, %3) +// CHECK-NEXT: %6 = affine.apply [[MAP3]](%i0, %5) // CHECK-NEXT: store %4, %0[%6] : memref<1xf32> -// CHECK-NEXT: %7 = affine_apply [[MAP3]](%i0, %i0) +// CHECK-NEXT: %7 = affine.apply [[MAP3]](%i0, %i0) // CHECK-NEXT: %8 = load %0[%7] : memref<1xf32> // CHECK-NEXT: "foo"(%8) : (f32) -> () // CHECK-NEXT: } @@ -668,13 +668,13 @@ func @R6_to_R2_reshape_square() -> memref<64x9xi32> { for %ii = 0 to 64 { for %jj = 0 to 9 { // Convert output coordinates to linear index. - %a0 = affine_apply (d0, d1) -> (d0 * 9 + d1) (%ii, %jj) - %0 = affine_apply (d0) -> (d0 floordiv (2 * 3 * 3 * 16 * 1))(%a0) - %1 = affine_apply (d0) -> ((d0 mod 288) floordiv (3 * 3 * 16 * 1))(%a0) - %2 = affine_apply (d0) -> (((d0 mod 288) mod 144) floordiv (3 * 16 * 1))(%a0) - %3 = affine_apply (d0) -> ((((d0 mod 288) mod 144) mod 48) floordiv (16 * 1))(%a0) - %4 = affine_apply (d0) -> ((((d0 mod 288) mod 144) mod 48) mod 16)(%a0) - %5 = affine_apply (d0) -> (((((d0 mod 144) mod 144) mod 48) mod 16) mod 1)(%a0) + %a0 = affine.apply (d0, d1) -> (d0 * 9 + d1) (%ii, %jj) + %0 = affine.apply (d0) -> (d0 floordiv (2 * 3 * 3 * 16 * 1))(%a0) + %1 = affine.apply (d0) -> ((d0 mod 288) floordiv (3 * 3 * 16 * 1))(%a0) + %2 = affine.apply (d0) -> (((d0 mod 288) mod 144) floordiv (3 * 16 * 1))(%a0) + %3 = affine.apply (d0) -> ((((d0 mod 288) mod 144) mod 48) floordiv (16 * 1))(%a0) + %4 = affine.apply (d0) -> ((((d0 mod 288) mod 144) mod 48) mod 16)(%a0) + %5 = affine.apply (d0) -> (((((d0 mod 144) mod 144) mod 48) mod 16) mod 1)(%a0) %v = load %in[%0, %1, %2, %3, %4, %5] : memref<2x2x3x3x16x1xi32> store %v, %out[%ii, %jj] : memref<64x9xi32> } @@ -719,38 +719,38 @@ func @R6_to_R2_reshape_square() -> memref<64x9xi32> { // CHECK: %2 = alloc() : memref<64x9xi32> // CHECK-NEXT: for %i0 = 0 to 64 { // CHECK-NEXT: for %i1 = 0 to 9 { -// CHECK-NEXT: %3 = affine_apply [[MAP0]](%i0, %i1) -// CHECK-NEXT: %4 = affine_apply [[MAP1]](%i0, %i1) -// CHECK-NEXT: %5 = affine_apply [[MAP2]](%i0, %i1) -// CHECK-NEXT: %6 = affine_apply [[MAP3]](%i0, %i1) -// CHECK-NEXT: %7 = affine_apply [[MAP4]](%i0, %i1) +// CHECK-NEXT: %3 = affine.apply [[MAP0]](%i0, %i1) +// CHECK-NEXT: %4 = affine.apply [[MAP1]](%i0, %i1) +// CHECK-NEXT: %5 = affine.apply [[MAP2]](%i0, %i1) +// CHECK-NEXT: %6 = affine.apply [[MAP3]](%i0, %i1) +// CHECK-NEXT: %7 = affine.apply [[MAP4]](%i0, %i1) // CHECK-NEXT: %8 = "foo"(%3, %4, %5, %6, %7, %c0) : (index, index, index, index, index, index) -> i32 -// CHECK-NEXT: %9 = affine_apply [[MAP5]](%i0, %i1, %3, %4, %5, %6, %7, %c0) -// CHECK-NEXT: %10 = affine_apply [[MAP6]](%i0, %i1, %3, %4, %5, %6, %7, %c0) -// CHECK-NEXT: %11 = affine_apply [[MAP7]](%i0, %i1, %3, %4, %5, %6, %7, %c0) -// CHECK-NEXT: %12 = affine_apply [[MAP8]](%i0, %i1, %3, %4, %5, %6, %7, %c0) -// CHECK-NEXT: %13 = affine_apply [[MAP9]](%i0, %i1, %3, %4, %5, %6, %7, %c0) -// CHECK-NEXT: %14 = affine_apply [[MAP10]](%i0, %i1, %3, %4, %5, %6, %7, %c0) +// CHECK-NEXT: %9 = affine.apply [[MAP5]](%i0, %i1, %3, %4, %5, %6, %7, %c0) +// CHECK-NEXT: %10 = affine.apply [[MAP6]](%i0, %i1, %3, %4, %5, %6, %7, %c0) +// CHECK-NEXT: %11 = affine.apply [[MAP7]](%i0, %i1, %3, %4, %5, %6, %7, %c0) +// CHECK-NEXT: %12 = affine.apply [[MAP8]](%i0, %i1, %3, %4, %5, %6, %7, %c0) +// CHECK-NEXT: %13 = affine.apply [[MAP9]](%i0, %i1, %3, %4, %5, %6, %7, %c0) +// CHECK-NEXT: %14 = affine.apply [[MAP10]](%i0, %i1, %3, %4, %5, %6, %7, %c0) // CHECK-NEXT: store %8, %0[%9, %10, %11, %12, %13, %14] : memref<1x2x3x3x16x1xi32> -// CHECK-NEXT: %15 = affine_apply [[MAP11]](%i0, %i1) -// CHECK-NEXT: %16 = affine_apply [[MAP12]](%15) -// CHECK-NEXT: %17 = affine_apply [[MAP13]](%15) -// CHECK-NEXT: %18 = affine_apply [[MAP14]](%15) -// CHECK-NEXT: %19 = affine_apply [[MAP15]](%15) -// CHECK-NEXT: %20 = affine_apply [[MAP16]](%15) -// CHECK-NEXT: %21 = affine_apply [[MAP17]](%15) -// CHECK-NEXT: %22 = affine_apply [[MAP5]](%i0, %i1, %16, %17, %18, %19, %20, %21) -// CHECK-NEXT: %23 = affine_apply [[MAP6]](%i0, %i1, %16, %17, %18, %19, %20, %21) -// CHECK-NEXT: %24 = affine_apply [[MAP7]](%i0, %i1, %16, %17, %18, %19, %20, %21) -// CHECK-NEXT: %25 = affine_apply [[MAP8]](%i0, %i1, %16, %17, %18, %19, %20, %21) -// CHECK-NEXT: %26 = affine_apply [[MAP9]](%i0, %i1, %16, %17, %18, %19, %20, %21) -// CHECK-NEXT: %27 = affine_apply [[MAP10]](%i0, %i1, %16, %17, %18, %19, %20, %21) +// CHECK-NEXT: %15 = affine.apply [[MAP11]](%i0, %i1) +// CHECK-NEXT: %16 = affine.apply [[MAP12]](%15) +// CHECK-NEXT: %17 = affine.apply [[MAP13]](%15) +// CHECK-NEXT: %18 = affine.apply [[MAP14]](%15) +// CHECK-NEXT: %19 = affine.apply [[MAP15]](%15) +// CHECK-NEXT: %20 = affine.apply [[MAP16]](%15) +// CHECK-NEXT: %21 = affine.apply [[MAP17]](%15) +// CHECK-NEXT: %22 = affine.apply [[MAP5]](%i0, %i1, %16, %17, %18, %19, %20, %21) +// CHECK-NEXT: %23 = affine.apply [[MAP6]](%i0, %i1, %16, %17, %18, %19, %20, %21) +// CHECK-NEXT: %24 = affine.apply [[MAP7]](%i0, %i1, %16, %17, %18, %19, %20, %21) +// CHECK-NEXT: %25 = affine.apply [[MAP8]](%i0, %i1, %16, %17, %18, %19, %20, %21) +// CHECK-NEXT: %26 = affine.apply [[MAP9]](%i0, %i1, %16, %17, %18, %19, %20, %21) +// CHECK-NEXT: %27 = affine.apply [[MAP10]](%i0, %i1, %16, %17, %18, %19, %20, %21) // CHECK-NEXT: %28 = load %0[%22, %23, %24, %25, %26, %27] : memref<1x2x3x3x16x1xi32> -// CHECK-NEXT: %29 = affine_apply [[MAP18]](%i0, %i1, %i0, %i1) -// CHECK-NEXT: %30 = affine_apply [[MAP19]](%i0, %i1, %i0, %i1) +// CHECK-NEXT: %29 = affine.apply [[MAP18]](%i0, %i1, %i0, %i1) +// CHECK-NEXT: %30 = affine.apply [[MAP19]](%i0, %i1, %i0, %i1) // CHECK-NEXT: store %28, %1[%29, %30] : memref<1x1xi32> -// CHECK-NEXT: %31 = affine_apply [[MAP18]](%i0, %i1, %i0, %i1) -// CHECK-NEXT: %32 = affine_apply [[MAP19]](%i0, %i1, %i0, %i1) +// CHECK-NEXT: %31 = affine.apply [[MAP18]](%i0, %i1, %i0, %i1) +// CHECK-NEXT: %32 = affine.apply [[MAP19]](%i0, %i1, %i0, %i1) // CHECK-NEXT: %33 = load %1[%31, %32] : memref<1x1xi32> // CHECK-NEXT: %34 = muli %33, %33 : i32 // CHECK-NEXT: store %34, %2[%i0, %i1] : memref<64x9xi32> @@ -762,7 +762,7 @@ func @R6_to_R2_reshape_square() -> memref<64x9xi32> { // CHECK-LABEL: func @fuse_symbolic_bounds func @fuse_symbolic_bounds(%M : index, %N : index) { - %N_plus_5 = affine_apply (d0) -> (d0 + 5)(%N) + %N_plus_5 = affine.apply (d0) -> (d0 + 5)(%N) %m = alloc(%M, %N_plus_5) : memref<? x ? x f32> %c0 = constant 0.0 : f32 @@ -776,7 +776,7 @@ func @fuse_symbolic_bounds(%M : index, %N : index) { for %i2 = 0 to %M { for %i3 = 0 to %N { - %idy = affine_apply (d0)[s0] -> (d0 + s0) (%i3)[%s] + %idy = affine.apply (d0)[s0] -> (d0 + s0) (%i3)[%s] %v = load %m[%i2, %idy] : memref<? x ? x f32> } } @@ -814,19 +814,19 @@ func @should_fuse_reduction_at_depth1() { // memory space. // CHECK: for %i0 = 0 to 10 { // CHECK-NEXT: for %i1 = 0 to 100 { - // CHECK-NEXT: %2 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %2 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %3 = load %0[%2] : memref<1xf32> // CHECK-NEXT: %4 = load %1[%i0, %i1] : memref<10x100xf32> // CHECK-NEXT: %5 = "maxf"(%3, %4) : (f32, f32) -> f32 - // CHECK-NEXT: %6 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %6 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %5, %0[%6] : memref<1xf32> // CHECK-NEXT: } // CHECK-NEXT: for %i2 = 0 to 100 { - // CHECK-NEXT: %7 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %7 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %8 = load %0[%7] : memref<1xf32> // CHECK-NEXT: %9 = load %1[%i0, %i2] : memref<10x100xf32> // CHECK-NEXT: %10 = subf %9, %8 : f32 - // CHECK-NEXT: %11 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %11 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %10, %0[%11] : memref<1xf32> // CHECK-NEXT: } // CHECK-NEXT: } @@ -872,13 +872,13 @@ func @should_fuse_at_src_depth1_and_dst_depth1() { // CHECK-NEXT: } // CHECK-NEXT: for %i2 = 0 to 16 { // CHECK-NEXT: %3 = "op1"() : () -> f32 - // CHECK-NEXT: %4 = affine_apply [[MAP0]](%i0, %i0, %i2) - // CHECK-NEXT: %5 = affine_apply [[MAP1]](%i0, %i0, %i2) + // CHECK-NEXT: %4 = affine.apply [[MAP0]](%i0, %i0, %i2) + // CHECK-NEXT: %5 = affine.apply [[MAP1]](%i0, %i0, %i2) // CHECK-NEXT: store %3, %0[%4, %5] : memref<1x16xf32> // CHECK-NEXT: } // CHECK-NEXT: for %i3 = 0 to 16 { - // CHECK-NEXT: %6 = affine_apply [[MAP0]](%i0, %i0, %i3) - // CHECK-NEXT: %7 = affine_apply [[MAP1]](%i0, %i0, %i3) + // CHECK-NEXT: %6 = affine.apply [[MAP0]](%i0, %i0, %i3) + // CHECK-NEXT: %7 = affine.apply [[MAP1]](%i0, %i0, %i3) // CHECK-NEXT: %8 = load %0[%6, %7] : memref<1x16xf32> // CHECK-NEXT: "op2"(%8) : (f32) -> () // CHECK-NEXT: } @@ -902,7 +902,7 @@ func @should_fuse_src_depth1_at_dst_depth2() { for %i1 = 0 to 10 { for %i2 = 0 to 10 { - %a0 = affine_apply (d0, d1) -> (d0 * 10 + d1) (%i1, %i2) + %a0 = affine.apply (d0, d1) -> (d0 * 10 + d1) (%i1, %i2) %v0 = load %a[%a0] : memref<100xf32> } } @@ -910,11 +910,11 @@ func @should_fuse_src_depth1_at_dst_depth2() { // loop IVs, so we should slice at depth 1 and insert the slice at depth 2. // CHECK: for %i0 = 0 to 10 { // CHECK-NEXT: for %i1 = 0 to 10 { - // CHECK-NEXT: %1 = affine_apply [[MAP0]](%i0, %i1) - // CHECK-NEXT: %2 = affine_apply [[MAP1]](%i0, %i1, %1) + // CHECK-NEXT: %1 = affine.apply [[MAP0]](%i0, %i1) + // CHECK-NEXT: %2 = affine.apply [[MAP1]](%i0, %i1, %1) // CHECK-NEXT: store %cst, %0[%2] : memref<1xf32> - // CHECK-NEXT: %3 = affine_apply [[MAP0]](%i0, %i1) - // CHECK-NEXT: %4 = affine_apply [[MAP1]](%i0, %i1, %3) + // CHECK-NEXT: %3 = affine.apply [[MAP0]](%i0, %i1) + // CHECK-NEXT: %4 = affine.apply [[MAP1]](%i0, %i1, %3) // CHECK-NEXT: %5 = load %0[%4] : memref<1xf32> // CHECK-NEXT: } // CHECK-NEXT: } @@ -940,7 +940,7 @@ func @fusion_at_depth0_not_currently_supported() { // nest, and make the store in the slice store to the same element. // CHECK-DAG: %0 = alloc() : memref<1xf32> // CHECK: for %i0 = 0 to 10 { - // CHECK-NEXT: %1 = affine_apply [[MAP0]]()[%c0] + // CHECK-NEXT: %1 = affine.apply [[MAP0]]()[%c0] // CHECK-NEXT: store %cst, %0[%1] : memref<1xf32> // CHECK-NEXT: %2 = load %0[%c0] : memref<1xf32> // CHECK-NEXT: } @@ -1032,12 +1032,12 @@ func @should_fuse_deep_loop_nests() { // CHECK-NEXT: } // CHECK-NEXT: for %i8 = 0 to 16 { // CHECK-NEXT: for %i9 = 0 to 10 { -// CHECK-NEXT: %4 = affine_apply [[MAP0]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) -// CHECK-NEXT: %5 = affine_apply [[MAP1]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) -// CHECK-NEXT: %6 = affine_apply [[MAP2]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) -// CHECK-NEXT: %7 = affine_apply [[MAP3]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) -// CHECK-NEXT: %8 = affine_apply [[MAP4]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) -// CHECK-NEXT: %9 = affine_apply [[MAP5]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) +// CHECK-NEXT: %4 = affine.apply [[MAP0]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) +// CHECK-NEXT: %5 = affine.apply [[MAP1]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) +// CHECK-NEXT: %6 = affine.apply [[MAP2]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) +// CHECK-NEXT: %7 = affine.apply [[MAP3]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) +// CHECK-NEXT: %8 = affine.apply [[MAP4]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) +// CHECK-NEXT: %9 = affine.apply [[MAP5]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i8, %i9) // CHECK-NEXT: store %cst, %0[%4, %5, %6, %7, %8, %9] : memref<1x1x1x1x16x10xf32, 2> // CHECK-NEXT: } // CHECK-NEXT: } @@ -1050,12 +1050,12 @@ func @should_fuse_deep_loop_nests() { // CHECK-NEXT: } // CHECK-NEXT: for %i14 = 0 to 16 { // CHECK-NEXT: for %i15 = 0 to 10 { -// CHECK-NEXT: %11 = affine_apply [[MAP0]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) -// CHECK-NEXT: %12 = affine_apply [[MAP1]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) -// CHECK-NEXT: %13 = affine_apply [[MAP2]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) -// CHECK-NEXT: %14 = affine_apply [[MAP3]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) -// CHECK-NEXT: %15 = affine_apply [[MAP4]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) -// CHECK-NEXT: %16 = affine_apply [[MAP5]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) +// CHECK-NEXT: %11 = affine.apply [[MAP0]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) +// CHECK-NEXT: %12 = affine.apply [[MAP1]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) +// CHECK-NEXT: %13 = affine.apply [[MAP2]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) +// CHECK-NEXT: %14 = affine.apply [[MAP3]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) +// CHECK-NEXT: %15 = affine.apply [[MAP4]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) +// CHECK-NEXT: %16 = affine.apply [[MAP5]](%i2, %i3, %i0, %i1, %i2, %i3, %i0, %i1, %i14, %i15) // CHECK-NEXT: %17 = load %0[%11, %12, %13, %14, %15, %16] : memref<1x1x1x1x16x10xf32, 2> // CHECK-NEXT: } // CHECK-NEXT: } @@ -1112,13 +1112,13 @@ func @should_fuse_at_depth1_and_reduce_slice_trip_count() { // CHECK-NEXT: %2 = load %1[%i0, %i1] : memref<4x256xf32> // CHECK-NEXT: } // CHECK-NEXT: for %i2 = 0 to 16 { - // CHECK-NEXT: %3 = affine_apply [[MAP0]](%i0, %i0, %i2) - // CHECK-NEXT: %4 = affine_apply [[MAP1]](%i0, %i0, %i2) + // CHECK-NEXT: %3 = affine.apply [[MAP0]](%i0, %i0, %i2) + // CHECK-NEXT: %4 = affine.apply [[MAP1]](%i0, %i0, %i2) // CHECK-NEXT: store %cst, %0[%3, %4] : memref<1x16xf32> // CHECK-NEXT: } // CHECK-NEXT: for %i3 = 0 to 16 { - // CHECK-NEXT: %5 = affine_apply [[MAP0]](%i0, %i0, %i3) - // CHECK-NEXT: %6 = affine_apply [[MAP1]](%i0, %i0, %i3) + // CHECK-NEXT: %5 = affine.apply [[MAP0]](%i0, %i0, %i3) + // CHECK-NEXT: %6 = affine.apply [[MAP1]](%i0, %i0, %i3) // CHECK-NEXT: %7 = load %0[%5, %6] : memref<1x16xf32> // CHECK-NEXT: } // CHECK-NEXT: } @@ -1231,15 +1231,15 @@ func @should_fuse_with_private_memrefs_with_diff_shapes() { // CHECK-DAG: %0 = alloc() : memref<1xf32> // CHECK-DAG: %1 = alloc() : memref<1xf32> // CHECK: for %i0 = 0 to 82 { - // CHECK-NEXT: %2 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %2 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %cst, %1[%2] : memref<1xf32> - // CHECK-NEXT: %3 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %3 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %4 = load %1[%3] : memref<1xf32> // CHECK-NEXT: } // CHECK-NEXT: for %i1 = 0 to 17 { - // CHECK-NEXT: %5 = affine_apply [[MAP0]](%i1, %i1) + // CHECK-NEXT: %5 = affine.apply [[MAP0]](%i1, %i1) // CHECK-NEXT: store %cst, %0[%5] : memref<1xf32> - // CHECK-NEXT: %6 = affine_apply [[MAP0]](%i1, %i1) + // CHECK-NEXT: %6 = affine.apply [[MAP0]](%i1, %i1) // CHECK-NEXT: %7 = load %0[%6] : memref<1xf32> // CHECK-NEXT: } // CHECK-NEXT: return @@ -1314,8 +1314,8 @@ func @R3_to_R2_reshape() { for %ii = 0 to 32 { for %jj = 0 to 3 { - %a0 = affine_apply (d0, d1) -> (d0 * 3 + d1) (%ii, %jj) - %idx = affine_apply (d0) -> (d0 floordiv (3 * 16)) (%a0) + %a0 = affine.apply (d0, d1) -> (d0 * 3 + d1) (%ii, %jj) + %idx = affine.apply (d0) -> (d0 floordiv (3 * 16)) (%a0) %v = load %in[%idx, %jj, %c0] : memref<2x3x16xi32> } @@ -1334,18 +1334,18 @@ func @R3_to_R2_reshape() { // CHECK-DAG: %0 = alloc() : memref<1x1x1xi32> // CHECK: for %i0 = 0 to 32 { // CHECK-NEXT: for %i1 = 0 to 3 { -// CHECK-NEXT: %1 = affine_apply [[MAP0]](%i0, %i1) -// CHECK-NEXT: %2 = affine_apply [[MAP1]]()[%c0] +// CHECK-NEXT: %1 = affine.apply [[MAP0]](%i0, %i1) +// CHECK-NEXT: %2 = affine.apply [[MAP1]]()[%c0] // CHECK-NEXT: %3 = "foo"(%1, %i1, %2) : (index, index, index) -> i32 -// CHECK-NEXT: %4 = affine_apply [[MAP2]](%i0, %i1, %1, %i1, %2) -// CHECK-NEXT: %5 = affine_apply [[MAP3]](%i0, %i1, %1, %i1, %2) -// CHECK-NEXT: %6 = affine_apply [[MAP4]](%i0, %i1, %1, %i1, %2) +// CHECK-NEXT: %4 = affine.apply [[MAP2]](%i0, %i1, %1, %i1, %2) +// CHECK-NEXT: %5 = affine.apply [[MAP3]](%i0, %i1, %1, %i1, %2) +// CHECK-NEXT: %6 = affine.apply [[MAP4]](%i0, %i1, %1, %i1, %2) // CHECK-NEXT: store %3, %0[%4, %5, %6] : memref<1x1x1xi32> -// CHECK-NEXT: %7 = affine_apply [[MAP5]](%i0, %i1) -// CHECK-NEXT: %8 = affine_apply [[MAP6]](%7) -// CHECK-NEXT: %9 = affine_apply [[MAP2]](%i0, %i1, %8, %i1, %c0) -// CHECK-NEXT: %10 = affine_apply [[MAP3]](%i0, %i1, %8, %i1, %c0) -// CHECK-NEXT: %11 = affine_apply [[MAP4]](%i0, %i1, %8, %i1, %c0) +// CHECK-NEXT: %7 = affine.apply [[MAP5]](%i0, %i1) +// CHECK-NEXT: %8 = affine.apply [[MAP6]](%7) +// CHECK-NEXT: %9 = affine.apply [[MAP2]](%i0, %i1, %8, %i1, %c0) +// CHECK-NEXT: %10 = affine.apply [[MAP3]](%i0, %i1, %8, %i1, %c0) +// CHECK-NEXT: %11 = affine.apply [[MAP4]](%i0, %i1, %8, %i1, %c0) // CHECK-NEXT: %12 = load %0[%9, %10, %11] : memref<1x1x1xi32> // CHECK-NEXT: } // CHECK-NEXT: } @@ -1466,9 +1466,9 @@ func @should_fuse_and_move_to_preserve_war_dep() { // CHECK-NEXT: } // CHECK-NEXT: for %i1 = 0 to 10 { // CHECK-NEXT: %4 = load %1[%i1] : memref<10xf32> - // CHECK-NEXT: %5 = affine_apply [[MAP0]](%i1, %i1) + // CHECK-NEXT: %5 = affine.apply [[MAP0]](%i1, %i1) // CHECK-NEXT: store %4, %0[%5] : memref<1xf32> - // CHECK-NEXT: %6 = affine_apply [[MAP0]](%i1, %i1) + // CHECK-NEXT: %6 = affine.apply [[MAP0]](%i1, %i1) // CHECK-NEXT: %7 = load %0[%6] : memref<1xf32> // CHECK-NEXT: store %cst, %2[%i1] : memref<10xf32> // CHECK-NEXT: } @@ -1551,9 +1551,9 @@ func @should_fuse_and_preserve_dep_on_constant() { // CHECK: %cst_0 = constant 1.100000e+01 : f32 // CHECK-NEXT: for %i0 = 0 to 10 { // CHECK-NEXT: %3 = load %1[%i0] : memref<10xf32> - // CHECK-NEXT: %4 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %4 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %cst, %0[%4] : memref<1xf32> - // CHECK-NEXT: %5 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %5 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %6 = load %0[%5] : memref<1xf32> // CHECK-NEXT: store %cst_0, %2[%i0] : memref<10xf32> // CHECK-NEXT: } @@ -1583,19 +1583,19 @@ func @should_fuse_at_depth_above_loop_carried_dependence(%arg0: memref<64x4xf32> for %i2 = 0 to 4 { for %i3 = 0 to 4 { for %i4 = 0 to 16 { - %1 = affine_apply (d0, d1) -> (d0 * 16 - d1 + 15)(%i3, %i4) + %1 = affine.apply (d0, d1) -> (d0 * 16 - d1 + 15)(%i3, %i4) %2 = load %arg1[%1, %i2] : memref<64x4xf32> "op0"(%2) : (f32) -> () } for %i5 = 0 to 4 { for %i6 = 0 to 16 { - %3 = affine_apply (d0, d1) -> (d0 * 16 - d1 + 15)(%i5, %i6) + %3 = affine.apply (d0, d1) -> (d0 * 16 - d1 + 15)(%i5, %i6) %4 = load %arg0[%3, %i3] : memref<64x4xf32> "op1"(%4) : (f32) -> () } for %i7 = 0 to 16 { %5 = "op2"() : () -> (f32) - %6 = affine_apply (d0, d1) -> (d0 * 16 + d1)(%i5, %i7) + %6 = affine.apply (d0, d1) -> (d0 * 16 + d1)(%i5, %i7) %7 = load %out[%6, %i2] : memref<64x4xf32> %8 = addf %7, %5 : f32 store %8, %out[%6, %i2] : memref<64x4xf32> @@ -1615,31 +1615,31 @@ func @should_fuse_at_depth_above_loop_carried_dependence(%arg0: memref<64x4xf32> // CHECK: %0 = alloc() : memref<64x1xf32> // CHECK: for %i0 = 0 to 4 { // CHECK-NEXT: for %i1 = 0 to 64 { - // CHECK-NEXT: %1 = affine_apply [[MAP0]](%i0, %i1, %i0) - // CHECK-NEXT: %2 = affine_apply [[MAP1]](%i0, %i1, %i0) + // CHECK-NEXT: %1 = affine.apply [[MAP0]](%i0, %i1, %i0) + // CHECK-NEXT: %2 = affine.apply [[MAP1]](%i0, %i1, %i0) // CHECK-NEXT: store %cst, %0[%1, %2] : memref<64x1xf32> // CHECK-NEXT: } // CHECK-NEXT: for %i2 = 0 to 4 { // CHECK-NEXT: for %i3 = 0 to 16 { - // CHECK-NEXT: %3 = affine_apply [[MAP2]](%i2, %i3) + // CHECK-NEXT: %3 = affine.apply [[MAP2]](%i2, %i3) // CHECK-NEXT: %4 = load %arg1[%3, %i0] : memref<64x4xf32> // CHECK-NEXT: "op0"(%4) : (f32) -> () // CHECK-NEXT: } // CHECK-NEXT: for %i4 = 0 to 4 { // CHECK-NEXT: for %i5 = 0 to 16 { - // CHECK-NEXT: %5 = affine_apply [[MAP2]](%i4, %i5) + // CHECK-NEXT: %5 = affine.apply [[MAP2]](%i4, %i5) // CHECK-NEXT: %6 = load %arg0[%5, %i2] : memref<64x4xf32> // CHECK-NEXT: "op1"(%6) : (f32) -> () // CHECK-NEXT: } // CHECK-NEXT: for %i6 = 0 to 16 { // CHECK-NEXT: %7 = "op2"() : () -> f32 - // CHECK-NEXT: %8 = affine_apply [[MAP3]](%i4, %i6) - // CHECK-NEXT: %9 = affine_apply [[MAP0]](%i0, %8, %i0) - // CHECK-NEXT: %10 = affine_apply [[MAP1]](%i0, %8, %i0) + // CHECK-NEXT: %8 = affine.apply [[MAP3]](%i4, %i6) + // CHECK-NEXT: %9 = affine.apply [[MAP0]](%i0, %8, %i0) + // CHECK-NEXT: %10 = affine.apply [[MAP1]](%i0, %8, %i0) // CHECK-NEXT: %11 = load %0[%9, %10] : memref<64x1xf32> // CHECK-NEXT: %12 = addf %11, %7 : f32 - // CHECK-NEXT: %13 = affine_apply [[MAP0]](%i0, %8, %i0) - // CHECK-NEXT: %14 = affine_apply [[MAP1]](%i0, %8, %i0) + // CHECK-NEXT: %13 = affine.apply [[MAP0]](%i0, %8, %i0) + // CHECK-NEXT: %14 = affine.apply [[MAP1]](%i0, %8, %i0) // CHECK-NEXT: store %12, %0[%13, %14] : memref<64x1xf32> // CHECK-NEXT: } // CHECK-NEXT: } @@ -1679,16 +1679,16 @@ func @should_fuse_after_private_memref_creation() { // longer exists, so '%i0' can now be fused into '%i2'. // CHECK: for %i0 = 0 to 10 { - // CHECK-NEXT: %3 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %3 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: store %cst, %1[%3] : memref<1xf32> - // CHECK-NEXT: %4 = affine_apply [[MAP0]](%i0, %i0) + // CHECK-NEXT: %4 = affine.apply [[MAP0]](%i0, %i0) // CHECK-NEXT: %5 = load %1[%4] : memref<1xf32> // CHECK-NEXT: store %5, %2[%i0] : memref<10xf32> // CHECK-NEXT: } // CHECK-NEXT: for %i1 = 0 to 10 { - // CHECK-NEXT: %6 = affine_apply [[MAP0]](%i1, %i1) + // CHECK-NEXT: %6 = affine.apply [[MAP0]](%i1, %i1) // CHECK-NEXT: store %cst, %0[%6] : memref<1xf32> - // CHECK-NEXT: %7 = affine_apply [[MAP0]](%i1, %i1) + // CHECK-NEXT: %7 = affine.apply [[MAP0]](%i1, %i1) // CHECK-NEXT: %8 = load %0[%7] : memref<1xf32> // CHECK-NEXT: store %8, %2[%i1] : memref<10xf32> // CHECK-NEXT: } diff --git a/mlir/test/Transforms/loop-tiling.mlir b/mlir/test/Transforms/loop-tiling.mlir index 16736b321c6..c2fdbd4f80f 100644 --- a/mlir/test/Transforms/loop-tiling.mlir +++ b/mlir/test/Transforms/loop-tiling.mlir @@ -59,12 +59,12 @@ func @loop_tiling() { func @loop_max_min_bound(%A : memref<? x i32>, %L : index, %U : index) { %M = dim %A, 0 : memref<? x i32> for %iTT = max #lb()[%L] to min #ub()[%M, %U] { - %out = affine_apply (d0) -> (d0) (%iTT) + %out = affine.apply (d0) -> (d0) (%iTT) } return // CHECK: for %i0 = max [[LB]]()[%arg1] to min [[UB]]()[%0, %arg2] step 32 { // CHECK-NEXT: for %i1 = [[IDENTITY]](%i0) to min [[UB_INTRA_TILE]](%0, %arg2, %i0) { -// CHECK-NEXT: %1 = affine_apply [[IDENTITY]](%i1) +// CHECK-NEXT: %1 = affine.apply [[IDENTITY]](%i1) // CHECK-NEXT: } // CHECK-NEXT: } } diff --git a/mlir/test/Transforms/lower-affine.mlir b/mlir/test/Transforms/lower-affine.mlir index 2b53e9c6ccf..7804c9ca752 100644 --- a/mlir/test/Transforms/lower-affine.mlir +++ b/mlir/test/Transforms/lower-affine.mlir @@ -506,20 +506,20 @@ func @min_reduction_tree(%v : index) { func @affine_applies() { ^bb0: // CHECK: %c0 = constant 0 : index - %zero = affine_apply #map0() + %zero = affine.apply #map0() // Identity maps are just discarded. // CHECK-NEXT: %c101 = constant 101 : index %101 = constant 101 : index - %symbZero = affine_apply #map1()[%zero] + %symbZero = affine.apply #map1()[%zero] // CHECK-NEXT: %c102 = constant 102 : index %102 = constant 102 : index - %copy = affine_apply #map2(%zero) + %copy = affine.apply #map2(%zero) // CHECK-NEXT: %0 = addi %c0, %c0 : index // CHECK-NEXT: %c1 = constant 1 : index // CHECK-NEXT: %1 = addi %0, %c1 : index - %one = affine_apply #map3(%symbZero)[%zero] + %one = affine.apply #map3(%symbZero)[%zero] // CHECK-NEXT: %c103 = constant 103 : index // CHECK-NEXT: %c104 = constant 104 : index @@ -553,7 +553,7 @@ func @affine_applies() { // CHECK-NEXT: %c7 = constant 7 : index // CHECK-NEXT: %12 = muli %c109, %c7 : index // CHECK-NEXT: %13 = addi %11, %12 : index - %four = affine_apply #map4(%103,%104,%105,%106)[%107,%108,%109] + %four = affine.apply #map4(%103,%104,%105,%106)[%107,%108,%109] return } @@ -561,8 +561,8 @@ func @affine_applies() { func @args_ret_affine_apply(index, index) -> (index, index) { ^bb0(%0 : index, %1 : index): // CHECK-NEXT: return %arg0, %arg1 : index, index - %00 = affine_apply #map2 (%0) - %11 = affine_apply #map1 ()[%1] + %00 = affine.apply #map2 (%0) + %11 = affine.apply #map1 ()[%1] return %00, %11 : index, index } @@ -578,7 +578,7 @@ func @args_ret_affine_apply(index, index) -> (index, index) { // --------------------------------------------------------------------------// // IMPORTANT NOTE: if you change this test, also change the @lowered_affine_mod // test in the "constant-fold.mlir" test to reflect the expected output of -// affine_apply lowering. +// affine.apply lowering. // --------------------------------------------------------------------------// // CHECK-LABEL: func @affine_apply_mod func @affine_apply_mod(%arg0 : index) -> (index) { @@ -588,7 +588,7 @@ func @affine_apply_mod(%arg0 : index) -> (index) { // CHECK-NEXT: %1 = cmpi "slt", %0, %c0 : index // CHECK-NEXT: %2 = addi %0, %c42 : index // CHECK-NEXT: %3 = select %1, %2, %0 : index - %0 = affine_apply #mapmod (%arg0) + %0 = affine.apply #mapmod (%arg0) return %0 : index } @@ -597,7 +597,7 @@ func @affine_apply_mod(%arg0 : index) -> (index) { // --------------------------------------------------------------------------// // IMPORTANT NOTE: if you change this test, also change the @lowered_affine_mod // test in the "constant-fold.mlir" test to reflect the expected output of -// affine_apply lowering. +// affine.apply lowering. // --------------------------------------------------------------------------// // CHECK-LABEL: func @affine_apply_floordiv func @affine_apply_floordiv(%arg0 : index) -> (index) { @@ -610,7 +610,7 @@ func @affine_apply_floordiv(%arg0 : index) -> (index) { // CHECK-NEXT: %3 = divis %2, %c42 : index // CHECK-NEXT: %4 = subi %c-1, %3 : index // CHECK-NEXT: %5 = select %0, %4, %3 : index - %0 = affine_apply #mapfloordiv (%arg0) + %0 = affine.apply #mapfloordiv (%arg0) return %0 : index } @@ -619,7 +619,7 @@ func @affine_apply_floordiv(%arg0 : index) -> (index) { // --------------------------------------------------------------------------// // IMPORTANT NOTE: if you change this test, also change the @lowered_affine_mod // test in the "constant-fold.mlir" test to reflect the expected output of -// affine_apply lowering. +// affine.apply lowering. // --------------------------------------------------------------------------// // CHECK-LABEL: func @affine_apply_ceildiv func @affine_apply_ceildiv(%arg0 : index) -> (index) { @@ -634,6 +634,6 @@ func @affine_apply_ceildiv(%arg0 : index) -> (index) { // CHECK-NEXT: %5 = subi %c0, %4 : index // CHECK-NEXT: %6 = addi %4, %c1 : index // CHECK-NEXT: %7 = select %0, %5, %6 : index - %0 = affine_apply #mapceildiv (%arg0) + %0 = affine.apply #mapceildiv (%arg0) return %0 : index } diff --git a/mlir/test/Transforms/memref-bound-check.mlir b/mlir/test/Transforms/memref-bound-check.mlir index edd1f642671..2926bf1afbc 100644 --- a/mlir/test/Transforms/memref-bound-check.mlir +++ b/mlir/test/Transforms/memref-bound-check.mlir @@ -13,8 +13,8 @@ func @test() { for %i = -1 to 10 { for %j = -1 to 10 { - %idx0 = affine_apply (d0, d1) -> (d0)(%i, %j) - %idx1 = affine_apply (d0, d1) -> (d1)(%i, %j) + %idx0 = affine.apply (d0, d1) -> (d0)(%i, %j) + %idx1 = affine.apply (d0, d1) -> (d1)(%i, %j) // Out of bound access. %x = load %A[%idx0, %idx1] : memref<9 x 9 x i32> // expected-error@-1 {{'load' op memref out of upper bound access along dimension #1}} @@ -22,7 +22,7 @@ func @test() { // expected-error@-3 {{'load' op memref out of upper bound access along dimension #2}} // expected-error@-4 {{'load' op memref out of lower bound access along dimension #2}} // This will access 0 to 110 - hence an overflow. - %idy = affine_apply (d0, d1) -> (10*d0 - d1 + 19)(%i, %j) + %idy = affine.apply (d0, d1) -> (10*d0 - d1 + 19)(%i, %j) %y = load %B[%idy] : memref<111 x i32> } } @@ -45,16 +45,16 @@ func @test_mod_floordiv_ceildiv() { for %i = 0 to 256 { for %j = 0 to 256 { - %idx0 = affine_apply (d0, d1, d2) -> (d0 mod 128 + 1)(%i, %j, %j) - %idx1 = affine_apply (d0, d1, d2) -> (d1 floordiv 4 + 1)(%i, %j, %j) - %idx2 = affine_apply (d0, d1, d2) -> (d2 ceildiv 4)(%i, %j, %j) + %idx0 = affine.apply (d0, d1, d2) -> (d0 mod 128 + 1)(%i, %j, %j) + %idx1 = affine.apply (d0, d1, d2) -> (d1 floordiv 4 + 1)(%i, %j, %j) + %idx2 = affine.apply (d0, d1, d2) -> (d2 ceildiv 4)(%i, %j, %j) %x = load %A[%idx0, %idx1, %idx2] : memref<128 x 64 x 64 x i32> // expected-error@-1 {{'load' op memref out of upper bound access along dimension #1}} // expected-error@-2 {{'load' op memref out of upper bound access along dimension #2}} // expected-error@-3 {{'load' op memref out of upper bound access along dimension #3}} - %idy0 = affine_apply (d0, d1, d2) -> (d0 mod 128)(%i, %j, %j) - %idy1 = affine_apply (d0, d1, d2) -> (d1 floordiv 4)(%i, %j, %j) - %idy2 = affine_apply (d0, d1, d2) -> (d2 ceildiv 4 - 1)(%i, %j, %j) + %idy0 = affine.apply (d0, d1, d2) -> (d0 mod 128)(%i, %j, %j) + %idy1 = affine.apply (d0, d1, d2) -> (d1 floordiv 4)(%i, %j, %j) + %idy2 = affine.apply (d0, d1, d2) -> (d2 ceildiv 4 - 1)(%i, %j, %j) store %x, %A[%idy0, %idy1, %idy2] : memref<128 x 64 x 64 x i32> // expected-error {{'store' op memref out of lower bound access along dimension #3}} // CHECK-EMPTY } // CHECK } @@ -72,16 +72,16 @@ func @test_no_out_of_bounds() { for %i = 0 to 256 { for %j = 0 to 256 { // All of these accesses are in bound; check that no errors are emitted. - // CHECK: %3 = affine_apply {{#map.*}}(%i0, %i1) + // CHECK: %3 = affine.apply {{#map.*}}(%i0, %i1) // CHECK-NEXT: %4 = load %0[%3, %c0] : memref<257x256xi32> - // CHECK-NEXT: %5 = affine_apply {{#map.*}}(%i0, %i0) + // CHECK-NEXT: %5 = affine.apply {{#map.*}}(%i0, %i0) // CHECK-NEXT: %6 = load %2[%5] : memref<1xi32> - %idx0 = affine_apply (d0, d1) -> ( 64 * (d0 ceildiv 64))(%i, %j) + %idx0 = affine.apply (d0, d1) -> ( 64 * (d0 ceildiv 64))(%i, %j) // Without GCDTightenInequalities(), the upper bound on the region // accessed along first memref dimension would have come out as d0 <= 318 // (instead of d0 <= 256), and led to a false positive out of bounds. %x = load %A[%idx0, %zero] : memref<257 x 256 x i32> - %idy = affine_apply (d0, d1) -> (d0 floordiv 256)(%i, %i) + %idy = affine.apply (d0, d1) -> (d0 floordiv 256)(%i, %i) %y = load %B[%idy] : memref<1 x i32> } // CHECK-NEXT } } @@ -95,16 +95,16 @@ func @mod_div() { for %i = 0 to 256 { for %j = 0 to 256 { - %idx0 = affine_apply (d0, d1, d2) -> (d0 mod 128 + 1)(%i, %j, %j) - %idx1 = affine_apply (d0, d1, d2) -> (d1 floordiv 4 + 1)(%i, %j, %j) - %idx2 = affine_apply (d0, d1, d2) -> (d2 ceildiv 4)(%i, %j, %j) + %idx0 = affine.apply (d0, d1, d2) -> (d0 mod 128 + 1)(%i, %j, %j) + %idx1 = affine.apply (d0, d1, d2) -> (d1 floordiv 4 + 1)(%i, %j, %j) + %idx2 = affine.apply (d0, d1, d2) -> (d2 ceildiv 4)(%i, %j, %j) %x = load %A[%idx0, %idx1, %idx2] : memref<128 x 64 x 64 x i32> // expected-error@-1 {{'load' op memref out of upper bound access along dimension #1}} // expected-error@-2 {{'load' op memref out of upper bound access along dimension #2}} // expected-error@-3 {{'load' op memref out of upper bound access along dimension #3}} - %idy0 = affine_apply (d0, d1, d2) -> (d0 mod 128)(%i, %j, %j) - %idy1 = affine_apply (d0, d1, d2) -> (d1 floordiv 4)(%i, %j, %j) - %idy2 = affine_apply (d0, d1, d2) -> (d2 ceildiv 4 - 1)(%i, %j, %j) + %idy0 = affine.apply (d0, d1, d2) -> (d0 mod 128)(%i, %j, %j) + %idy1 = affine.apply (d0, d1, d2) -> (d1 floordiv 4)(%i, %j, %j) + %idy2 = affine.apply (d0, d1, d2) -> (d2 ceildiv 4 - 1)(%i, %j, %j) store %x, %A[%idy0, %idy1, %idy2] : memref<128 x 64 x 64 x i32> // expected-error {{'store' op memref out of lower bound access along dimension #3}} } } @@ -117,8 +117,8 @@ func @mod_floordiv_nested() { %A = alloc() : memref<256 x 256 x i32> for %i = 0 to 256 { for %j = 0 to 256 { - %idx0 = affine_apply (d0, d1) -> ((d0 mod 1024) floordiv 4)(%i, %j) - %idx1 = affine_apply (d0, d1) -> ((((d1 mod 128) mod 32) ceildiv 4) * 32)(%i, %j) + %idx0 = affine.apply (d0, d1) -> ((d0 mod 1024) floordiv 4)(%i, %j) + %idx1 = affine.apply (d0, d1) -> ((((d1 mod 128) mod 32) ceildiv 4) * 32)(%i, %j) load %A[%idx0, %idx1] : memref<256 x 256 x i32> // expected-error {{'load' op memref out of upper bound access along dimension #2}} } } @@ -129,7 +129,7 @@ func @mod_floordiv_nested() { func @test_semi_affine_bailout(%N : index) { %B = alloc() : memref<10 x i32> for %i = 0 to 10 { - %idx = affine_apply (d0)[s0] -> (d0 * s0)(%i)[%N] + %idx = affine.apply (d0)[s0] -> (d0 * s0)(%i)[%N] %y = load %B[%idx] : memref<10 x i32> } return @@ -139,8 +139,8 @@ func @test_semi_affine_bailout(%N : index) { func @multi_mod_floordiv() { %A = alloc() : memref<2x2xi32> for %ii = 0 to 64 { - %idx0 = affine_apply (d0) -> ((d0 mod 147456) floordiv 1152) (%ii) - %idx1 = affine_apply (d0) -> (((d0 mod 147456) mod 1152) floordiv 384) (%ii) + %idx0 = affine.apply (d0) -> ((d0 mod 147456) floordiv 1152) (%ii) + %idx1 = affine.apply (d0) -> (((d0 mod 147456) mod 1152) floordiv 384) (%ii) %v = load %A[%idx0, %idx1] : memref<2x2xi32> } return @@ -155,18 +155,18 @@ func @delinearize_mod_floordiv() { // Reshape '%in' into '%out'. for %ii = 0 to 64 { for %jj = 0 to 9 { - %a0 = affine_apply (d0, d1) -> (d0 * (9 * 1024) + d1 * 128) (%ii, %jj) - %a10 = affine_apply (d0) -> + %a0 = affine.apply (d0, d1) -> (d0 * (9 * 1024) + d1 * 128) (%ii, %jj) + %a10 = affine.apply (d0) -> (d0 floordiv (2 * 3 * 3 * 128 * 128)) (%a0) - %a11 = affine_apply (d0) -> + %a11 = affine.apply (d0) -> ((d0 mod 294912) floordiv (3 * 3 * 128 * 128)) (%a0) - %a12 = affine_apply (d0) -> + %a12 = affine.apply (d0) -> ((((d0 mod 294912) mod 147456) floordiv 1152) floordiv 8) (%a0) - %a13 = affine_apply (d0) -> + %a13 = affine.apply (d0) -> ((((d0 mod 294912) mod 147456) mod 1152) floordiv 384) (%a0) - %a14 = affine_apply (d0) -> + %a14 = affine.apply (d0) -> (((((d0 mod 294912) mod 147456) mod 1152) mod 384) floordiv 128) (%a0) - %a15 = affine_apply (d0) -> + %a15 = affine.apply (d0) -> ((((((d0 mod 294912) mod 147456) mod 1152) mod 384) mod 128) floordiv 128) (%a0) %v0 = load %in[%a10, %a11, %a13, %a14, %a12, %a15] @@ -190,7 +190,7 @@ func @out_of_bounds() { %c9 = constant 9 : i32 for %i0 = 10 to 11 { - %idy = affine_apply (d0) -> (100 * d0 floordiv 1000) (%i0) + %idy = affine.apply (d0) -> (100 * d0 floordiv 1000) (%i0) store %c9, %in[%idy] : memref<1xi32> // expected-error {{'store' op memref out of upper bound access along dimension #1}} } return diff --git a/mlir/test/Transforms/memref-dataflow-opt.mlir b/mlir/test/Transforms/memref-dataflow-opt.mlir index c72368ce0d5..710d14c1cf9 100644 --- a/mlir/test/Transforms/memref-dataflow-opt.mlir +++ b/mlir/test/Transforms/memref-dataflow-opt.mlir @@ -61,10 +61,10 @@ func @store_load_affine_apply() -> memref<10x10xf32> { %m = alloc() : memref<10x10xf32> for %i0 = 0 to 10 { for %i1 = 0 to 10 { - %t0 = affine_apply (d0, d1) -> (d1 + 1)(%i0, %i1) - %t1 = affine_apply (d0, d1) -> (d0)(%i0, %i1) - %idx0 = affine_apply (d0, d1) -> (d1) (%t0, %t1) - %idx1 = affine_apply (d0, d1) -> (d0 - 1) (%t0, %t1) + %t0 = affine.apply (d0, d1) -> (d1 + 1)(%i0, %i1) + %t1 = affine.apply (d0, d1) -> (d0)(%i0, %i1) + %idx0 = affine.apply (d0, d1) -> (d1) (%t0, %t1) + %idx1 = affine.apply (d0, d1) -> (d0 - 1) (%t0, %t1) store %cf7, %m[%idx0, %idx1] : memref<10x10xf32> // CHECK-NOT: load %{{[0-9]+}} %v0 = load %m[%i0, %i1] : memref<10x10xf32> @@ -77,10 +77,10 @@ func @store_load_affine_apply() -> memref<10x10xf32> { // CHECK-NEXT: %0 = alloc() : memref<10x10xf32> // CHECK-NEXT: for %i0 = 0 to 10 { // CHECK-NEXT: for %i1 = 0 to 10 { -// CHECK-NEXT: %1 = affine_apply [[MAP0]](%i0, %i1) -// CHECK-NEXT: %2 = affine_apply [[MAP1]](%i0, %i1) -// CHECK-NEXT: %3 = affine_apply [[MAP2]](%1, %2) -// CHECK-NEXT: %4 = affine_apply [[MAP3]](%1, %2) +// CHECK-NEXT: %1 = affine.apply [[MAP0]](%i0, %i1) +// CHECK-NEXT: %2 = affine.apply [[MAP1]](%i0, %i1) +// CHECK-NEXT: %3 = affine.apply [[MAP2]](%1, %2) +// CHECK-NEXT: %4 = affine.apply [[MAP3]](%1, %2) // CHECK-NEXT: store %cst, %0[%3, %4] : memref<10x10xf32> // CHECK-NEXT: %5 = addf %cst, %cst : f32 // CHECK-NEXT: } @@ -228,7 +228,7 @@ func @store_load_store_nested_fwd(%N : index) -> f32 { for %i1 = 0 to %N { %v0 = load %m[%i0] : memref<10xf32> %v1 = addf %v0, %v0 : f32 - %idx = affine_apply (d0) -> (d0 + 1) (%i0) + %idx = affine.apply (d0) -> (d0 + 1) (%i0) store %cf9, %m[%idx] : memref<10xf32> } } @@ -240,7 +240,7 @@ func @store_load_store_nested_fwd(%N : index) -> f32 { // CHECK-NEXT: store %cst, %0[%i0] : memref<10xf32> // CHECK-NEXT: for %i1 = 0 to %arg0 { // CHECK-NEXT: %1 = addf %cst, %cst : f32 -// CHECK-NEXT: %2 = affine_apply [[MAP4]](%i0) +// CHECK-NEXT: %2 = affine.apply [[MAP4]](%i0) // CHECK-NEXT: store %cst_0, %0[%2] : memref<10xf32> // CHECK-NEXT: } // CHECK-NEXT: } diff --git a/mlir/test/Transforms/memref-dependence-check.mlir b/mlir/test/Transforms/memref-dependence-check.mlir index 628044ed77a..3ec840b1eb7 100644 --- a/mlir/test/Transforms/memref-dependence-check.mlir +++ b/mlir/test/Transforms/memref-dependence-check.mlir @@ -164,11 +164,11 @@ func @store_load_diff_element_affine_apply_const() { %m = alloc() : memref<100xf32> %c1 = constant 1 : index %c8 = constant 8.0 : f32 - %a0 = affine_apply (d0) -> (d0) (%c1) + %a0 = affine.apply (d0) -> (d0) (%c1) store %c8, %m[%a0] : memref<100xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 1 at depth 1 = false}} - %a1 = affine_apply (d0) -> (d0 + 1) (%c1) + %a1 = affine.apply (d0) -> (d0 + 1) (%c1) %v0 = load %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 1 at depth 1 = false}} @@ -182,11 +182,11 @@ func @store_load_same_element_affine_apply_const() { %c7 = constant 7.0 : f32 %c9 = constant 9 : index %c11 = constant 11 : index - %a0 = affine_apply (d0) -> (d0 + 1) (%c9) + %a0 = affine.apply (d0) -> (d0 + 1) (%c9) store %c7, %m[%a0] : memref<100xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 1 at depth 1 = true}} - %a1 = affine_apply (d0) -> (d0 - 1) (%c11) + %a1 = affine.apply (d0) -> (d0 - 1) (%c11) %v0 = load %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 1 at depth 1 = false}} @@ -198,11 +198,11 @@ func @store_load_same_element_affine_apply_const() { func @store_load_affine_apply_symbol(%arg0: index) { %m = alloc() : memref<100xf32> %c7 = constant 7.0 : f32 - %a0 = affine_apply (d0) -> (d0) (%arg0) + %a0 = affine.apply (d0) -> (d0) (%arg0) store %c7, %m[%a0] : memref<100xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 1 at depth 1 = true}} - %a1 = affine_apply (d0) -> (d0) (%arg0) + %a1 = affine.apply (d0) -> (d0) (%arg0) %v0 = load %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 1 at depth 1 = false}} @@ -214,11 +214,11 @@ func @store_load_affine_apply_symbol(%arg0: index) { func @store_load_affine_apply_symbol_offset(%arg0: index) { %m = alloc() : memref<100xf32> %c7 = constant 7.0 : f32 - %a0 = affine_apply (d0) -> (d0) (%arg0) + %a0 = affine.apply (d0) -> (d0) (%arg0) store %c7, %m[%a0] : memref<100xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 1 at depth 1 = false}} - %a1 = affine_apply (d0) -> (d0 + 1) (%arg0) + %a1 = affine.apply (d0) -> (d0 + 1) (%arg0) %v0 = load %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 1 at depth 1 = false}} @@ -232,13 +232,13 @@ func @store_range_load_after_range() { %c7 = constant 7.0 : f32 %c10 = constant 10 : index for %i0 = 0 to 10 { - %a0 = affine_apply (d0) -> (d0) (%i0) + %a0 = affine.apply (d0) -> (d0) (%i0) store %c7, %m[%a0] : memref<100xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} // expected-note@-3 {{dependence from 0 to 1 at depth 1 = false}} // expected-note@-4 {{dependence from 0 to 1 at depth 2 = false}} - %a1 = affine_apply (d0) -> (d0) (%c10) + %a1 = affine.apply (d0) -> (d0) (%c10) %v0 = load %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -255,13 +255,13 @@ func @store_load_func_symbol(%arg0: index, %arg1: index) { %c7 = constant 7.0 : f32 %c10 = constant 10 : index for %i0 = 0 to %arg1 { - %a0 = affine_apply (d0) -> (d0) (%arg0) + %a0 = affine.apply (d0) -> (d0) (%arg0) store %c7, %m[%a0] : memref<100xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = [1, +inf]}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} // expected-note@-3 {{dependence from 0 to 1 at depth 1 = [1, +inf]}} // expected-note@-4 {{dependence from 0 to 1 at depth 2 = true}} - %a1 = affine_apply (d0) -> (d0) (%arg0) + %a1 = affine.apply (d0) -> (d0) (%arg0) %v0 = load %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = [1, +inf]}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -278,7 +278,7 @@ func @store_range_load_last_in_range() { %c7 = constant 7.0 : f32 %c10 = constant 10 : index for %i0 = 0 to 10 { - %a0 = affine_apply (d0) -> (d0) (%i0) + %a0 = affine.apply (d0) -> (d0) (%i0) // For dependence from 0 to 1, we do not have a loop carried dependence // because only the final write in the loop accesses the same element as the // load, so this dependence appears only at depth 2 (loop independent). @@ -287,7 +287,7 @@ func @store_range_load_last_in_range() { // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} // expected-note@-3 {{dependence from 0 to 1 at depth 1 = false}} // expected-note@-4 {{dependence from 0 to 1 at depth 2 = true}} - %a1 = affine_apply (d0) -> (d0 - 1) (%c10) + %a1 = affine.apply (d0) -> (d0 - 1) (%c10) // For dependence from 1 to 0, we have write-after-read (WAR) dependences // for all loads in the loop to the store on the last iteration. %v0 = load %m[%a1] : memref<100xf32> @@ -306,13 +306,13 @@ func @store_range_load_before_range() { %c7 = constant 7.0 : f32 %c0 = constant 0 : index for %i0 = 1 to 11 { - %a0 = affine_apply (d0) -> (d0) (%i0) + %a0 = affine.apply (d0) -> (d0) (%i0) store %c7, %m[%a0] : memref<100xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} // expected-note@-3 {{dependence from 0 to 1 at depth 1 = false}} // expected-note@-4 {{dependence from 0 to 1 at depth 2 = false}} - %a1 = affine_apply (d0) -> (d0) (%c0) + %a1 = affine.apply (d0) -> (d0) (%c0) %v0 = load %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -329,7 +329,7 @@ func @store_range_load_first_in_range() { %c7 = constant 7.0 : f32 %c0 = constant 0 : index for %i0 = 1 to 11 { - %a0 = affine_apply (d0) -> (d0) (%i0) + %a0 = affine.apply (d0) -> (d0) (%i0) // Dependence from 0 to 1 at depth 1 is a range because all loads at // constant index zero are reads after first store at index zero during // first iteration of the loop. @@ -338,7 +338,7 @@ func @store_range_load_first_in_range() { // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} // expected-note@-3 {{dependence from 0 to 1 at depth 1 = [1, 9]}} // expected-note@-4 {{dependence from 0 to 1 at depth 2 = true}} - %a1 = affine_apply (d0) -> (d0 + 1) (%c0) + %a1 = affine.apply (d0) -> (d0 + 1) (%c0) %v0 = load %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -354,13 +354,13 @@ func @store_plus_3() { %m = alloc() : memref<100xf32> %c7 = constant 7.0 : f32 for %i0 = 1 to 11 { - %a0 = affine_apply (d0) -> (d0 + 3) (%i0) + %a0 = affine.apply (d0) -> (d0 + 3) (%i0) store %c7, %m[%a0] : memref<100xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} // expected-note@-3 {{dependence from 0 to 1 at depth 1 = [3, 3]}} // expected-note@-4 {{dependence from 0 to 1 at depth 2 = false}} - %a1 = affine_apply (d0) -> (d0) (%i0) + %a1 = affine.apply (d0) -> (d0) (%i0) %v0 = load %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -376,13 +376,13 @@ func @load_minus_2() { %m = alloc() : memref<100xf32> %c7 = constant 7.0 : f32 for %i0 = 2 to 11 { - %a0 = affine_apply (d0) -> (d0) (%i0) + %a0 = affine.apply (d0) -> (d0) (%i0) store %c7, %m[%a0] : memref<100xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} // expected-note@-3 {{dependence from 0 to 1 at depth 1 = [2, 2]}} // expected-note@-4 {{dependence from 0 to 1 at depth 2 = false}} - %a1 = affine_apply (d0) -> (d0 - 2) (%i0) + %a1 = affine.apply (d0) -> (d0 - 2) (%i0) %v0 = load %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -400,8 +400,8 @@ func @perfectly_nested_loops_loop_independent() { for %i0 = 0 to 11 { for %i1 = 0 to 11 { // Dependence from access 0 to 1 is loop independent at depth = 3. - %a00 = affine_apply (d0, d1) -> (d0) (%i0, %i1) - %a01 = affine_apply (d0, d1) -> (d1) (%i0, %i1) + %a00 = affine.apply (d0, d1) -> (d0) (%i0, %i1) + %a01 = affine.apply (d0, d1) -> (d1) (%i0, %i1) store %c7, %m[%a00, %a01] : memref<10x10xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} @@ -409,8 +409,8 @@ func @perfectly_nested_loops_loop_independent() { // expected-note@-4 {{dependence from 0 to 1 at depth 1 = false}} // expected-note@-5 {{dependence from 0 to 1 at depth 2 = false}} // expected-note@-6 {{dependence from 0 to 1 at depth 3 = true}} - %a10 = affine_apply (d0, d1) -> (d0) (%i0, %i1) - %a11 = affine_apply (d0, d1) -> (d1) (%i0, %i1) + %a10 = affine.apply (d0, d1) -> (d0) (%i0, %i1) + %a11 = affine.apply (d0, d1) -> (d1) (%i0, %i1) %v0 = load %m[%a10, %a11] : memref<10x10xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -431,8 +431,8 @@ func @perfectly_nested_loops_loop_carried_at_depth1() { for %i0 = 0 to 9 { for %i1 = 0 to 9 { // Dependence from access 0 to 1 is loop carried at depth 1. - %a00 = affine_apply (d0, d1) -> (d0) (%i0, %i1) - %a01 = affine_apply (d0, d1) -> (d1) (%i0, %i1) + %a00 = affine.apply (d0, d1) -> (d0) (%i0, %i1) + %a01 = affine.apply (d0, d1) -> (d1) (%i0, %i1) store %c7, %m[%a00, %a01] : memref<10x10xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} @@ -440,8 +440,8 @@ func @perfectly_nested_loops_loop_carried_at_depth1() { // expected-note@-4 {{dependence from 0 to 1 at depth 1 = [2, 2][0, 0]}} // expected-note@-5 {{dependence from 0 to 1 at depth 2 = false}} // expected-note@-6 {{dependence from 0 to 1 at depth 3 = false}} - %a10 = affine_apply (d0, d1) -> (d0 - 2) (%i0, %i1) - %a11 = affine_apply (d0, d1) -> (d1) (%i0, %i1) + %a10 = affine.apply (d0, d1) -> (d0 - 2) (%i0, %i1) + %a11 = affine.apply (d0, d1) -> (d1) (%i0, %i1) %v0 = load %m[%a10, %a11] : memref<10x10xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -462,8 +462,8 @@ func @perfectly_nested_loops_loop_carried_at_depth2() { for %i0 = 0 to 10 { for %i1 = 0 to 10 { // Dependence from access 0 to 1 is loop carried at depth 2. - %a00 = affine_apply (d0, d1) -> (d0) (%i0, %i1) - %a01 = affine_apply (d0, d1) -> (d1) (%i0, %i1) + %a00 = affine.apply (d0, d1) -> (d0) (%i0, %i1) + %a01 = affine.apply (d0, d1) -> (d1) (%i0, %i1) store %c7, %m[%a00, %a01] : memref<10x10xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} @@ -471,8 +471,8 @@ func @perfectly_nested_loops_loop_carried_at_depth2() { // expected-note@-4 {{dependence from 0 to 1 at depth 1 = false}} // expected-note@-5 {{dependence from 0 to 1 at depth 2 = [0, 0][3, 3]}} // expected-note@-6 {{dependence from 0 to 1 at depth 3 = false}} - %a10 = affine_apply (d0, d1) -> (d0) (%i0, %i1) - %a11 = affine_apply (d0, d1) -> (d1 - 3) (%i0, %i1) + %a10 = affine.apply (d0, d1) -> (d0) (%i0, %i1) + %a11 = affine.apply (d0, d1) -> (d1 - 3) (%i0, %i1) %v0 = load %m[%a10, %a11] : memref<10x10xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -493,8 +493,8 @@ func @one_common_loop() { // There is a loop-independent dependence from access 0 to 1 at depth 2. for %i0 = 0 to 10 { for %i1 = 0 to 10 { - %a00 = affine_apply (d0, d1) -> (d0) (%i0, %i1) - %a01 = affine_apply (d0, d1) -> (d1) (%i0, %i1) + %a00 = affine.apply (d0, d1) -> (d0) (%i0, %i1) + %a01 = affine.apply (d0, d1) -> (d1) (%i0, %i1) store %c7, %m[%a00, %a01] : memref<10x10xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} @@ -503,8 +503,8 @@ func @one_common_loop() { // expected-note@-5 {{dependence from 0 to 1 at depth 2 = true}} } for %i2 = 0 to 9 { - %a10 = affine_apply (d0, d1) -> (d0) (%i0, %i2) - %a11 = affine_apply (d0, d1) -> (d1) (%i0, %i2) + %a10 = affine.apply (d0, d1) -> (d0) (%i0, %i2) + %a11 = affine.apply (d0, d1) -> (d1) (%i0, %i2) %v0 = load %m[%a10, %a11] : memref<10x10xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -526,7 +526,7 @@ func @dependence_cycle() { // *) loop-independent dependence from access 1 to 2 at depth 2. // *) loop-carried dependence from access 3 to 0 at depth 1. for %i0 = 0 to 9 { - %a0 = affine_apply (d0) -> (d0) (%i0) + %a0 = affine.apply (d0) -> (d0) (%i0) %v0 = load %m.a[%a0] : memref<100xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} @@ -536,7 +536,7 @@ func @dependence_cycle() { // expected-note@-6 {{dependence from 0 to 2 at depth 2 = false}} // expected-note@-7 {{dependence from 0 to 3 at depth 1 = false}} // expected-note@-8 {{dependence from 0 to 3 at depth 2 = false}} - %a1 = affine_apply (d0) -> (d0) (%i0) + %a1 = affine.apply (d0) -> (d0) (%i0) store %v0, %m.b[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -546,7 +546,7 @@ func @dependence_cycle() { // expected-note@-6 {{dependence from 1 to 2 at depth 2 = true}} // expected-note@-7 {{dependence from 1 to 3 at depth 1 = false}} // expected-note@-8 {{dependence from 1 to 3 at depth 2 = false}} - %a2 = affine_apply (d0) -> (d0) (%i0) + %a2 = affine.apply (d0) -> (d0) (%i0) %v1 = load %m.b[%a2] : memref<100xf32> // expected-note@-1 {{dependence from 2 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 2 to 0 at depth 2 = false}} @@ -556,7 +556,7 @@ func @dependence_cycle() { // expected-note@-6 {{dependence from 2 to 2 at depth 2 = false}} // expected-note@-7 {{dependence from 2 to 3 at depth 1 = false}} // expected-note@-8 {{dependence from 2 to 3 at depth 2 = false}} - %a3 = affine_apply (d0) -> (d0 + 1) (%i0) + %a3 = affine.apply (d0) -> (d0 + 1) (%i0) store %v1, %m.a[%a3] : memref<100xf32> // expected-note@-1 {{dependence from 3 to 0 at depth 1 = [1, 1]}} // expected-note@-2 {{dependence from 3 to 0 at depth 2 = false}} @@ -577,8 +577,8 @@ func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) { %c7 = constant 7.0 : f32 for %i0 = 0 to %arg0 { for %i1 = 0 to %arg1 { - %a00 = affine_apply (d0, d1) -> (d0 - 1) (%i0, %i1) - %a01 = affine_apply (d0, d1) -> (d1 + 1) (%i0, %i1) + %a00 = affine.apply (d0, d1) -> (d0 - 1) (%i0, %i1) + %a01 = affine.apply (d0, d1) -> (d1 + 1) (%i0, %i1) %v0 = load %m[%a00, %a01] : memref<10x10xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} @@ -586,8 +586,8 @@ func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) { // expected-note@-4 {{dependence from 0 to 1 at depth 1 = false}} // expected-note@-5 {{dependence from 0 to 1 at depth 2 = false}} // expected-note@-6 {{dependence from 0 to 1 at depth 3 = false}} - %a10 = affine_apply (d0, d1) -> (d0) (%i0, %i1) - %a11 = affine_apply (d0, d1) -> (d1) (%i0, %i1) + %a10 = affine.apply (d0, d1) -> (d0) (%i0, %i1) + %a11 = affine.apply (d0, d1) -> (d1) (%i0, %i1) store %c7, %m[%a10, %a11] : memref<10x10xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = [1, 1][-1, -1]}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -607,7 +607,7 @@ func @war_raw_waw_deps() { %c7 = constant 7.0 : f32 for %i0 = 0 to 10 { for %i1 = 0 to 10 { - %a0 = affine_apply (d0) -> (d0 + 1) (%i1) + %a0 = affine.apply (d0) -> (d0 + 1) (%i1) %v0 = load %m[%a0] : memref<100xf32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} @@ -615,7 +615,7 @@ func @war_raw_waw_deps() { // expected-note@-4 {{dependence from 0 to 1 at depth 1 = [1, 9][1, 1]}} // expected-note@-5 {{dependence from 0 to 1 at depth 2 = [0, 0][1, 1]}} // expected-note@-6 {{dependence from 0 to 1 at depth 3 = false}} - %a1 = affine_apply (d0) -> (d0) (%i1) + %a1 = affine.apply (d0) -> (d0) (%i1) store %c7, %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = [1, 9][-1, -1]}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -634,7 +634,7 @@ func @mod_deps() { %m = alloc() : memref<100xf32> %c7 = constant 7.0 : f32 for %i0 = 0 to 10 { - %a0 = affine_apply (d0) -> (d0 mod 2) (%i0) + %a0 = affine.apply (d0) -> (d0 mod 2) (%i0) // Results are conservative here since we currently don't have a way to // represent strided sets in FlatAffineConstraints. %v0 = load %m[%a0] : memref<100xf32> @@ -642,7 +642,7 @@ func @mod_deps() { // expected-note@-2 {{dependence from 0 to 0 at depth 2 = false}} // expected-note@-3 {{dependence from 0 to 1 at depth 1 = [1, 9]}} // expected-note@-4 {{dependence from 0 to 1 at depth 2 = false}} - %a1 = affine_apply (d0) -> ( (d0 + 1) mod 2) (%i0) + %a1 = affine.apply (d0) -> ( (d0 + 1) mod 2) (%i0) store %c7, %m[%a1] : memref<100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = [1, 9]}} // expected-note@-2 {{dependence from 1 to 0 at depth 2 = false}} @@ -671,7 +671,7 @@ func @loop_nest_depth() { for %i3 = 0 to 8 { for %i4 = 0 to 8 { for %i5 = 0 to 16 { - %8 = affine_apply (d0, d1) -> (d0 * 16 + d1)(%i4, %i5) + %8 = affine.apply (d0, d1) -> (d0 * 16 + d1)(%i4, %i5) %9 = load %0[%8, %i3] : memref<100x100xf32> // expected-note@-1 {{dependence from 1 to 0 at depth 1 = false}} // expected-note@-2 {{dependence from 1 to 1 at depth 1 = false}} @@ -696,9 +696,9 @@ func @mod_div_3d() { for %i0 = 0 to 8 { for %i1 = 0 to 8 { for %i2 = 0 to 8 { - %idx0 = affine_apply (d0, d1, d2) -> (d0 floordiv 4) (%i0, %i1, %i2) - %idx1 = affine_apply (d0, d1, d2) -> (d1 mod 2) (%i0, %i1, %i2) - %idx2 = affine_apply (d0, d1, d2) -> (d2 floordiv 4) (%i0, %i1, %i2) + %idx0 = affine.apply (d0, d1, d2) -> (d0 floordiv 4) (%i0, %i1, %i2) + %idx1 = affine.apply (d0, d1, d2) -> (d1 mod 2) (%i0, %i1, %i2) + %idx2 = affine.apply (d0, d1, d2) -> (d2 floordiv 4) (%i0, %i1, %i2) store %c0, %M[%idx0, %idx1, %idx2] : memref<2 x 2 x 2 x i32> // expected-note@-1 {{dependence from 0 to 0 at depth 1 = [1, 3][-7, 7][-3, 3]}} // expected-note@-2 {{dependence from 0 to 0 at depth 2 = [0, 0][2, 7][-3, 3]}} @@ -744,18 +744,18 @@ func @delinearize_mod_floordiv() { for %ii = 0 to 64 { for %jj = 0 to 9 { - %a0 = affine_apply (d0, d1) -> (d0 * (9 * 1024) + d1 * 128) (%ii, %jj) - %a10 = affine_apply (d0) -> + %a0 = affine.apply (d0, d1) -> (d0 * (9 * 1024) + d1 * 128) (%ii, %jj) + %a10 = affine.apply (d0) -> (d0 floordiv (2 * 3 * 3 * 128 * 128)) (%a0) - %a11 = affine_apply (d0) -> + %a11 = affine.apply (d0) -> ((d0 mod 294912) floordiv (3 * 3 * 128 * 128)) (%a0) - %a12 = affine_apply (d0) -> + %a12 = affine.apply (d0) -> ((((d0 mod 294912) mod 147456) floordiv 1152) floordiv 8) (%a0) - %a13 = affine_apply (d0) -> + %a13 = affine.apply (d0) -> ((((d0 mod 294912) mod 147456) mod 1152) floordiv 384) (%a0) - %a14 = affine_apply (d0) -> + %a14 = affine.apply (d0) -> (((((d0 mod 294912) mod 147456) mod 1152) mod 384) floordiv 128) (%a0) - %a15 = affine_apply (d0) -> + %a15 = affine.apply (d0) -> ((((((d0 mod 294912) mod 147456) mod 1152) mod 384) mod 128) floordiv 128) (%a0) %v0 = load %in[%a10, %a11, %a13, %a14, %a12, %a15] : memref<2x2x3x3x16x1xi32> diff --git a/mlir/test/Transforms/pipeline-data-transfer.mlir b/mlir/test/Transforms/pipeline-data-transfer.mlir index e08b84367ea..30f98db2583 100644 --- a/mlir/test/Transforms/pipeline-data-transfer.mlir +++ b/mlir/test/Transforms/pipeline-data-transfer.mlir @@ -31,16 +31,16 @@ func @loop_nest_dma() { // CHECK: %0 = alloc() : memref<256xf32> // CHECK: %1 = alloc() : memref<2x32xf32, 1> // CHECK-NEXT: %2 = alloc() : memref<2x1xf32> -// CHECK-NEXT: %3 = affine_apply [[MOD_2]](%c0) -// CHECK-NEXT: %4 = affine_apply [[MOD_2]](%c0) +// CHECK-NEXT: %3 = affine.apply [[MOD_2]](%c0) +// CHECK-NEXT: %4 = affine.apply [[MOD_2]](%c0) // CHECK-NEXT: dma_start %0[%c0], %1[%3, %c0], %c128, %2[%4, %c0_0] : memref<256xf32>, memref<2x32xf32, 1>, memref<2x1xf32> // CHECK-NEXT: for %i0 = 1 to 8 { -// CHECK-NEXT: %5 = affine_apply [[MOD_2]](%i0) -// CHECK-NEXT: %6 = affine_apply [[MOD_2]](%i0) +// CHECK-NEXT: %5 = affine.apply [[MOD_2]](%i0) +// CHECK-NEXT: %6 = affine.apply [[MOD_2]](%i0) // CHECK-NEXT: dma_start %0[%i0], %1[%5, %i0], %c128, %2[%6, %c0_0] : memref<256xf32>, memref<2x32xf32, 1>, memref<2x1xf32> -// CHECK-NEXT: %7 = affine_apply [[MAP_MINUS_1]](%i0) -// CHECK-NEXT: %8 = affine_apply [[MOD_2]](%7) -// CHECK-NEXT: %9 = affine_apply [[MOD_2]](%7) +// CHECK-NEXT: %7 = affine.apply [[MAP_MINUS_1]](%i0) +// CHECK-NEXT: %8 = affine.apply [[MOD_2]](%7) +// CHECK-NEXT: %9 = affine.apply [[MOD_2]](%7) // CHECK-NEXT: dma_wait %2[%8, %c0_0], %c128 : memref<2x1xf32> // CHECK-NEXT: %10 = load %1[%9, %7] : memref<2x32xf32, 1> // CHECK-NEXT: %11 = "compute"(%10) : (f32) -> f32 @@ -49,9 +49,9 @@ func @loop_nest_dma() { // CHECK-NEXT: "do_more_compute"(%7, %i1) : (index, index) -> () // CHECK-NEXT: } // CHECK-NEXT: } -// CHECK-NEXT: %12 = affine_apply [[MAP_MINUS_1]](%c8) -// CHECK-NEXT: %13 = affine_apply [[MOD_2]](%12) -// CHECK-NEXT: %14 = affine_apply [[MOD_2]](%12) +// CHECK-NEXT: %12 = affine.apply [[MAP_MINUS_1]](%c8) +// CHECK-NEXT: %13 = affine.apply [[MOD_2]](%12) +// CHECK-NEXT: %14 = affine.apply [[MOD_2]](%12) // CHECK-NEXT: dma_wait %2[%13, %c0_0], %c128 : memref<2x1xf32> // CHECK-NEXT: %15 = load %1[%14, %12] : memref<2x32xf32, 1> // CHECK-NEXT: %16 = "compute"(%15) : (f32) -> f32 @@ -79,20 +79,20 @@ func @loop_step(%arg0: memref<512xf32>, return } // CHECK: [[TAG:%[0-9]+]] = alloc() : memref<2x1xi32> -// CHECK: %2 = affine_apply [[FLOOR_MOD_2]](%c0) -// CHECK: %3 = affine_apply [[FLOOR_MOD_2]](%c0) +// CHECK: %2 = affine.apply [[FLOOR_MOD_2]](%c0) +// CHECK: %3 = affine.apply [[FLOOR_MOD_2]](%c0) // CHECK-NEXT: dma_start %arg0[%c0], %0[%2, %c0_0], %c4, [[TAG]][%3, %c0_0] : memref<512xf32>, memref<2x4xf32, 1>, memref<2x1xi32> // CHECK-NEXT: for %i0 = 4 to 512 step 4 { -// CHECK-NEXT: %4 = affine_apply [[FLOOR_MOD_2]](%i0) -// CHECK-NEXT: %5 = affine_apply [[FLOOR_MOD_2]](%i0) +// CHECK-NEXT: %4 = affine.apply [[FLOOR_MOD_2]](%i0) +// CHECK-NEXT: %5 = affine.apply [[FLOOR_MOD_2]](%i0) // CHECK-NEXT: dma_start %arg0[%i0], %0[%4, %c0_0], %c4, [[TAG]][%5, %c0_0] : memref<512xf32>, memref<2x4xf32, 1>, memref<2x1xi32> -// CHECK-NEXT: %6 = affine_apply [[REMAP_SHIFT_MINUS_4]](%i0) -// CHECK-NEXT: %7 = affine_apply [[FLOOR_MOD_2]](%6) +// CHECK-NEXT: %6 = affine.apply [[REMAP_SHIFT_MINUS_4]](%i0) +// CHECK-NEXT: %7 = affine.apply [[FLOOR_MOD_2]](%6) // CHECK: dma_wait [[TAG]][%7, %c0_0], %c4 : memref<2x1xi32> // CHECK-NEXT: "compute"(%6) : (index) -> () // CHECK-NEXT: } -// CHECK-NEXT: [[SHIFTED:%[0-9]+]] = affine_apply [[REMAP_SHIFT_MINUS_4]](%c512) -// CHECK-NEXT: %10 = affine_apply [[FLOOR_MOD_2]]([[SHIFTED]]) +// CHECK-NEXT: [[SHIFTED:%[0-9]+]] = affine.apply [[REMAP_SHIFT_MINUS_4]](%c512) +// CHECK-NEXT: %10 = affine.apply [[FLOOR_MOD_2]]([[SHIFTED]]) // CHECK: dma_wait [[TAG]][%10, %c0_0], %c4 : memref<2x1xi32> // CHECK-NEXT: "compute"(%9) : (index) -> () // CHECK-NEXT: return @@ -116,7 +116,7 @@ func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>, #map0>, %arg1: memref< // CHECK: dma_start %arg2[ // CHECK: for %i0 = 1 to 8 { for %i0 = 0 to 8 { - %6 = affine_apply #map2(%i0) + %6 = affine.apply #map2(%i0) dma_start %arg2[%6, %c0], %2[%c0, %c0], %num_elts, %5[%c0] : memref<512x32xvector<8xf32>, #map0>, memref<64x4xvector<8xf32>, #map0, 2>, memref<2xi32> dma_wait %5[%c0], %num_elts : memref<2xi32> // Steady state for DMA overlap on arg2 @@ -129,8 +129,8 @@ func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>, #map0>, %arg1: memref< // CHECK: dma_start %arg1[ // CHECK-NEXT for %i1 = 1 to 8 { for %i1 = 0 to 8 { - %7 = affine_apply #map1(%i0, %i1) - %8 = affine_apply #map2(%i1) + %7 = affine.apply #map1(%i0, %i1) + %8 = affine.apply #map2(%i1) dma_start %arg0[%7, %c0], %0[%c0, %c0], %num_elts, %3[%c0] : memref<512x32xvector<8xf32>, #map0>, memref<64x4xvector<8xf32>, #map0, 2>, memref<2xi32> dma_start %arg1[%8, %c0], %1[%c0, %c0], %num_elts, %4[%c0] : memref<512x32xvector<8xf32>, #map0>, memref<64x4xvector<8xf32>, #map0, 2>, memref<2xi32> dma_wait %3[%c0], %num_elts : memref<2xi32> @@ -187,7 +187,7 @@ func @loop_dma_dependent(%arg2: memref<512x32xvector<8xf32>>) { // CHECK-NOT: dma_start // CHECK: for %i0 = 0 to 8 { for %i0 = 0 to 8 { - %6 = affine_apply #map2(%i0) + %6 = affine.apply #map2(%i0) dma_start %arg2[%6, %c0], %2[%c0, %c0], %num_elts, %5[%c0] : memref<512x32xvector<8xf32>>, memref<64x4xvector<8xf32>, 2>, memref<2xi32> dma_wait %5[%c0], %num_elts : memref<2xi32> @@ -258,8 +258,8 @@ func @dynamic_shape_dma_buffer(%arg0: memref<512 x 32 x f32>) { // CHECK-NEXT: %1 = dim %0, 0 : memref<?x?xf32, 2> // CHECK-NEXT: %2 = dim %0, 1 : memref<?x?xf32, 2> // CHECK-NEXT: %3 = alloc(%1, %2) : memref<2x?x?xf32, 2> -// CHECK: %5 = affine_apply [[MOD_2]](%c0) -// CHECK: %6 = affine_apply [[MOD_2]](%c0) +// CHECK: %5 = affine.apply [[MOD_2]](%c0) +// CHECK: %6 = affine.apply [[MOD_2]](%c0) // CHECK: dma_start %arg0[%c0_0, %c0_0], %3[%5, %c0_0, %c0_0], %c512, %4[%6, %c0_0] for %kTT = 0 to 16 { dma_start %arg0[%zero, %zero], %Av[%zero, %zero], %num_elt, %tag[%zero] : @@ -269,8 +269,8 @@ func @dynamic_shape_dma_buffer(%arg0: memref<512 x 32 x f32>) { } return // CHECK-NEXT: for %i0 = 1 to 16 { -// CHECK: %7 = affine_apply [[MOD_2]](%i0) -// CHECK: %8 = affine_apply [[MOD_2]](%i0) +// CHECK: %7 = affine.apply [[MOD_2]](%i0) +// CHECK: %8 = affine.apply [[MOD_2]](%i0) // CHECK: dma_start %arg0[%c0_0, %c0_0], %3[%7, %c0_0, %c0_0], %c512, %4[%8, %c0_0] // CHECK: dma_wait %4[%10, %c0_0], %c512 : memref<2x1xi32> // CHECK: } diff --git a/mlir/test/Transforms/unroll-jam.mlir b/mlir/test/Transforms/unroll-jam.mlir index b410c9e85b0..da4f965676f 100644 --- a/mlir/test/Transforms/unroll-jam.mlir +++ b/mlir/test/Transforms/unroll-jam.mlir @@ -10,20 +10,20 @@ func @unroll_jam_imperfect_nest() { // CHECK-NEXT: for %i0 = 0 to 99 step 2 { for %i = 0 to 101 { // CHECK: %0 = "addi32"(%i0, %i0) : (index, index) -> i32 - // CHECK-NEXT: %1 = affine_apply [[MAP_PLUS_1]](%i0) + // CHECK-NEXT: %1 = affine.apply [[MAP_PLUS_1]](%i0) // CHECK-NEXT: %2 = "addi32"(%1, %1) : (index, index) -> i32 %x = "addi32"(%i, %i) : (index, index) -> i32 for %j = 0 to 17 { // CHECK: %3 = "addi32"(%i0, %i0) : (index, index) -> i32 // CHECK-NEXT: %4 = "addi32"(%3, %3) : (i32, i32) -> i32 - // CHECK-NEXT: %5 = affine_apply [[MAP_PLUS_1]](%i0) + // CHECK-NEXT: %5 = affine.apply [[MAP_PLUS_1]](%i0) // CHECK-NEXT: %6 = "addi32"(%5, %5) : (index, index) -> i32 // CHECK-NEXT: %7 = "addi32"(%6, %6) : (i32, i32) -> i32 %y = "addi32"(%i, %i) : (index, index) -> i32 %z = "addi32"(%y, %y) : (i32, i32) -> i32 } // CHECK: %8 = "addi32"(%i0, %i0) : (index, index) -> i32 - // CHECK-NEXT: %9 = affine_apply [[MAP_PLUS_1]](%i0) + // CHECK-NEXT: %9 = affine.apply [[MAP_PLUS_1]](%i0) // CHECK-NEXT: %10 = "addi32"(%9, %9) : (index, index) -> i32 %w = "addi32"(%i, %i) : (index, index) -> i32 } // CHECK } @@ -67,16 +67,16 @@ func @loop_nest_unknown_count_2(%arg : index) { // UNROLL-BY-4-NEXT: for %i0 = %arg0 to #map{{[0-9]+}}()[%arg0] step 4 { // UNROLL-BY-4-NEXT: for %i1 = 1 to 100 { // UNROLL-BY-4-NEXT: %0 = "foo"(%i0) : (index) -> i32 - // UNROLL-BY-4-NEXT: %1 = affine_apply #map{{[0-9]+}}(%i0) + // UNROLL-BY-4-NEXT: %1 = affine.apply #map{{[0-9]+}}(%i0) // UNROLL-BY-4-NEXT: %2 = "foo"(%1) : (index) -> i32 - // UNROLL-BY-4-NEXT: %3 = affine_apply #map{{[0-9]+}}(%i0) + // UNROLL-BY-4-NEXT: %3 = affine.apply #map{{[0-9]+}}(%i0) // UNROLL-BY-4-NEXT: %4 = "foo"(%3) : (index) -> i32 - // UNROLL-BY-4-NEXT: %5 = affine_apply #map{{[0-9]+}}(%i0) + // UNROLL-BY-4-NEXT: %5 = affine.apply #map{{[0-9]+}}(%i0) // UNROLL-BY-4-NEXT: %6 = "foo"(%5) : (index) -> i32 // UNROLL-BY-4-NEXT: } // UNROLL-BY-4-NEXT: } // The cleanup loop is a single iteration one and is promoted. - // UNROLL-BY-4-NEXT: %7 = affine_apply [[M1:#map{{[0-9]+}}]]()[%arg0] + // UNROLL-BY-4-NEXT: %7 = affine.apply [[M1:#map{{[0-9]+}}]]()[%arg0] // UNROLL-BY-4-NEXT: for %i3 = 1 to 100 { // UNROLL-BY-4-NEXT: %8 = "foo"() : () -> i32 // UNROLL-BY-4_NEXT: } diff --git a/mlir/test/Transforms/unroll.mlir b/mlir/test/Transforms/unroll.mlir index 09e55403b7d..c023561faa8 100644 --- a/mlir/test/Transforms/unroll.mlir +++ b/mlir/test/Transforms/unroll.mlir @@ -65,11 +65,11 @@ func @loop_nest_simple_iv_use() { // CHECK-NEXT: for %i0 = 0 to 100 step 2 { for %i = 0 to 100 step 2 { // CHECK: %0 = "addi32"(%c0, %c0) : (index, index) -> i32 - // CHECK: %1 = affine_apply [[MAP0]](%c0) + // CHECK: %1 = affine.apply [[MAP0]](%c0) // CHECK-NEXT: %2 = "addi32"(%1, %1) : (index, index) -> i32 - // CHECK: %3 = affine_apply [[MAP1]](%c0) + // CHECK: %3 = affine.apply [[MAP1]](%c0) // CHECK-NEXT: %4 = "addi32"(%3, %3) : (index, index) -> i32 - // CHECK: %5 = affine_apply [[MAP2]](%c0) + // CHECK: %5 = affine.apply [[MAP2]](%c0) // CHECK-NEXT: %6 = "addi32"(%5, %5) : (index, index) -> i32 for %j = 0 to 4 { %x = "addi32"(%j, %j) : (index, index) -> i32 @@ -86,19 +86,19 @@ func @loop_nest_body_def_use() { for %i = 0 to 100 step 2 { // CHECK: %c0_0 = constant 0 : index %c0 = constant 0 : index - // CHECK: %0 = affine_apply [[MAP0]](%c0) + // CHECK: %0 = affine.apply [[MAP0]](%c0) // CHECK-NEXT: %1 = "addi32"(%0, %c0_0) : (index, index) -> index - // CHECK-NEXT: %2 = affine_apply [[MAP0]](%c0) - // CHECK-NEXT: %3 = affine_apply [[MAP0]](%2) + // CHECK-NEXT: %2 = affine.apply [[MAP0]](%c0) + // CHECK-NEXT: %3 = affine.apply [[MAP0]](%2) // CHECK-NEXT: %4 = "addi32"(%3, %c0_0) : (index, index) -> index - // CHECK-NEXT: %5 = affine_apply [[MAP1]](%c0) - // CHECK-NEXT: %6 = affine_apply [[MAP0]](%5) + // CHECK-NEXT: %5 = affine.apply [[MAP1]](%c0) + // CHECK-NEXT: %6 = affine.apply [[MAP0]](%5) // CHECK-NEXT: %7 = "addi32"(%6, %c0_0) : (index, index) -> index - // CHECK-NEXT: %8 = affine_apply [[MAP2]](%c0) - // CHECK-NEXT: %9 = affine_apply [[MAP0]](%8) + // CHECK-NEXT: %8 = affine.apply [[MAP2]](%c0) + // CHECK-NEXT: %9 = affine.apply [[MAP0]](%8) // CHECK-NEXT: %10 = "addi32"(%9, %c0_0) : (index, index) -> index for %j = 0 to 4 { - %x = "affine_apply" (%j) { map: (d0) -> (d0 + 1) } : + %x = "affine.apply" (%j) { map: (d0) -> (d0 + 1) } : (index) -> (index) %y = "addi32"(%x, %c0) : (index, index) -> index } @@ -112,26 +112,26 @@ func @loop_nest_strided() { // CHECK-NEXT: %c2_0 = constant 2 : index // CHECK-NEXT: for %i0 = 0 to 100 { for %i = 0 to 100 { - // CHECK: %0 = affine_apply [[MAP0]](%c2_0) + // CHECK: %0 = affine.apply [[MAP0]](%c2_0) // CHECK-NEXT: %1 = "addi32"(%0, %0) : (index, index) -> index - // CHECK-NEXT: %2 = affine_apply [[MAP1]](%c2_0) - // CHECK-NEXT: %3 = affine_apply [[MAP0]](%2) + // CHECK-NEXT: %2 = affine.apply [[MAP1]](%c2_0) + // CHECK-NEXT: %3 = affine.apply [[MAP0]](%2) // CHECK-NEXT: %4 = "addi32"(%3, %3) : (index, index) -> index for %j = 2 to 6 step 2 { - %x = "affine_apply" (%j) { map: (d0) -> (d0 + 1) } : + %x = "affine.apply" (%j) { map: (d0) -> (d0 + 1) } : (index) -> (index) %y = "addi32"(%x, %x) : (index, index) -> index } - // CHECK: %5 = affine_apply [[MAP0]](%c2) + // CHECK: %5 = affine.apply [[MAP0]](%c2) // CHECK-NEXT: %6 = "addi32"(%5, %5) : (index, index) -> index - // CHECK-NEXT: %7 = affine_apply [[MAP1]](%c2) - // CHECK-NEXT: %8 = affine_apply [[MAP0]](%7) + // CHECK-NEXT: %7 = affine.apply [[MAP1]](%c2) + // CHECK-NEXT: %8 = affine.apply [[MAP0]](%7) // CHECK-NEXT: %9 = "addi32"(%8, %8) : (index, index) -> index - // CHECK-NEXT: %10 = affine_apply [[MAP3]](%c2) - // CHECK-NEXT: %11 = affine_apply [[MAP0]](%10) + // CHECK-NEXT: %10 = affine.apply [[MAP3]](%c2) + // CHECK-NEXT: %11 = affine.apply [[MAP0]](%10) // CHECK-NEXT: %12 = "addi32"(%11, %11) : (index, index) -> index for %k = 2 to 7 step 2 { - %z = "affine_apply" (%k) { map: (d0) -> (d0 + 1) } : + %z = "affine.apply" (%k) { map: (d0) -> (d0 + 1) } : (index) -> (index) %w = "addi32"(%z, %z) : (index, index) -> index } @@ -144,19 +144,19 @@ func @loop_nest_multiple_results() { // CHECK: %c0 = constant 0 : index // CHECK-NEXT: for %i0 = 0 to 100 { for %i = 0 to 100 { - // CHECK: %0 = affine_apply [[MAP4]](%i0, %c0) + // CHECK: %0 = affine.apply [[MAP4]](%i0, %c0) // CHECK-NEXT: %1 = "addi32"(%0, %0) : (index, index) -> index - // CHECK-NEXT: %2 = affine_apply #map{{.*}}(%i0, %c0) + // CHECK-NEXT: %2 = affine.apply #map{{.*}}(%i0, %c0) // CHECK-NEXT: %3 = "fma"(%2, %0, %0) : (index, index, index) -> (index, index) - // CHECK-NEXT: %4 = affine_apply #map{{.*}}(%c0) - // CHECK-NEXT: %5 = affine_apply #map{{.*}}(%i0, %4) + // CHECK-NEXT: %4 = affine.apply #map{{.*}}(%c0) + // CHECK-NEXT: %5 = affine.apply #map{{.*}}(%i0, %4) // CHECK-NEXT: %6 = "addi32"(%5, %5) : (index, index) -> index - // CHECK-NEXT: %7 = affine_apply #map{{.*}}(%i0, %4) + // CHECK-NEXT: %7 = affine.apply #map{{.*}}(%i0, %4) // CHECK-NEXT: %8 = "fma"(%7, %5, %5) : (index, index, index) -> (index, index) for %j = 0 to 2 step 1 { - %x = affine_apply (d0, d1) -> (d0 + 1) (%i, %j) + %x = affine.apply (d0, d1) -> (d0 + 1) (%i, %j) %y = "addi32"(%x, %x) : (index, index) -> index - %z = affine_apply (d0, d1) -> (d0 + 3) (%i, %j) + %z = affine.apply (d0, d1) -> (d0 + 3) (%i, %j) %w = "fma"(%z, %x, %x) : (index, index, index) -> (index, index) } } // CHECK: } @@ -174,23 +174,23 @@ func @loop_nest_seq_imperfect(%a : memref<128x128xf32>) { for %i = 0 to 100 { // CHECK: %0 = "vld"(%i0) : (index) -> i32 %ld = "vld"(%i) : (index) -> i32 - // CHECK: %1 = affine_apply [[MAP0]](%c0) + // CHECK: %1 = affine.apply [[MAP0]](%c0) // CHECK-NEXT: %2 = "vmulf"(%c0, %1) : (index, index) -> index // CHECK-NEXT: %3 = "vaddf"(%2, %2) : (index, index) -> index - // CHECK-NEXT: %4 = affine_apply [[MAP0]](%c0) - // CHECK-NEXT: %5 = affine_apply [[MAP0]](%4) + // CHECK-NEXT: %4 = affine.apply [[MAP0]](%c0) + // CHECK-NEXT: %5 = affine.apply [[MAP0]](%4) // CHECK-NEXT: %6 = "vmulf"(%4, %5) : (index, index) -> index // CHECK-NEXT: %7 = "vaddf"(%6, %6) : (index, index) -> index - // CHECK-NEXT: %8 = affine_apply [[MAP1]](%c0) - // CHECK-NEXT: %9 = affine_apply [[MAP0]](%8) + // CHECK-NEXT: %8 = affine.apply [[MAP1]](%c0) + // CHECK-NEXT: %9 = affine.apply [[MAP0]](%8) // CHECK-NEXT: %10 = "vmulf"(%8, %9) : (index, index) -> index // CHECK-NEXT: %11 = "vaddf"(%10, %10) : (index, index) -> index - // CHECK-NEXT: %12 = affine_apply [[MAP2]](%c0) - // CHECK-NEXT: %13 = affine_apply [[MAP0]](%12) + // CHECK-NEXT: %12 = affine.apply [[MAP2]](%c0) + // CHECK-NEXT: %13 = affine.apply [[MAP0]](%12) // CHECK-NEXT: %14 = "vmulf"(%12, %13) : (index, index) -> index // CHECK-NEXT: %15 = "vaddf"(%14, %14) : (index, index) -> index for %j = 0 to 4 { - %x = "affine_apply" (%j) { map: (d0) -> (d0 + 1) } : + %x = "affine.apply" (%j) { map: (d0) -> (d0 + 1) } : (index) -> (index) %y = "vmulf"(%j, %x) : (index, index) -> index %z = "vaddf"(%y, %y) : (index, index) -> index @@ -207,19 +207,19 @@ func @loop_nest_seq_imperfect(%a : memref<128x128xf32>) { func @loop_nest_seq_multiple() { // CHECK: c0 = constant 0 : index // CHECK-NEXT: %c0_0 = constant 0 : index - // CHECK-NEXT: %0 = affine_apply [[MAP0]](%c0_0) + // CHECK-NEXT: %0 = affine.apply [[MAP0]](%c0_0) // CHECK-NEXT: "mul"(%0, %0) : (index, index) -> () - // CHECK-NEXT: %1 = affine_apply [[MAP0]](%c0_0) - // CHECK-NEXT: %2 = affine_apply [[MAP0]](%1) + // CHECK-NEXT: %1 = affine.apply [[MAP0]](%c0_0) + // CHECK-NEXT: %2 = affine.apply [[MAP0]](%1) // CHECK-NEXT: "mul"(%2, %2) : (index, index) -> () - // CHECK-NEXT: %3 = affine_apply [[MAP1]](%c0_0) - // CHECK-NEXT: %4 = affine_apply [[MAP0]](%3) + // CHECK-NEXT: %3 = affine.apply [[MAP1]](%c0_0) + // CHECK-NEXT: %4 = affine.apply [[MAP0]](%3) // CHECK-NEXT: "mul"(%4, %4) : (index, index) -> () - // CHECK-NEXT: %5 = affine_apply [[MAP2]](%c0_0) - // CHECK-NEXT: %6 = affine_apply [[MAP0]](%5) + // CHECK-NEXT: %5 = affine.apply [[MAP2]](%c0_0) + // CHECK-NEXT: %6 = affine.apply [[MAP0]](%5) // CHECK-NEXT: "mul"(%6, %6) : (index, index) -> () for %j = 0 to 4 { - %x = "affine_apply" (%j) { map: (d0) -> (d0 + 1) } : + %x = "affine.apply" (%j) { map: (d0) -> (d0 + 1) } : (index) -> (index) "mul"(%x, %x) : (index, index) -> () } @@ -228,21 +228,21 @@ func @loop_nest_seq_multiple() { %k = "constant"(){value: 99} : () -> index // CHECK: for %i0 = 0 to 100 step 2 { for %m = 0 to 100 step 2 { - // CHECK: %7 = affine_apply [[MAP0]](%c0) - // CHECK-NEXT: %8 = affine_apply [[MAP6]](%c0)[%c99] - // CHECK-NEXT: %9 = affine_apply [[MAP0]](%c0) - // CHECK-NEXT: %10 = affine_apply [[MAP0]](%9) - // CHECK-NEXT: %11 = affine_apply [[MAP6]](%9)[%c99] - // CHECK-NEXT: %12 = affine_apply [[MAP1]](%c0) - // CHECK-NEXT: %13 = affine_apply [[MAP0]](%12) - // CHECK-NEXT: %14 = affine_apply [[MAP6]](%12)[%c99] - // CHECK-NEXT: %15 = affine_apply [[MAP2]](%c0) - // CHECK-NEXT: %16 = affine_apply [[MAP0]](%15) - // CHECK-NEXT: %17 = affine_apply [[MAP6]](%15)[%c99] + // CHECK: %7 = affine.apply [[MAP0]](%c0) + // CHECK-NEXT: %8 = affine.apply [[MAP6]](%c0)[%c99] + // CHECK-NEXT: %9 = affine.apply [[MAP0]](%c0) + // CHECK-NEXT: %10 = affine.apply [[MAP0]](%9) + // CHECK-NEXT: %11 = affine.apply [[MAP6]](%9)[%c99] + // CHECK-NEXT: %12 = affine.apply [[MAP1]](%c0) + // CHECK-NEXT: %13 = affine.apply [[MAP0]](%12) + // CHECK-NEXT: %14 = affine.apply [[MAP6]](%12)[%c99] + // CHECK-NEXT: %15 = affine.apply [[MAP2]](%c0) + // CHECK-NEXT: %16 = affine.apply [[MAP0]](%15) + // CHECK-NEXT: %17 = affine.apply [[MAP6]](%15)[%c99] for %n = 0 to 4 { - %y = "affine_apply" (%n) { map: (d0) -> (d0 + 1) } : + %y = "affine.apply" (%n) { map: (d0) -> (d0 + 1) } : (index) -> (index) - %z = "affine_apply" (%n, %k) { map: (d0) [s0] -> (d0 + s0 + 1) } : + %z = "affine.apply" (%n, %k) { map: (d0) [s0] -> (d0 + s0 + 1) } : (index, index) -> (index) } // CHECK } } // CHECK } @@ -252,16 +252,16 @@ func @loop_nest_seq_multiple() { // SHORT-LABEL: func @loop_nest_outer_unroll() { func @loop_nest_outer_unroll() { // SHORT: for %i0 = 0 to 4 { - // SHORT-NEXT: %0 = affine_apply [[MAP0]](%i0) + // SHORT-NEXT: %0 = affine.apply [[MAP0]](%i0) // SHORT-NEXT: %1 = "addi32"(%0, %0) : (index, index) -> index // SHORT-NEXT: } // SHORT-NEXT: for %i1 = 0 to 4 { - // SHORT-NEXT: %2 = affine_apply [[MAP0]](%i1) + // SHORT-NEXT: %2 = affine.apply [[MAP0]](%i1) // SHORT-NEXT: %3 = "addi32"(%2, %2) : (index, index) -> index // SHORT-NEXT: } for %i = 0 to 2 { for %j = 0 to 4 { - %x = "affine_apply" (%j) { map: (d0) -> (d0 + 1) } : + %x = "affine.apply" (%j) { map: (d0) -> (d0 + 1) } : (index) -> (index) %y = "addi32"(%x, %x) : (index, index) -> index } @@ -295,19 +295,19 @@ func @loop_nest_seq_long() -> i32 { for %i0 = 0 to 2 { for %i1 = 0 to 2 { for %i2 = 0 to 8 { - %b2 = "affine_apply" (%i1, %i2) {map: (d0, d1) -> (16*d0 + d1)} : (index, index) -> index + %b2 = "affine.apply" (%i1, %i2) {map: (d0, d1) -> (16*d0 + d1)} : (index, index) -> index %x = load %B[%i0, %b2] : memref<512 x 512 x i32, (d0, d1) -> (d0, d1), 2> "op1"(%x) : (i32) -> () } for %j1 = 0 to 8 { for %j2 = 0 to 8 { - %a2 = "affine_apply" (%i1, %j2) {map: (d0, d1) -> (16*d0 + d1)} : (index, index) -> index + %a2 = "affine.apply" (%i1, %j2) {map: (d0, d1) -> (16*d0 + d1)} : (index, index) -> index %v203 = load %A[%j1, %a2] : memref<512 x 512 x i32, (d0, d1) -> (d0, d1), 2> "op2"(%v203) : (i32) -> () } for %k2 = 0 to 8 { %s0 = "op3"() : () -> i32 - %c2 = "affine_apply" (%i0, %k2) {map: (d0, d1) -> (16*d0 + d1)} : (index, index) -> index + %c2 = "affine.apply" (%i0, %k2) {map: (d0, d1) -> (16*d0 + d1)} : (index, index) -> index %s1 = load %C[%j1, %c2] : memref<512 x 512 x i32, (d0, d1) -> (d0, d1), 2> %s2 = "addi32"(%s0, %s1) : (i32, i32) -> i32 store %s2, %C[%j1, %c2] : memref<512 x 512 x i32, (d0, d1) -> (d0, d1), 2> @@ -327,13 +327,13 @@ func @unroll_unit_stride_no_cleanup() { // UNROLL-BY-4: for [[L1:%i[0-9]+]] = 0 to 8 step 4 { // UNROLL-BY-4-NEXT: %0 = "addi32"([[L1]], [[L1]]) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %1 = "addi32"(%0, %0) : (i32, i32) -> i32 - // UNROLL-BY-4-NEXT: %2 = affine_apply #map{{[0-9]+}}([[L1]]) + // UNROLL-BY-4-NEXT: %2 = affine.apply #map{{[0-9]+}}([[L1]]) // UNROLL-BY-4-NEXT: %3 = "addi32"(%2, %2) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %4 = "addi32"(%3, %3) : (i32, i32) -> i32 - // UNROLL-BY-4-NEXT: %5 = affine_apply #map{{[0-9]+}}([[L1]]) + // UNROLL-BY-4-NEXT: %5 = affine.apply #map{{[0-9]+}}([[L1]]) // UNROLL-BY-4-NEXT: %6 = "addi32"(%5, %5) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %7 = "addi32"(%6, %6) : (i32, i32) -> i32 - // UNROLL-BY-4-NEXT: %8 = affine_apply #map{{[0-9]+}}([[L1]]) + // UNROLL-BY-4-NEXT: %8 = affine.apply #map{{[0-9]+}}([[L1]]) // UNROLL-BY-4-NEXT: %9 = "addi32"(%8, %8) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %10 = "addi32"(%9, %9) : (i32, i32) -> i32 // UNROLL-BY-4-NEXT: } @@ -356,13 +356,13 @@ func @unroll_unit_stride_cleanup() { // UNROLL-BY-4: for [[L1:%i[0-9]+]] = 0 to 7 step 4 { // UNROLL-BY-4-NEXT: %0 = "addi32"([[L1]], [[L1]]) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %1 = "addi32"(%0, %0) : (i32, i32) -> i32 - // UNROLL-BY-4-NEXT: %2 = affine_apply #map{{[0-9]+}}([[L1]]) + // UNROLL-BY-4-NEXT: %2 = affine.apply #map{{[0-9]+}}([[L1]]) // UNROLL-BY-4-NEXT: %3 = "addi32"(%2, %2) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %4 = "addi32"(%3, %3) : (i32, i32) -> i32 - // UNROLL-BY-4-NEXT: %5 = affine_apply #map{{[0-9]+}}([[L1]]) + // UNROLL-BY-4-NEXT: %5 = affine.apply #map{{[0-9]+}}([[L1]]) // UNROLL-BY-4-NEXT: %6 = "addi32"(%5, %5) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %7 = "addi32"(%6, %6) : (i32, i32) -> i32 - // UNROLL-BY-4-NEXT: %8 = affine_apply #map{{[0-9]+}}([[L1]]) + // UNROLL-BY-4-NEXT: %8 = affine.apply #map{{[0-9]+}}([[L1]]) // UNROLL-BY-4-NEXT: %9 = "addi32"(%8, %8) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %10 = "addi32"(%9, %9) : (i32, i32) -> i32 // UNROLL-BY-4-NEXT: } @@ -385,13 +385,13 @@ func @unroll_non_unit_stride_cleanup() { // UNROLL-BY-4: for [[L1:%i[0-9]+]] = 2 to 37 step 20 { // UNROLL-BY-4-NEXT: %0 = "addi32"([[L1]], [[L1]]) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %1 = "addi32"(%0, %0) : (i32, i32) -> i32 - // UNROLL-BY-4-NEXT: %2 = affine_apply #map{{[0-9]+}}([[L1]]) + // UNROLL-BY-4-NEXT: %2 = affine.apply #map{{[0-9]+}}([[L1]]) // UNROLL-BY-4-NEXT: %3 = "addi32"(%2, %2) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %4 = "addi32"(%3, %3) : (i32, i32) -> i32 - // UNROLL-BY-4-NEXT: %5 = affine_apply #map{{[0-9]+}}([[L1]]) + // UNROLL-BY-4-NEXT: %5 = affine.apply #map{{[0-9]+}}([[L1]]) // UNROLL-BY-4-NEXT: %6 = "addi32"(%5, %5) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %7 = "addi32"(%6, %6) : (i32, i32) -> i32 - // UNROLL-BY-4-NEXT: %8 = affine_apply #map{{[0-9]+}}([[L1]]) + // UNROLL-BY-4-NEXT: %8 = affine.apply #map{{[0-9]+}}([[L1]]) // UNROLL-BY-4-NEXT: %9 = "addi32"(%8, %8) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %10 = "addi32"(%9, %9) : (i32, i32) -> i32 // UNROLL-BY-4-NEXT: } @@ -414,11 +414,11 @@ func @loop_nest_single_iteration_after_unroll(%N: index) { // UNROLL-BY-4: for %i0 = 0 to %arg0 { for %i = 0 to %N { // UNROLL-BY-4: %0 = "addi32"(%c0, %c0) : (index, index) -> i32 - // UNROLL-BY-4-NEXT: %1 = affine_apply [[MAP0]](%c0) + // UNROLL-BY-4-NEXT: %1 = affine.apply [[MAP0]](%c0) // UNROLL-BY-4-NEXT: %2 = "addi32"(%1, %1) : (index, index) -> i32 - // UNROLL-BY-4-NEXT: %3 = affine_apply [[MAP1]](%c0) + // UNROLL-BY-4-NEXT: %3 = affine.apply [[MAP1]](%c0) // UNROLL-BY-4-NEXT: %4 = "addi32"(%3, %3) : (index, index) -> i32 - // UNROLL-BY-4-NEXT: %5 = affine_apply [[MAP2]](%c0) + // UNROLL-BY-4-NEXT: %5 = affine.apply [[MAP2]](%c0) // UNROLL-BY-4-NEXT: %6 = "addi32"(%5, %5) : (index, index) -> i32 // UNROLL-BY-4-NEXT: %7 = "addi32"(%c4, %c4) : (index, index) -> i32 // UNROLL-BY-4-NOT: for diff --git a/mlir/utils/vim/mlir.vim b/mlir/utils/vim/mlir.vim index e220ca7a1da..27526c6c54d 100644 --- a/mlir/utils/vim/mlir.vim +++ b/mlir/utils/vim/mlir.vim @@ -12,7 +12,7 @@ syn keyword mlirType memref tensor vector syntax keyword mlirKeywords extfunc cfgfunc mlfunc for to step return syntax keyword mlirConditional if else -syntax keyword mlirCoreOps dim addf addi subf subi mulf muli cmpi select constant affine_apply call call_indirect extract_element getTensor memref_cast tensor_cast load store alloc dealloc dma_start dma_wait +syntax keyword mlirCoreOps dim addf addi subf subi mulf muli cmpi select constant affine.apply call call_indirect extract_element getTensor memref_cast tensor_cast load store alloc dealloc dma_start dma_wait syn match mlirInt "-\=\<\d\+\>" syn match mlirFloat "-\=\<\d\+\.\d\+\>" |

