Skip to content

Commit ebcc022

Browse files
committed
[mlir][AsmPrinter] Refactor printing to only print aliases for attributes/types that will exist in the output.
This revision refactors the way that attributes/types are considered when generating aliases. Instead of considering all of the attributes/types of every operation, we perform a "fake" print step that prints the operations using a dummy printer to collect the attributes and types that would actually be printed during the real process. This removes a lot of attributes/types from consideration that generally won't end up in the final output, e.g. affine map attributes in an `affine.apply`/`affine.for`. This resolves a long standing TODO w.r.t aliases, and helps to have a much cleaner textual output format. As a datapoint to the latter, as part of this change several tests were identified as testing for the presence of attributes aliases that weren't actually referenced by the custom form of any operation. To ensure that this wouldn't cause a large degradation in compile time due to the second full print, I benchmarked this change on a very large module with a lot of operations(The file is ~673M/~4.7 million lines long). This file before this change take ~6.9 seconds to print in the custom form, and ~7 seconds after this change. In the custom assembly case, this added an average of a little over ~100 miliseconds to the compile time. This increase was due to the way that argument attributes on functions are structured and how they get printed; i.e. with a better representation the negative impact here can be greatly decreased. When printing in the generic form, this revision had no observable impact on the compile time. This benchmarking leads me to believe that the impact of this change on compile time w.r.t printing is closely related to `print` methods that perform a lot of additional/complex processing outside of the OpAsmPrinter. Differential Revision: https://reviews.llvm.org/D90512
1 parent 6022a8b commit ebcc022

28 files changed

+284
-215
lines changed

mlir/lib/IR/AsmPrinter.cpp

Lines changed: 232 additions & 99 deletions
Large diffs are not rendered by default.

mlir/test/Conversion/LinalgToVector/linalg-to-vector.mlir

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// CHECK-DAG: #[[$map2:.*]] = affine_map<(d0, d1) -> (d0 + d1)>
66
// CHECK-DAG: #[[$map3:.*]] = affine_map<(d0, d1)[s0] -> (3, -d0 - d1 + s0)>
77
// CHECK-DAG: #[[$map4:.*]] = affine_map<(d0)[s0] -> (3, -d0 + s0)>
8-
// CHECK-DAG: #[[$map5:.*]] = affine_map<(d0) -> (d0)>
98

109
func @conv_1d(%arg0: memref<?xf32>, %arg1: memref<?xf32>, %arg2: memref<?xf32>) {
1110
linalg.conv_1d ins(%arg0, %arg1 : memref<?xf32>, memref<?xf32>)

mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func @materialize_read_1d_partially_specialized(%dyn1 : index, %dyn2 : index, %d
5454

5555
// -----
5656

57-
// CHECK: #[[$ADD:map[0-9]+]] = affine_map<(d0, d1) -> (d0 + d1)>
57+
// CHECK: #[[$ADD:map.*]] = affine_map<(d0, d1) -> (d0 + d1)>
5858

5959
// CHECK-LABEL: func @materialize_read(%{{.*}}: index, %{{.*}}: index, %{{.*}}: index, %{{.*}}: index) {
6060
func @materialize_read(%M: index, %N: index, %O: index, %P: index) {
@@ -113,7 +113,7 @@ func @materialize_read(%M: index, %N: index, %O: index, %P: index) {
113113

114114
// -----
115115

116-
// CHECK: #[[$ADD:map[0-9]+]] = affine_map<(d0, d1) -> (d0 + d1)>
116+
// CHECK: #[[$ADD:map.*]] = affine_map<(d0, d1) -> (d0 + d1)>
117117

118118
// CHECK-LABEL:func @materialize_write(%{{.*}}: index, %{{.*}}: index, %{{.*}}: index, %{{.*}}: index) {
119119
func @materialize_write(%M: index, %N: index, %O: index, %P: index) {
@@ -174,9 +174,7 @@ func @materialize_write(%M: index, %N: index, %O: index, %P: index) {
174174
// -----
175175

176176
// CHECK-DAG: #[[$MAP0:.*]] = affine_map<(d0)[s0] -> (d0 + s0)>
177-
// CHECK-DAG: #[[$MAP1:.*]] = affine_map<(d0, d1) -> (d1)>
178177

179-
// FULL-UNROLL-DAG: #[[$MAP0:.*]] = affine_map<(d0, d1) -> (d1)>
180178
// FULL-UNROLL-DAG: #[[$MAP1:.*]] = affine_map<()[s0] -> (s0 + 1)>
181179
// FULL-UNROLL-DAG: #[[$MAP2:.*]] = affine_map<()[s0] -> (s0 + 2)>
182180

@@ -253,9 +251,7 @@ func @transfer_read_progressive(%A : memref<?x?xf32>, %base: index) -> vector<3x
253251
// -----
254252

255253
// CHECK-DAG: #[[$MAP0:.*]] = affine_map<(d0)[s0] -> (d0 + s0)>
256-
// CHECK-DAG: #[[$MAP1:.*]] = affine_map<(d0, d1) -> (d1)>
257254

258-
// FULL-UNROLL-DAG: #[[$MAP0:.*]] = affine_map<(d0, d1) -> (d1)>
259255
// FULL-UNROLL-DAG: #[[$MAP1:.*]] = affine_map<()[s0] -> (s0 + 1)>
260256
// FULL-UNROLL-DAG: #[[$MAP2:.*]] = affine_map<()[s0] -> (s0 + 2)>
261257

@@ -309,9 +305,7 @@ func @transfer_write_progressive(%A : memref<?x?xf32>, %base: index, %vec: vecto
309305
// -----
310306

311307
// CHECK-DAG: #[[$MAP0:.*]] = affine_map<(d0)[s0] -> (d0 + s0)>
312-
// CHECK-DAG: #[[$MAP1:.*]] = affine_map<(d0, d1) -> (d1)>
313308

314-
// FULL-UNROLL-DAG: #[[$MAP0:.*]] = affine_map<(d0, d1) -> (d1)>
315309
// FULL-UNROLL-DAG: #[[$MAP1:.*]] = affine_map<()[s0] -> (s0 + 1)>
316310
// FULL-UNROLL-DAG: #[[$MAP2:.*]] = affine_map<()[s0] -> (s0 + 2)>
317311

mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33

44
// Permutation maps used in vectorization.
55
// CHECK-DAG: #[[$map_id1:map[0-9]+]] = affine_map<(d0) -> (d0)>
6-
// CHECK-DAG: #[[$map_id2:map[0-9]+]] = affine_map<(d0, d1) -> (d0, d1)>
76
// CHECK-DAG: #[[$map_proj_d0d1_zerod1:map[0-9]+]] = affine_map<(d0, d1) -> (0, d1)>
87
// CHECK-DAG: #[[$map_proj_d0d1_d0zero:map[0-9]+]] = affine_map<(d0, d1) -> (d0, 0)>
98
// VECT-DAG: #[[$map_id1:map[0-9]+]] = affine_map<(d0) -> (d0)>
10-
// VECT-DAG: #[[$map_id2:map[0-9]+]] = affine_map<(d0, d1) -> (d0, d1)>
119
// VECT-DAG: #[[$map_proj_d0d1_zerod1:map[0-9]+]] = affine_map<(d0, d1) -> (0, d1)>
1210
// VECT-DAG: #[[$map_proj_d0d1_d0zero:map[0-9]+]] = affine_map<(d0, d1) -> (d0, 0)>
1311

mlir/test/Dialect/Affine/SuperVectorize/vectorize_3d.mlir

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// RUN: mlir-opt %s -affine-super-vectorize="virtual-vector-size=32,64,256 test-fastest-varying=2,1,0" | FileCheck %s
22

3-
// Permutation maps used in vectorization.
4-
// CHECK: #[[map_proj_d0d1d2_d0d1d2:map[0-9]+]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
5-
63
func @vec3d(%A : memref<?x?x?xf32>) {
74
%c0 = constant 0 : index
85
%c1 = constant 1 : index

mlir/test/Dialect/Affine/SuperVectorize/vectorize_outer_loop_2d.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: mlir-opt %s -affine-super-vectorize="virtual-vector-size=32,256 test-fastest-varying=2,0" | FileCheck %s
22

33
// Permutation maps used in vectorization.
4-
// CHECK: #[[map_proj_d0d1d2_d0d2:map[0-9]+]] = affine_map<(d0, d1, d2) -> (d0, d2)>
4+
// CHECK: #[[map_proj_d0d1d2_d0d2:map[0-9]*]] = affine_map<(d0, d1, d2) -> (d0, d2)>
55

66
func @vec2d(%A : memref<?x?x?xf32>) {
77
%c0 = constant 0 : index

mlir/test/Dialect/Affine/SuperVectorize/vectorize_outer_loop_transpose_2d.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: mlir-opt %s -affine-super-vectorize="virtual-vector-size=32,256 test-fastest-varying=0,2" | FileCheck %s
22

33
// Permutation maps used in vectorization.
4-
// CHECK: #[[map_proj_d0d1d2_d2d0:map[0-9]+]] = affine_map<(d0, d1, d2) -> (d2, d0)>
4+
// CHECK: #[[map_proj_d0d1d2_d2d0:map[0-9]*]] = affine_map<(d0, d1, d2) -> (d2, d0)>
55

66
func @vec2d(%A : memref<?x?x?xf32>) {
77
%c0 = constant 0 : index

mlir/test/Dialect/Affine/SuperVectorize/vectorize_transpose_2d.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: mlir-opt %s -affine-super-vectorize="virtual-vector-size=32,256 test-fastest-varying=0,1" | FileCheck %s
22

33
// Permutation maps used in vectorization.
4-
// CHECK-DAG: #[[map_proj_d0d1d2_d2d1:map[0-9]+]] = affine_map<(d0, d1, d2) -> (d2, d1)>
4+
// CHECK-DAG: #[[map_proj_d0d1d2_d2d1:map[0-9]*]] = affine_map<(d0, d1, d2) -> (d2, d1)>
55

66
func @vec2d(%A : memref<?x?x?xf32>) {
77
%c0 = constant 0 : index

mlir/test/Dialect/Affine/affine-loop-invariant-code-motion.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func @store_affine_apply() -> memref<10xf32> {
3838
// CHECK: %cst = constant 7.000000e+00 : f32
3939
// CHECK-NEXT: %0 = alloc() : memref<10xf32>
4040
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
41-
// CHECK-NEXT: %1 = affine.apply #map{{[0-9]+}}(%arg0)
41+
// CHECK-NEXT: %1 = affine.apply #map{{[0-9]*}}(%arg0)
4242
// CHECK-NEXT: affine.store %cst, %0[%1] : memref<10xf32>
4343
// CHECK-NEXT: }
4444
// CHECK-NEXT: return %0 : memref<10xf32>
@@ -106,7 +106,7 @@ func @invariant_code_inside_affine_if() {
106106
// CHECK: %0 = alloc() : memref<10xf32>
107107
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
108108
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
109-
// CHECK-NEXT: %1 = affine.apply #map{{[0-9]+}}(%arg0)
109+
// CHECK-NEXT: %1 = affine.apply #map{{[0-9]*}}(%arg0)
110110
// CHECK-NEXT: affine.if #set(%arg0, %1) {
111111
// CHECK-NEXT: %2 = addf %cst, %cst : f32
112112
// CHECK-NEXT: affine.store %2, %0[%arg0] : memref<10xf32>

mlir/test/Dialect/Affine/canonicalize.mlir

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,6 @@ func @canonicalize_bounds(%M : index, %N : index) {
477477

478478
// Compose maps into affine load and store ops.
479479

480-
// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0) -> (d0 + 1)>
481-
482480
// CHECK-LABEL: @compose_into_affine_load_store
483481
func @compose_into_affine_load_store(%A : memref<1024xf32>, %u : index) {
484482
// CHECK: affine.for %[[IV:.*]] = 0 to 1024
@@ -594,7 +592,7 @@ func @rep(%arg0 : index, %arg1 : index) -> index {
594592
}
595593

596594
// -----
597-
// CHECK-DAG: #[[lb:.*]] = affine_map<()[s0] -> (s0)>
595+
598596
// CHECK-DAG: #[[ub:.*]] = affine_map<()[s0] -> (s0 + 2)>
599597

600598
func @drop_duplicate_bounds(%N : index) {

mlir/test/Dialect/Affine/dma-generate.mlir

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212

1313
// -----
1414

15-
// Index of the buffer for the second DMA is remapped.
16-
// CHECK-DAG: [[MAP0:#map[0-9]+]] = affine_map<(d0) -> (d0)>
17-
1815
// CHECK-LABEL: func @loop_nest_1d() {
1916
func @loop_nest_1d() {
2017
%A = alloc() : memref<256 x f32>

mlir/test/Dialect/Affine/dma.mlir

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
// -----
44

5-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1) -> (d0, d1)>
6-
75
// Test with loop IVs.
86
func @test0(%arg0 : index, %arg1 : index) {
97
%0 = alloc() : memref<100x100xf32>
@@ -25,8 +23,6 @@ func @test0(%arg0 : index, %arg1 : index) {
2523

2624
// -----
2725

28-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1) -> (d0, d1)>
29-
3026
// Test with loop IVs and optional stride arguments.
3127
func @test1(%arg0 : index, %arg1 : index) {
3228
%0 = alloc() : memref<100x100xf32>
@@ -50,9 +46,6 @@ func @test1(%arg0 : index, %arg1 : index) {
5046

5147
// -----
5248

53-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1, d2) -> (d0, d1 + d2 + 5)>
54-
// CHECK: [[MAP1:#map[0-9]+]] = affine_map<(d0, d1, d2) -> (d0 + d1, d2)>
55-
5649
// Test with loop IVs and symbols (without symbol keyword).
5750
func @test2(%arg0 : index, %arg1 : index) {
5851
%0 = alloc() : memref<100x100xf32>
@@ -75,10 +68,6 @@ func @test2(%arg0 : index, %arg1 : index) {
7568

7669
// -----
7770

78-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1)[s0] -> (d0, d1 + s0 + 7)>
79-
// CHECK: [[MAP1:#map[0-9]+]] = affine_map<(d0, d1)[s0] -> (d0 + s0, d1)>
80-
// CHECK: [[MAP1:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 + d1 + 11)>
81-
8271
// Test with loop IVs and symbols (with symbol keyword).
8372
func @test3(%arg0 : index, %arg1 : index) {
8473
%0 = alloc() : memref<100x100xf32>
@@ -102,10 +91,6 @@ func @test3(%arg0 : index, %arg1 : index) {
10291

10392
// -----
10493

105-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1)[s0] -> (d0, (d1 + s0) mod 9 + 7)>
106-
// CHECK: [[MAP1:#map[0-9]+]] = affine_map<(d0, d1)[s0] -> ((d0 + s0) floordiv 3, d1)>
107-
// CHECK: [[MAP2:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 + d1 + 11)>
108-
10994
// Test with loop IVs, symbols and constants in nested affine expressions.
11095
func @test4(%arg0 : index, %arg1 : index) {
11196
%0 = alloc() : memref<100x100xf32>

mlir/test/Dialect/Affine/load-store.mlir

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
// -----
44

5-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1) -> (d0, d1)>
6-
75
// Test with just loop IVs.
86
func @test0(%arg0 : index, %arg1 : index) {
97
%0 = alloc() : memref<100x100xf32>
@@ -18,8 +16,6 @@ func @test0(%arg0 : index, %arg1 : index) {
1816

1917
// -----
2018

21-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 + 3, d1 + 7)>
22-
2319
// Test with loop IVs and constants.
2420
func @test1(%arg0 : index, %arg1 : index) {
2521
%0 = alloc() : memref<100x100xf32>
@@ -36,8 +32,6 @@ func @test1(%arg0 : index, %arg1 : index) {
3632

3733
// -----
3834

39-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1, d2, d3) -> (d0 + d1, d2 + d3)>
40-
4135
// Test with loop IVs and function args without 'symbol' keyword (should
4236
// be parsed as dim identifiers).
4337
func @test2(%arg0 : index, %arg1 : index) {
@@ -55,8 +49,6 @@ func @test2(%arg0 : index, %arg1 : index) {
5549

5650
// -----
5751

58-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1)[s0, s1] -> (d0 + s0, d1 + s1)>
59-
6052
// Test with loop IVs and function args with 'symbol' keyword (should
6153
// be parsed as symbol identifiers).
6254
func @test3(%arg0 : index, %arg1 : index) {
@@ -76,8 +68,6 @@ func @test3(%arg0 : index, %arg1 : index) {
7668

7769
// -----
7870

79-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1)[s0, s1] -> ((d0 + s0) floordiv 3 + 11, (d1 + s1) mod 4 + 7)>
80-
8171
// Test with loop IVs, symbols and constants in nested affine expressions.
8272
func @test4(%arg0 : index, %arg1 : index) {
8373
%0 = alloc() : memref<100x100xf32>
@@ -96,8 +86,6 @@ func @test4(%arg0 : index, %arg1 : index) {
9686

9787
// -----
9888

99-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
100-
10189
// Test with swizzled loop IVs.
10290
func @test5(%arg0 : index, %arg1 : index) {
10391
%0 = alloc() : memref<10x10x10xf32>
@@ -116,8 +104,6 @@ func @test5(%arg0 : index, %arg1 : index) {
116104

117105
// -----
118106

119-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1, d2, d3, d4) -> (d0 + d1, d2 + d3, d3 + d1 + d4)>
120-
121107
// Test with swizzled loop IVs, duplicate args, and function args used as dims.
122108
// Dim identifiers are assigned in parse order:
123109
// d0 = %i2, d1 = %arg0, d2 = %i0, d3 = %i1, d4 = %arg1
@@ -140,8 +126,6 @@ func @test6(%arg0 : index, %arg1 : index) {
140126

141127
// -----
142128

143-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1, d2)[s0, s1] -> (d0 + s0, d1 + d2, d2 + s0 + s1)>
144-
145129
// Test with swizzled loop IVs, duplicate args, and function args used as syms.
146130
// Dim and symbol identifiers are assigned in parse order:
147131
// d0 = %i2, d1 = %i0, d2 = %i1
@@ -169,7 +153,7 @@ func @test6(%arg0 : index, %arg1 : index) {
169153

170154
// -----
171155

172-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0) -> (d0 + 1)>
156+
// CHECK: [[MAP0:#map[0-9]*]] = affine_map<(d0) -> (d0 + 1)>
173157

174158
// Test with operands without special SSA name.
175159
func @test7() {
@@ -197,9 +181,6 @@ func @zero_dim(%arg0 : memref<i32>, %arg1 : memref<i32>) {
197181

198182
// -----
199183

200-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 + 3, d1 + 7)>
201-
// CHECK: [[MAP1:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 + 3, d1 + 11)>
202-
203184
// Test with loop IVs and constants.
204185
func @test_prefetch(%arg0 : index, %arg1 : index) {
205186
%0 = alloc() : memref<100x100xf32>
@@ -217,8 +198,6 @@ func @test_prefetch(%arg0 : index, %arg1 : index) {
217198

218199
// -----
219200

220-
// CHECK: [[MAP_ID:#map[0-9]+]] = affine_map<(d0, d1) -> (d0, d1)>
221-
222201
// Test with just loop IVs.
223202
func @vector_load_vector_store_iv() {
224203
%0 = alloc() : memref<100x100xf32>
@@ -238,8 +217,6 @@ func @vector_load_vector_store_iv() {
238217

239218
// -----
240219

241-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 + 3, d1 + 7)>
242-
243220
// Test with loop IVs and constants.
244221
func @vector_load_vector_store_iv_constant() {
245222
%0 = alloc() : memref<100x100xf32>
@@ -259,8 +236,6 @@ func @vector_load_vector_store_iv_constant() {
259236

260237
// -----
261238

262-
// CHECK: [[MAP0:#map[0-9]+]] = affine_map<(d0, d1) -> (d0, d1)>
263-
264239
func @vector_load_vector_store_2d() {
265240
%0 = alloc() : memref<100x100xf32>
266241
affine.for %i0 = 0 to 16 step 2{

mlir/test/Dialect/Affine/loop-tiling-parametric.mlir

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ func @tile_with_loop_upper_bounds_in_two_symbols(%t11 : index, %arg0: memref<?xf
232232
// CHECK-DAG: [[LBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0)>
233233
// CHECK-DAG: [[UBI1:#map[0-9]+]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1, d0 + s0 + 4)>
234234
// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1, d0 + s0 + 2)>
235-
// CHECK-DAG: [[LBO0:#map[0-9]+]] = affine_map<() -> (0)>
236235
// CHECK-DAG: [[UBO1:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 4) ceildiv s1)>
237236
// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 2) ceildiv s1)>
238237

@@ -255,7 +254,6 @@ func @tile_with_upper_bounds_in_dimensions_and_symbols(%t12 : index, %t13 :index
255254
// CHECK-DAG: [[LBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0)>
256255
// CHECK-DAG: [[UBI1:#map[0-9]+]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1 * 4, d0 + s0 + 4)>
257256
// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1 * 2, d0 + s0 + 2)>
258-
// CHECK-DAG: [[LBO0:#map[0-9]+]] = affine_map<() -> (0)>
259257
// CHECK-DAG: [[UBO1:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 4) ceildiv s1)>
260258
// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 2) ceildiv s1)>
261259

mlir/test/Dialect/Affine/loop-tiling-validity.mlir

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
// CHECK-DAG: [[$LB:#map[0-9]+]] = affine_map<(d0) -> (d0)>
88
// CHECK-DAG: [[$UB:#map[0-9]+]] = affine_map<(d0) -> (d0 + 32)>
9-
// CHECK-DAG: [[$ID:#map[0-9]+]] = affine_map<() -> (0)>
10-
// CHECK-DAG: [[$ID_PLUS_21:#map[0-9]+]] = affine_map<() -> (64)>
119

1210
// CHECK-LABEL: func @legal_loop()
1311
func @legal_loop() {
@@ -19,15 +17,15 @@ func @legal_loop() {
1917
affine.store %2, %0[%i] : memref<64xf32>
2018
}
2119

22-
return
20+
return
2321
}
2422

2523
// CHECK: affine.for %{{.*}} = 0 to 64 step 32 {
2624
// CHECK-NEXT: affine.for %{{.*}} = [[$LB]](%{{.*}}) to [[$UB]](%{{.*}}) {
2725

2826
// -----
2927

30-
// There are dependences along the diagonal of the 2d iteration space,
28+
// There are dependences along the diagonal of the 2d iteration space,
3129
// specifically, they are of direction (+, -).
3230
// The default tiling method (hyper-rect) will violate tiling legality.
3331
// We expect a remark that points that issue out to be emitted.
@@ -46,5 +44,5 @@ func @illegal_loop_with_diag_dependence() {
4644
}
4745
}
4846

49-
return
47+
return
5048
}

mlir/test/Dialect/Affine/loop-tiling.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ func @tile_with_symbolic_loop_upper_bounds(%arg0: memref<?x?xf32>, %arg1: memref
133133
// CHECK: dim %{{.*}}, %c0 : memref<?x?xf32>
134134
// CHECK-NEXT: affine.for %{{.*}} = 0 to %{{.*}} step 32 {
135135
// CHECK-NEXT: affine.for %{{.*}} = 0 to %{{.*}} step 32 {
136-
// CHECK-NEXT: affine.for %{{.*}} = #map3(%{{.*}}) to min [[$UBMAP]](%{{.*}})[%{{.*}}] {
137-
// CHECK-NEXT: affine.for %{{.*}} = #map3(%{{.*}}) to min [[$UBMAP]](%{{.*}})[%{{.*}}] {
136+
// CHECK-NEXT: affine.for %{{.*}} = #map0(%{{.*}}) to min [[$UBMAP]](%{{.*}})[%{{.*}}] {
137+
// CHECK-NEXT: affine.for %{{.*}} = #map0(%{{.*}}) to min [[$UBMAP]](%{{.*}})[%{{.*}}] {
138138
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[%{{.*}}, %{{.*}}] : memref<?x?xf32>
139139
// CHECK-NEXT: affine.for %{{.*}} = 0 to %{{.*}} {
140140
// CHECK-NEXT: affine.load

mlir/test/Dialect/Affine/parallelize.mlir

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// RUN: mlir-opt %s -allow-unregistered-dialect -affine-parallelize| FileCheck %s
22

3-
// For multiple nested for-loops.
4-
// CHECK-DAG: [[MAP5:#map[0-9]+]] = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0 + d1, d2 * 2 + d3, d4 * 2 + d5, d6 + d7)>
53
// CHECK-LABEL: func @reduce_window_max() {
64
func @reduce_window_max() {
75
%cst = constant 0.000000e+00 : f32

mlir/test/Dialect/Affine/simplify-affine-structures.mlir

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@ func @affine.apply(%N : index) {
274274

275275
// -----
276276

277-
// CHECK-DAG: #[[MAP_0D:.*]] = affine_map<() -> ()>
278-
279277
// CHECK-LABEL: func @simplify_zero_dim_map
280278
func @simplify_zero_dim_map(%in : memref<f32>) -> f32 {
281279
%out = affine.load %in[] : memref<f32>

0 commit comments

Comments
 (0)