Skip to content

Commit c8551ce

Browse files
the result of a Pure operation that its operands are the valid symbolic identifiers.
1 parent 7e5a95b commit c8551ce

File tree

15 files changed

+54
-139
lines changed

15 files changed

+54
-139
lines changed

mlir/docs/Dialects/Affine.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,8 @@ immediately enclosed by the latter),
6969
3. a value that dominates the `AffineScope` op enclosing the value's
7070
use,
7171
4. the result of a constant operation,
72-
5. the result of an op with [`AffineSymbol`](Traits.md#AffineSymbol) trait,
73-
6. the result of an
74-
[`affine.apply` operation](#affineapply-mliraffineapplyop) that recursively takes as
75-
arguments any valid symbolic identifiers, or
76-
7. the result of a
72+
5. the result of a `Pure` operation that its operands are the valid symbolic identifiers.
73+
6. the result of a
7774
[`dim` operation](MemRef.md/#memrefdim-mlirmemrefdimop) on either a memref that
7875
is an argument to a `AffineScope` op or a memref where the corresponding
7976
dimension is either static or a dynamic one in turn bound to a valid symbol.

mlir/docs/Traits/_index.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,6 @@ affine.load, and affine.store. The polyhedral scope defined by an operation with
223223
this trait includes all operations in its region excluding operations that are
224224
nested inside of other operations that themselves have this trait.
225225

226-
* `OpTrait::AffineSymbol` -- `AffineSymbol`
227-
228-
This trait will make the results of the operation that holds it become valid symbols.
229-
It complements the AffineScope trait, allowing SSA values in the region of operation
230-
to be used as operands for various Affine dialect operations depending on the AffineScope
231-
trait, without altering the properties of the operation. In contrast, the AffineSymbol
232-
trait directly changes the properties of the operations. Additionally, the AffineScope
233-
trait cannot make SSA values in the nested region of operations valid symbols, operations
234-
can hold the AffineSymbol trait, then their results whill be vaild symbols.
235-
236226
### AutomaticAllocationScope
237227

238228
* `OpTrait::AutomaticAllocationScope` -- `AutomaticAllocationScope`

mlir/include/mlir/Dialect/GPU/IR/GPUOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def GPU_GridDimOp : GPU_IndexOp<"grid_dim"> {
223223
There is an implicit upper bound of `kMaxDim` (currently uint32_t::max).
224224
}];
225225
}
226-
def GPU_ThreadIdOp : GPU_IndexOp<"thread_id", [AffineSymbol]> {
226+
def GPU_ThreadIdOp : GPU_IndexOp<"thread_id"> {
227227
let description = [{
228228
Returns the thread id, i.e. the index of the current thread within the block
229229
along the x, y, or z `dimension`.

mlir/include/mlir/IR/OpBase.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ class PredOpTrait<string descr, Pred pred, list<Trait> traits = []>
6363

6464
// Op defines an affine scope.
6565
def AffineScope : NativeOpTrait<"AffineScope">;
66-
// Op defines an affine symbol.
67-
def AffineSymbol : NativeOpTrait<"AffineSymbol">;
6866
// Op defines an automatic allocation scope.
6967
def AutomaticAllocationScope :
7068
NativeOpTrait<"AutomaticAllocationScope">;

mlir/include/mlir/IR/OpDefinition.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ LogicalResult verifyResultSizeAttr(Operation *op, StringRef sizeAttrName);
365365
LogicalResult verifyNoRegionArguments(Operation *op);
366366
LogicalResult verifyElementwise(Operation *op);
367367
LogicalResult verifyIsIsolatedFromAbove(Operation *op);
368-
LogicalResult verifyIndexResultType(Operation *op);
369368
} // namespace impl
370369

371370
/// Helper class for implementing traits. Clients are not expected to interact
@@ -1269,18 +1268,6 @@ class AffineScope : public TraitBase<ConcreteType, AffineScope> {
12691268
}
12701269
};
12711270

1272-
/// A trait of operation. The results of an operation with the AffineSymbol
1273-
/// trait can be used as symbols for the purposes for affine dialect purposes.
1274-
/// This trait will make the results of the operation that holds it become valid
1275-
/// symbols. For more details, see `Traits.md#AffineSymbol`.
1276-
template <typename ConcreteType>
1277-
class AffineSymbol : public TraitBase<ConcreteType, AffineSymbol> {
1278-
public:
1279-
static LogicalResult verifyTrait(Operation *op) {
1280-
return impl::verifyIndexResultType(op);
1281-
}
1282-
};
1283-
12841271
/// A trait of region holding operations that define a new scope for automatic
12851272
/// allocations, i.e., allocations that are freed when control is transferred
12861273
/// back from the operation's region. Any operations performing such allocations

mlir/lib/Dialect/Affine/IR/AffineOps.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ bool mlir::affine::isValidSymbol(Value value) {
410410
/// A value can be used as a symbol for `region` iff it meets one of the
411411
/// following conditions:
412412
/// *) It is a constant.
413-
/// *) It is a result, its defineOp is holded by `AffineSymbol` Trait.
414-
/// *) It is the result of an affine apply operation with symbol arguments.
413+
/// *) It is a result of a `Pure` operation that its operands are the valid
414+
/// *) symbolic identifiers.
415415
/// *) It is a result of the dim op on a memref whose corresponding size is
416416
/// a valid symbol.
417417
/// *) It is defined at the top level of 'region' or is its argument.
@@ -444,13 +444,15 @@ bool mlir::affine::isValidSymbol(Value value, Region *region) {
444444
if (matchPattern(defOp, m_Constant(&operandCst)))
445445
return true;
446446

447-
// AffineSymbol Op.
448-
if (defOp->hasTrait<OpTrait::AffineSymbol>())
449-
return true;
450-
451-
// Affine apply operation is ok if all of its operands are ok.
452-
if (auto applyOp = dyn_cast<AffineApplyOp>(defOp))
453-
return applyOp.isValidSymbol(region);
447+
// `Pure` operation that its operands are the valid symbolic identifiers.
448+
if (isPure(defOp)) {
449+
bool operandVaildSymbol =
450+
llvm::all_of(defOp->getOperands(), [&](Value operand) {
451+
return affine::isValidSymbol(operand, region);
452+
});
453+
if (operandVaildSymbol)
454+
return true;
455+
}
454456

455457
// Dim op results could be valid symbols at any level.
456458
if (auto dimOp = dyn_cast<ShapedDimOpInterface>(defOp))

mlir/lib/IR/Operation.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,21 +1390,6 @@ LogicalResult OpTrait::impl::verifyIsIsolatedFromAbove(Operation *isolatedOp) {
13901390
return success();
13911391
}
13921392

1393-
LogicalResult OpTrait::impl::verifyIndexResultType(Operation *op) {
1394-
ResultRange results = op->getResults();
1395-
if (results.empty()) {
1396-
op->emitError("operation must have at least one result");
1397-
return failure();
1398-
}
1399-
for (OpResult result : results) {
1400-
if (!mlir::isa<IndexType>(result.getType())) {
1401-
op->emitError("operation's result type should be index");
1402-
return failure();
1403-
}
1404-
}
1405-
return success();
1406-
}
1407-
14081393
bool OpTrait::hasElementwiseMappableTraits(Operation *op) {
14091394
return op->hasTrait<Elementwise>() && op->hasTrait<Scalarizable>() &&
14101395
op->hasTrait<Vectorizable>() && op->hasTrait<Tensorizable>();

mlir/test/Dialect/Affine/SuperVectorize/vectorize_reduction.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,13 +638,13 @@ func.func @vecdim_reduction_complex_ub(%in: memref<256x512xf32>, %out: memref<25
638638
return
639639
}
640640

641-
// CHECK: #[[$map3:.*]] = affine_map<([[d0:.*]], [[d1:.*]]) -> ([[d0]], [[d1]] * 2)>
642-
// CHECK: #[[$map3_sub:.*]] = affine_map<([[d0:.*]], [[d1:.*]]) -> ([[d0]] - [[d1]])>
641+
// CHECK: #[[$map3:.*]] = affine_map<(d0, d1) -> (d0, d1 * 2)>
642+
// CHECK: #[[$map3_sub:.*]] = affine_map<(d0)[s0] -> (-d0 + s0)>
643643
// CHECK-LABEL: @vecdim_reduction_complex_ub
644644
// CHECK: %[[vzero:.*]] = arith.constant dense<0.000000e+00> : vector<128xf32>
645645
// CHECK: %{{.*}} = affine.for %[[iv:.*]] = 0 to min #[[$map3]](%[[M:.*]], %[[N:.*]]) step 128 iter_args(%[[red_iter:.*]] = {{.*}}) -> (vector<128xf32>) {
646646
// CHECK: %[[ub:.*]] = affine.min #[[$map3]](%[[M]], %[[N]])
647-
// CHECK: %[[elems_left:.*]] = affine.apply #[[$map3_sub]](%[[ub]], %[[iv]])
647+
// CHECK: %[[elems_left:.*]] = affine.apply #[[$map3_sub]](%[[iv]])[%[[ub]]]
648648
// CHECK: %[[mask:.*]] = vector.create_mask %[[elems_left]] : vector<128xi1>
649649
// CHECK: %[[ld:.*]] = vector.transfer_read %{{.*}} : memref<256x512xf32>, vector<128xf32>
650650
// CHECK: %[[select:.*]] = arith.select %[[mask]], %[[ld]], %[[vzero]] : vector<128xi1>, vector<128xf32>

mlir/test/Dialect/Affine/invalid.mlir

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,6 @@ func.func @affine_apply_resul_non_index(%arg0 : index) {
2020
return
2121
}
2222

23-
// -----
24-
25-
#map = affine_map<(d0)[s0] -> (d0 + s0)>
26-
27-
func.func @affine_for_lower_bound_invalid_dim(%arg : index) {
28-
affine.for %n0 = 0 to 7 {
29-
%dim = arith.addi %arg, %arg : index
30-
31-
// expected-error@+1 {{operand cannot be used as a dimension id}}
32-
affine.for %n1 = 0 to #map(%dim)[%arg] {
33-
}
34-
}
35-
return
36-
}
37-
38-
// -----
39-
40-
#map = affine_map<(d0)[s0] -> (d0 + s0)>
41-
42-
func.func @affine_for_upper_bound_invalid_dim(%arg : index) {
43-
affine.for %n0 = 0 to 7 {
44-
%dim = arith.addi %arg, %arg : index
45-
46-
// expected-error@+1 {{operand cannot be used as a dimension id}}
47-
affine.for %n1 = #map(%dim)[%arg] to 7 {
48-
}
49-
}
50-
return
51-
}
52-
5323
// -----
5424
func.func @affine_load_invalid_dim(%M : memref<10xi32>) {
5525
"unknown"() ({
@@ -93,20 +63,6 @@ func.func @affine_for_upper_bound_invalid_sym() {
9363

9464
#set0 = affine_set<(i)[N] : (i >= 0, N - i >= 0)>
9565

96-
func.func @affine_if_invalid_dim(%arg : index) {
97-
affine.for %n0 = 0 to 7 {
98-
%dim = arith.addi %arg, %arg : index
99-
100-
// expected-error@+1 {{operand cannot be used as a dimension id}}
101-
affine.if #set0(%dim)[%n0] {}
102-
}
103-
return
104-
}
105-
106-
// -----
107-
108-
#set0 = affine_set<(i)[N] : (i >= 0, N - i >= 0)>
109-
11066
func.func @affine_if_invalid_sym() {
11167
affine.for %i0 = 0 to 7 {
11268
// expected-error@+1 {{operand cannot be used as a symbol}}

mlir/test/Dialect/GPU/transform-gpu.mlir

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,9 @@ module attributes {transform.with_named_sequence} {
545545
!type = memref<2 x 32 x f32>
546546
!type1d = memref<32 x f32>
547547

548-
// CHECK-DAG: #[[$MAPBLIN:.*]] = affine_map<(d0, d1, d2) -> (d0 + d1 * 12 + d2 * 108)>
549-
// CHECK-DAG: #[[$MAPBX:.*]] = affine_map<(d0, d1, d2) -> ((d0 + d1 * 12 + d2 * 108) mod 7)>
550-
// CHECK-DAG: #[[$MAPBY:.*]] = affine_map<(d0, d1, d2) -> ((d0 + d1 * 12 + d2 * 108) floordiv 7)>
548+
// CHECK-DAG: #[[$MAPBLIN:.*]] = affine_map<()[s0, s1, s2] -> (s0 + s1 * 12 + s2 * 108)>
549+
// CHECK-DAG: #[[$MAPBX:.*]] = affine_map<()[s0, s1, s2] -> ((s0 + s1 * 12 + s2 * 108) mod 7)>
550+
// CHECK-DAG: #[[$MAPBY:.*]] = affine_map<()[s0, s1, s2] -> ((s0 + s1 * 12 + s2 * 108) floordiv 7)>
551551

552552
// CHECK-LABEL: func.func @block_linear_existing_launch(
553553
// CHECK-SAME: %[[ARGX:[0-9a-z]+]]: memref<2x32xf32>
@@ -566,9 +566,9 @@ func.func @block_linear_existing_launch(
566566
// CHECK-DAG: %[[BIDX:.*]] = gpu.block_id x
567567
// CHECK-DAG: %[[BIDY:.*]] = gpu.block_id y
568568
// CHECK-DAG: %[[BIDZ:.*]] = gpu.block_id z
569-
// CHECK-DAG: %[[BIDLIN:.*]] = affine.apply #[[$MAPBLIN]](%[[BIDX]], %[[BIDY]], %[[BIDZ]])
570-
// CHECK-DAG: %[[BLX:.*]] = affine.apply #[[$MAPBX]](%[[BIDX]], %[[BIDY]], %[[BIDZ]])
571-
// CHECK-DAG: %[[BLY:.*]] = affine.apply #[[$MAPBY]](%[[BIDX]], %[[BIDY]], %[[BIDZ]])
569+
// CHECK-DAG: %[[BIDLIN:.*]] = affine.apply #[[$MAPBLIN]]()[%[[BIDX]], %[[BIDY]], %[[BIDZ]]]
570+
// CHECK-DAG: %[[BLX:.*]] = affine.apply #[[$MAPBX]]()[%[[BIDX]], %[[BIDY]], %[[BIDZ]]]
571+
// CHECK-DAG: %[[BLY:.*]] = affine.apply #[[$MAPBY]]()[%[[BIDX]], %[[BIDY]], %[[BIDZ]]]
572572
// CHECK-DAG: %[[CMPLIN:.*]] = arith.cmpi ult, %[[BIDLIN]], %[[C63]] : index
573573
// CHECK: scf.if %[[CMPLIN]]
574574
// CHECK: memref.load %[[ARGX]][%[[BLX]], %[[BLY]]]
@@ -600,8 +600,8 @@ module attributes {transform.with_named_sequence} {
600600
!type = memref<2 x 32 x f32>
601601
!type1d = memref<32 x f32>
602602

603-
// CHECK-DAG: #[[$MAPBX:.*]] = affine_map<(d0) -> (d0 mod 7)>
604-
// CHECK-DAG: #[[$MAPBY:.*]] = affine_map<(d0, d1, d2) -> (d1 + d2 * 9 + d0 floordiv 7)>
603+
// CHECK-DAG: #[[$MAPBX:.*]] = affine_map<()[s0] -> (s0 mod 7)>
604+
// CHECK-DAG: #[[$MAPBY:.*]] = affine_map<()[s0, s1, s2] -> (s1 + s2 * 9 + s0 floordiv 7)>
605605

606606
// CHECK-LABEL: func.func @block_linear_generate_launch(
607607
// CHECK-SAME: %[[ARGX:[0-9a-z]+]]: memref<2x32xf32>
@@ -620,8 +620,8 @@ func.func @block_linear_generate_launch(
620620
// CHECK-DAG: %[[BIDX:.*]] = gpu.block_id x
621621
// CHECK-DAG: %[[BIDY:.*]] = gpu.block_id y
622622
// CHECK-DAG: %[[BIDZ:.*]] = gpu.block_id z
623-
// CHECK-DAG: %[[BLX:.*]] = affine.apply #[[$MAPBX]](%[[BIDX]])
624-
// CHECK-DAG: %[[BLY:.*]] = affine.apply #[[$MAPBY]](%[[BIDX]], %[[BIDY]], %[[BIDZ]])
623+
// CHECK-DAG: %[[BLX:.*]] = affine.apply #[[$MAPBX]]()[%[[BIDX]]]
624+
// CHECK-DAG: %[[BLY:.*]] = affine.apply #[[$MAPBY]]()[%[[BIDX]], %[[BIDY]], %[[BIDZ]]]
625625
// CHECK: memref.load %[[ARGX]][%[[BLX]], %[[BLY]]]
626626
// CHECK: memref.load %[[ARGY]][%[[BLX]], %[[BLY]]]
627627
scf.forall (%i, %j) in (%c7, %c9) {
@@ -647,7 +647,7 @@ module attributes {transform.with_named_sequence} {
647647
#map = affine_map<(d0) -> (d0 * 128)>
648648
#map1 = affine_map<(d0) -> (d0 * 32)>
649649

650-
// CHECK-DAG: #[[$MAPB:.*]] = affine_map<(d0) -> (d0 * 128)>
650+
// CHECK-DAG: #[[$MAPB:.*]] = affine_map<()[s0] -> (s0 * 128)>
651651
// CHECK-DAG: #[[$MAPW:.*]] = affine_map<()[s0, s1, s2] -> (s2 * 32 + ((s0 + s1 * 4) floordiv 32) * 32)>
652652

653653
// CHECK-LABEL: func.func @simple_fill(
@@ -660,7 +660,7 @@ func.func @simple_fill(%arg0: memref<128xf32>) -> memref<128xf32> {
660660
// CHECK: gpu.launch
661661
scf.forall (%arg1) in (1) {
662662
// CHECK: %[[BIDX:.*]] = gpu.block_id x
663-
// CHECK: %[[BLX:.*]] = affine.apply #[[$MAPB]](%[[BIDX]])
663+
// CHECK: %[[BLX:.*]] = affine.apply #[[$MAPB]]()[%[[BIDX]]]
664664
%0 = affine.apply #map(%arg1)
665665
%subview = memref.subview %arg0[%0] [128] [1] : memref<128xf32> to memref<128xf32, strided<[1], offset: ?>>
666666
scf.forall (%arg2) in (4) {

mlir/test/Dialect/Linalg/convert-conv2d-to-img2col.mlir

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ module attributes {transform.with_named_sequence} {
4040
// CHECK: %[[KINDEX:.+]] = linalg.index 2 : index
4141

4242
// Compute input channel/convolved indices.
43-
// CHECK: %[[ICINDEX:.+]] = affine.apply affine_map<(d0) -> (d0 mod 4)>(%[[KINDEX]])
44-
// CHECK: %[[CONVH:.+]] = affine.apply affine_map<(d0, d1) -> (d0 floordiv 14 + d1 floordiv 12)>(%[[MINDEX]], %[[KINDEX]])
45-
// CHECK: %[[CONVW:.+]] = affine.apply affine_map<(d0, d1) -> (d0 mod 14 + (d1 mod 12) floordiv 4)>(%[[MINDEX]], %[[KINDEX]])
43+
// CHECK: %[[ICINDEX:.+]] = affine.apply affine_map<()[s0] -> (s0 mod 4)>()[%[[KINDEX]]]
44+
// CHECK: %[[CONVH:.+]] = affine.apply affine_map<()[s0, s1] -> (s0 floordiv 14 + s1 floordiv 12)>()[%[[MINDEX]], %[[KINDEX]]]
45+
// CHECK: %[[CONVW:.+]] = affine.apply affine_map<()[s0, s1] -> (s0 mod 14 + (s1 mod 12) floordiv 4)>()[%[[MINDEX]], %[[KINDEX]]]
4646

4747
// Extract from the input tensor.
4848
// CHECK: %[[EXTRACTED_INPUT:.+]] = tensor.extract
@@ -227,9 +227,9 @@ module attributes {transform.with_named_sequence} {
227227
// CHECK-DAG: #[[MAP:.+]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
228228

229229
// Im2col maps
230-
// CHECK-DAG: #[[MAP1:.+]] = affine_map<(d0) -> (d0 floordiv 9)>
231-
// CHECK-DAG: #[[MAP7:.+]] = affine_map<(d0, d1) -> (d0 floordiv 14 + (d1 mod 9) floordiv 3)>
232-
// CHECK-DAG: #[[MAP8:.+]] = affine_map<(d0, d1) -> (d0 + d1 - (d0 floordiv 14) * 14 - (d1 floordiv 3) * 3)>
230+
// CHECK-DAG: #[[MAP1:.+]] = affine_map<()[s0] -> (s0 floordiv 9)>
231+
// CHECK-DAG: #[[MAP7:.+]] = affine_map<()[s0, s1] -> (s0 floordiv 14 + (s1 mod 9) floordiv 3)>
232+
// CHECK-DAG: #[[MAP8:.+]] = affine_map<()[s0, s1] -> (s0 + s1 - (s0 floordiv 14) * 14 - (s1 floordiv 3) * 3)>
233233

234234

235235
// CHECK-DAG: #[[LHSMAP:.+]] = affine_map<(d0, d1, d2, d3) -> (d1, d3)>
@@ -251,9 +251,9 @@ module attributes {transform.with_named_sequence} {
251251
// CHECK: %[[NINDEX:.+]] = linalg.index 2 : index
252252

253253
// Compute input channel/convolved indices.
254-
// CHECK: %[[ICINDEX:.+]] = affine.apply #[[MAP1]](%[[KINDEX]])
255-
// CHECK: %[[CONVH:.+]] = affine.apply #[[MAP7]](%[[NINDEX]], %[[KINDEX]])
256-
// CHECK: %[[CONVW:.+]] = affine.apply #[[MAP8]](%[[NINDEX]], %[[KINDEX]])
254+
// CHECK: %[[ICINDEX:.+]] = affine.apply #[[MAP1]]()[%[[KINDEX]]]
255+
// CHECK: %[[CONVH:.+]] = affine.apply #[[MAP7]]()[%[[NINDEX]], %[[KINDEX]]]
256+
// CHECK: %[[CONVW:.+]] = affine.apply #[[MAP8]]()[%[[NINDEX]], %[[KINDEX]]]
257257

258258
// Extract from the input tensor.
259259
// CHECK: %[[EXTRACTED_INPUT:.+]] = tensor.extract
@@ -300,9 +300,9 @@ module attributes {transform.with_named_sequence} {
300300
// CHECK: %[[KINDEX:.+]] = linalg.index 2 : index
301301

302302
// Compute input channel/convolved indices.
303-
// CHECK: %[[ICINDEX:.+]] = affine.apply affine_map<(d0) -> (d0 mod 4)>(%[[KINDEX]])
304-
// CHECK: %[[CONVH:.+]] = affine.apply affine_map<(d0, d1) -> (d0 floordiv 14 + d1 floordiv 12)>(%[[MINDEX]], %[[KINDEX]])
305-
// CHECK: %[[CONVW:.+]] = affine.apply affine_map<(d0, d1) -> (d0 mod 14 + (d1 mod 12) floordiv 4)>(%[[MINDEX]], %[[KINDEX]])
303+
// CHECK: %[[ICINDEX:.+]] = affine.apply affine_map<()[s0] -> (s0 mod 4)>()[%[[KINDEX]]]
304+
// CHECK: %[[CONVH:.+]] = affine.apply affine_map<()[s0, s1] -> (s0 floordiv 14 + s1 floordiv 12)>()[%[[MINDEX]], %[[KINDEX]]]
305+
// CHECK: %[[CONVW:.+]] = affine.apply affine_map<()[s0, s1] -> (s0 mod 14 + (s1 mod 12) floordiv 4)>()[%[[MINDEX]], %[[KINDEX]]]
306306

307307
// Extract from the input tensor.
308308
// CHECK: %[[EXTRACTED_INPUT:.+]] = tensor.extract

mlir/test/Dialect/Linalg/tile-indexed.mlir

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ module attributes {transform.with_named_sequence} {
1919
}
2020
}
2121

22-
// TILE-10n25-DAG: [[$MAP:#[a-zA-Z0-9_]*]] = affine_map<(d0, d1) -> (d0 + d1)>
22+
// TILE-10n25-DAG: [[$MAP:#[a-zA-Z0-9_]*]] = affine_map<(d0)[s0] -> (d0 + s0)>
2323
// TILE-10n25-LABEL: func @indexed_vector
2424
// TILE-10n25: %[[C10:.*]] = arith.constant 10 : index
2525
// TILE-10n25: scf.for %[[J:.*]] = {{.*}} step %[[C10]]
2626
// TILE-10n25: linalg.generic
2727
// TILE-10n25: %[[I:.*]] = linalg.index 0 : index
28-
// TILE-10n25: %[[NEW_I:.*]] = affine.apply [[$MAP]](%[[I]], %[[J]])
28+
// TILE-10n25: %[[NEW_I:.*]] = affine.apply [[$MAP]](%[[J]])[%[[I]]]
2929
// TILE-10n25: linalg.yield %[[NEW_I]] : index
3030

3131
// -----
@@ -51,16 +51,16 @@ module attributes {transform.with_named_sequence} {
5151
}
5252
}
5353

54-
// TILE-10n25-DAG: [[$MAP:#[a-zA-Z0-9_]*]] = affine_map<(d0, d1) -> (d0 + d1)>
54+
// TILE-10n25-DAG: [[$MAP:#[a-zA-Z0-9_]*]] = affine_map<(d0)[s0] -> (d0 + s0)>
5555
// TILE-10n25-LABEL: func @indexed_matrix
5656
// TILE-10n25-DAG: %[[C25:.*]] = arith.constant 25 : index
5757
// TILE-10n25-DAG: %[[C10:.*]] = arith.constant 10 : index
5858
// TILE-10n25: scf.for %[[K:.*]] = {{.*}} step %[[C10]]
5959
// TILE-10n25: scf.for %[[L:.*]] = {{.*}} step %[[C25]]
6060
// TILE-10n25: linalg.generic
6161
// TILE-10n25: %[[I:.*]] = linalg.index 0 : index
62-
// TILE-10n25: %[[NEW_I:.*]] = affine.apply [[$MAP]](%[[I]], %[[K]])
62+
// TILE-10n25: %[[NEW_I:.*]] = affine.apply [[$MAP]](%[[K]])[%[[I]]]
6363
// TILE-10n25: %[[J:.*]] = linalg.index 1 : index
64-
// TILE-10n25: %[[NEW_J:.*]] = affine.apply [[$MAP]](%[[J]], %[[L]])
64+
// TILE-10n25: %[[NEW_J:.*]] = affine.apply [[$MAP]](%[[L]])[%[[J]]]
6565
// TILE-10n25: %[[SUM:.*]] = arith.addi %[[NEW_I]], %[[NEW_J]] : index
6666
// TILE-10n25: linalg.yield %[[SUM]] : index

mlir/test/Dialect/Linalg/transform-op-split.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module attributes {transform.with_named_sequence} {
1010

1111
func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32
1212

13-
// CHECK: #[[$ADD_42_MAP:.+]] = affine_map<(d0) -> (d0 + 42)>
13+
// CHECK: #[[$ADD_42_MAP:.+]] = affine_map<()[s0] -> (s0 + 42)>
1414

1515
// CHECK-LABEL: @one_d_static
1616
// CHECK-SAME: %[[IN:.+]]: tensor<100xf32>, %[[OUT:.+]]: tensor<100xf32>
@@ -30,7 +30,7 @@ func.func @one_d_static(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tenso
3030
// CHECK: ins(%[[IN_SLICE_HIGH]]
3131
// CHECK: outs(%[[OUT_SLICE_HIGH]]
3232
// CHECK: %[[IDX:.+]] = linalg.index 0
33-
// CHECK: affine.apply #[[$ADD_42_MAP]](%[[IDX]])
33+
// CHECK: affine.apply #[[$ADD_42_MAP]]()[%[[IDX]]]
3434
// CHECK: func.call @elem
3535
// CHECK: %[[RES:.+]] = tensor.insert_slice %[[RES_SLICE_HIGH]] into %[[RES_PARTIAL]][42] [58] [1]
3636
%0 = linalg.generic {

mlir/test/Interfaces/TilingInterface/tile-using-interface.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ module attributes {transform.with_named_sequence} {
259259
transform.yield
260260
}
261261
}
262-
// CHECK: #[[$MAP_ADD:.+]] = affine_map<(d0, d1) -> (d0 + d1)>
262+
// CHECK: #[[$MAP_ADD:.+]] = affine_map<(d0)[s0] -> (d0 + s0)>
263263
// CHECK-LABEL: @indexed_semantics
264264
// CHECK: scf.for %[[I0:.+]] = %{{.*}} to %{{.*}} step %{{.*}}
265265
// CHECK: scf.for %[[I1:.+]] = %{{.*}} to %{{.*}} step %{{.*}}
266266
// CHECK: %[[INDEX0:.+]] = linalg.index 0
267-
// CHECK: %[[INDEX0_AMENDED:.+]] = affine.apply #[[$MAP_ADD]](%[[INDEX0]], %[[I0]])
267+
// CHECK: %[[INDEX0_AMENDED:.+]] = affine.apply #[[$MAP_ADD]](%[[I0]])[%[[INDEX0]]]
268268
// CHECK: %[[INDEX1:.+]] = linalg.index 1
269-
// CHECK: %[[INDEX1_AMENDED:.+]] = affine.apply #[[$MAP_ADD]](%[[INDEX1]], %[[I1]])
269+
// CHECK: %[[INDEX1_AMENDED:.+]] = affine.apply #[[$MAP_ADD]](%[[I1]])[%[[INDEX1]]]
270270
// CHECK: arith.addi %[[INDEX0_AMENDED]], %[[INDEX1_AMENDED]]
271271

272272
// -----

0 commit comments

Comments
 (0)