@@ -137,7 +137,7 @@ func.func @tensor_pack_linalg_transpose_fold(%arg0: tensor<56x57x1x64xf32>) -> t
137
137
// CHECK: %[[INIT:.+]] = tensor.empty() : tensor<1x57x56x2x32xf32>
138
138
// CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]]
139
139
// CHECK-SAME: outer_dims_perm = [2, 1, 0, 3]
140
- // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
140
+ // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
141
141
// CHECK-SAME: into %[[INIT]]
142
142
// CHECK: return %[[PACK]]
143
143
@@ -163,7 +163,7 @@ func.func @tensor_pack_linalg_transpose_fold_with_padding(%arg0: tensor<56x57x1x
163
163
// CHECK: %[[INIT:.+]] = tensor.empty() : tensor<1x57x56x2x32xf32>
164
164
// CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]] padding_value(%[[PADDING]] : f32)
165
165
// CHECK-SAME: outer_dims_perm = [2, 1, 0, 3]
166
- // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
166
+ // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
167
167
// CHECK-SAME: into %[[INIT]]
168
168
// CHECK: return %[[PACK]]
169
169
@@ -188,7 +188,7 @@ func.func @tensor_pack_linalg_transpose_fold_no_outer_dims_perm(%arg0: tensor<56
188
188
// CHECK: %[[INIT:.+]] = tensor.empty() : tensor<1x2x56x57x32xf32>
189
189
// CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]]
190
190
// CHECK-SAME: outer_dims_perm = [2, 3, 0, 1]
191
- // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
191
+ // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
192
192
// CHECK-SAME: into %[[INIT]]
193
193
// CHECK: return %[[PACK]]
194
194
@@ -214,7 +214,7 @@ func.func @tensor_pack_linalg_transpose_fold_tile_dims_transpose(%arg0: tensor<5
214
214
// CHECK: %[[INIT:.+]] = tensor.empty() : tensor<12x56x4x9x32x8x2xf32>
215
215
// CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]]
216
216
// CHECK-SAME: outer_dims_perm = [2, 0, 3, 1]
217
- // CHECK-SAME: inner_dims_pos = [3, 1, 2] inner_tiles = [32, 8, 2]
217
+ // CHECK-SAME: inner_dims_pos = [3, 1, 2] inner_tiles = [32, 8, 2]
218
218
// CHECK-SAME: into %[[INIT]]
219
219
// CHECK: return %[[PACK]]
220
220
@@ -256,7 +256,7 @@ func.func @tensor_pack_linalg_transpose_fold_dynamic_outer_dims(%arg0: tensor<56
256
256
outs (%1 : tensor <1 x57 x56 x2 x32 xf32 >)
257
257
permutation = [2 , 3 , 0 , 1 , 4 ]
258
258
259
- %return_value = tensor.cast %transposed : tensor <1 x57 x56 x2 x32 xf32 > to tensor <?x?x56 x2 x32 xf32 >
259
+ %return_value = tensor.cast %transposed : tensor <1 x57 x56 x2 x32 xf32 > to tensor <?x?x56 x2 x32 xf32 >
260
260
return %return_value : tensor <?x?x56 x2 x32 xf32 >
261
261
}
262
262
// CHECK: func @tensor_pack_linalg_transpose_fold_dynamic_outer_dims(
@@ -268,7 +268,7 @@ func.func @tensor_pack_linalg_transpose_fold_dynamic_outer_dims(%arg0: tensor<56
268
268
// CHECK: %[[INIT:.+]] = tensor.empty(%[[dim_0]], %[[dim]]) : tensor<?x?x56x2x32xf32>
269
269
// CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]]
270
270
// CHECK-SAME: outer_dims_perm = [2, 1, 0, 3]
271
- // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
271
+ // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
272
272
// CHECK-SAME: into %[[INIT]]
273
273
// CHECK: return %[[PACK]]
274
274
@@ -286,14 +286,14 @@ func.func @tensor_pack_linalg_transpose_fold_dynamic_outer_and_tile_dims(%arg0:
286
286
ins (%pack : tensor <56 x9 x12 x4 x8 x2 x32 xf32 >)
287
287
outs (%1 : tensor <12 x4 x56 x9 x32 x8 x2 xf32 >)
288
288
permutation = [2 , 3 , 0 , 1 , 6 , 4 , 5 ]
289
-
290
- %return_value = tensor.cast %transposed : tensor <12 x4 x56 x9 x32 x8 x2 xf32 > to tensor <?x?x56 x9 x32 x8 x2 xf32 >
289
+
290
+ %return_value = tensor.cast %transposed : tensor <12 x4 x56 x9 x32 x8 x2 xf32 > to tensor <?x?x56 x9 x32 x8 x2 xf32 >
291
291
return %return_value : tensor <?x?x56 x9 x32 x8 x2 xf32 >
292
292
}
293
293
// CHECK-DAG: #[[$MAP0:.+]] = affine_map<()[s0] -> (s0 ceildiv 8)>
294
294
// CHECK-DAG: #[[$MAP1:.+]] = affine_map<()[s0] -> (s0 ceildiv 2)>
295
295
// CHECK-LABEL: func.func @tensor_pack_linalg_transpose_fold_dynamic_outer_and_tile_dims(
296
- // CHECK-SAME: %[[ARG0:.+]]: tensor<56x?x?x128xf32>)
296
+ // CHECK-SAME: %[[ARG0:.+]]: tensor<56x?x?x128xf32>)
297
297
// CHECK-DAG: %[[c1:.+]] = arith.constant 1 : index
298
298
// CHECK-DAG: %[[c2:.+]] = arith.constant 2 : index
299
299
// CHECK: %[[dim:.+]] = tensor.dim %[[ARG0]], %[[c1]] : tensor<56x?x?x128xf32>
@@ -328,7 +328,7 @@ func.func @tensor_pack_linalg_transpose_fold_dynamic_outer_dims_tile_dims_tile_s
328
328
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?x?x?xf32>,
329
329
// CHECK-SAME: %[[PACK_DEST:.+]]: tensor<?x?x?x?x?x?x?xf32>, %[[TRANSPOSE_DEST:.+]]: tensor<?x?x?x?x?x?x?xf32>,
330
330
// CHECK-SAME: %[[ARG1:.+]]: index, %[[ARG2:.+]]: index,
331
- // CHECK-SAME: %[[ARG3:.+]]: index)
331
+ // CHECK-SAME: %[[ARG3:.+]]: index)
332
332
// CHECK-DAG: %[[c0:.+]] = arith.constant 0 : index
333
333
// CHECK-DAG: %[[c1:.+]] = arith.constant 1 : index
334
334
// CHECK-DAG: %[[c2:.+]] = arith.constant 2 : index
@@ -367,7 +367,7 @@ func.func @linalg_transpose_tensor_pack_fold(%arg0: tensor<56x57x1x64xf32>) -> t
367
367
// CHECK: %[[INIT:.+]] = tensor.empty() : tensor<1x57x56x2x32xf32>
368
368
// CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]]
369
369
// CHECK-SAME: outer_dims_perm = [2, 1, 0, 3]
370
- // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
370
+ // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
371
371
// CHECK-SAME: into %[[INIT]]
372
372
// CHECK: return %[[PACK]]
373
373
@@ -379,7 +379,7 @@ func.func @linalg_transpose_tensor_pack_fold_with_padding(%arg0: tensor<56x57x1x
379
379
ins (%arg0 : tensor <56 x57 x1 x55 xf32 >)
380
380
outs (%0 : tensor <1 x56 x57 x55 xf32 >)
381
381
permutation = [2 , 0 , 1 , 3 ]
382
-
382
+
383
383
%1 = tensor.empty () : tensor <1 x57 x56 x2 x32 xf32 >
384
384
%pack = tensor.pack %transpose padding_value (%padding : f32 )
385
385
outer_dims_perm = [0 , 2 , 1 , 3 ]
@@ -393,7 +393,7 @@ func.func @linalg_transpose_tensor_pack_fold_with_padding(%arg0: tensor<56x57x1x
393
393
// CHECK: %[[INIT:.+]] = tensor.empty() : tensor<1x57x56x2x32xf32>
394
394
// CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]] padding_value(%[[PADDING]] : f32)
395
395
// CHECK-SAME: outer_dims_perm = [2, 1, 0, 3]
396
- // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
396
+ // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
397
397
// CHECK-SAME: into %[[INIT]]
398
398
// CHECK: return %[[PACK]]
399
399
@@ -405,7 +405,7 @@ func.func @linalg_transpose_tensor_pack_fold_no_outer_dims_perm(%arg0: tensor<56
405
405
ins (%arg0 : tensor <56 x57 x1 x64 xf32 >)
406
406
outs (%0 : tensor <1 x56 x57 x64 xf32 >)
407
407
permutation = [2 , 0 , 1 , 3 ]
408
-
408
+
409
409
%1 = tensor.empty () : tensor <1 x56 x57 x2 x32 xf32 >
410
410
%pack = tensor.pack %transposed
411
411
inner_dims_pos = [3 ]
@@ -418,7 +418,7 @@ func.func @linalg_transpose_tensor_pack_fold_no_outer_dims_perm(%arg0: tensor<56
418
418
// CHECK: %[[INIT:.+]] = tensor.empty() : tensor<1x56x57x2x32xf32>
419
419
// CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]]
420
420
// CHECK-SAME: outer_dims_perm = [2, 0, 1, 3]
421
- // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
421
+ // CHECK-SAME: inner_dims_pos = [3] inner_tiles = [32]
422
422
// CHECK-SAME: into %[[INIT]]
423
423
// CHECK: return %[[PACK]]
424
424
@@ -429,7 +429,7 @@ func.func @linalg_transpose_tensor_pack_fold_complex_inner_dims_change(%arg0: te
429
429
ins (%arg0 : tensor <25 x30 x35 x40 xf32 >)
430
430
outs (%transpose_dest : tensor <35 x40 x25 x30 xf32 >)
431
431
permutation = [2 , 3 , 0 , 1 ]
432
-
432
+
433
433
%pack = tensor.pack %transposed
434
434
outer_dims_perm = [3 , 0 , 2 , 1 ]
435
435
inner_dims_pos = [1 , 3 , 2 ]
@@ -438,15 +438,15 @@ func.func @linalg_transpose_tensor_pack_fold_complex_inner_dims_change(%arg0: te
438
438
return %pack : tensor <3 x35 x5 x8 x5 x10 x5 xf32 >
439
439
}
440
440
//CHECK-LABEL: func.func @linalg_transpose_tensor_pack_fold_complex_inner_dims_change(
441
- // CHECK-SAME: %[[ARG0:.+]]: tensor<25x30x35x40xf32>,
442
- // CHECK-SAME: %[[ARG1:.+]]: tensor<35x40x25x30xf32>,
441
+ // CHECK-SAME: %[[ARG0:.+]]: tensor<25x30x35x40xf32>,
442
+ // CHECK-SAME: %[[ARG1:.+]]: tensor<35x40x25x30xf32>,
443
443
// CHECK-SAME: %[[ARG2:.+]]: tensor<3x35x5x8x5x10x5xf32>) -> tensor<3x35x5x8x5x10x5xf32> {
444
444
// CHECK: %[[VAL0:.+]] = tensor.empty() : tensor<3x35x5x8x5x10x5xf32>
445
- // CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]]
446
- // CHECK-SAME: outer_dims_perm = [1, 2, 0, 3]
447
- // CHECK-SAME: inner_dims_pos = [3, 1, 0]
448
- // CHECK-SAME: inner_tiles = [5, 10, 5]
449
- // CHECK-SAME: into %[[VAL0]]
445
+ // CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]]
446
+ // CHECK-SAME: outer_dims_perm = [1, 2, 0, 3]
447
+ // CHECK-SAME: inner_dims_pos = [3, 1, 0]
448
+ // CHECK-SAME: inner_tiles = [5, 10, 5]
449
+ // CHECK-SAME: into %[[VAL0]]
450
450
// CHECK: return %[[PACK]]
451
451
452
452
// -----
@@ -456,7 +456,7 @@ func.func @linalg_transpose_tensor_pack_fold_dynamic_outer_dims_tile_dims_tile_s
456
456
ins (%arg0 : tensor <?x?x?x?xf32 >)
457
457
outs (%transpose_dest : tensor <?x?x?x?xf32 >)
458
458
permutation = [2 , 3 , 0 , 1 ]
459
-
459
+
460
460
%pack = tensor.pack %transposed
461
461
outer_dims_perm = [3 , 0 , 2 , 1 ]
462
462
inner_dims_pos = [1 , 3 , 2 ]
@@ -466,7 +466,7 @@ func.func @linalg_transpose_tensor_pack_fold_dynamic_outer_dims_tile_dims_tile_s
466
466
}
467
467
// CHECK: #[[$MAP:.+]] = affine_map<()[s0, s1] -> (s0 ceildiv s1)>
468
468
//CHECK-LABEL: func.func @linalg_transpose_tensor_pack_fold_dynamic_outer_dims_tile_dims_tile_sizes(
469
- // CHECK-SAME: %[[ARG0:.+]]: tensor<?x?x?x?xf32>, %[[ARG1:.+]]: tensor<?x?x?x?xf32>,
469
+ // CHECK-SAME: %[[ARG0:.+]]: tensor<?x?x?x?xf32>, %[[ARG1:.+]]: tensor<?x?x?x?xf32>,
470
470
// CHECK-SAME: %[[ARG2:.+]]: tensor<?x?x?x?x?x?x?xf32>, %[[ARG3:.+]]: index, %[[ARG4:.+]]: index, %[[ARG5:.+]]: index) -> tensor<?x?x?x?x?x?x?xf32> {
471
471
// CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index
472
472
// CHECK-DAG: %[[C1:.+]] = arith.constant 1 : index
@@ -491,17 +491,17 @@ func.func @linalg_transpose_tensor_pack_multiple_tiles(%arg0: tensor<?x32x128xbf
491
491
%dim = tensor.dim %arg0 , %c0 : tensor <?x32 x128 xbf16 >
492
492
493
493
%0 = tensor.empty (%dim ) : tensor <32 x128 x?xbf16 >
494
- %transposed = linalg.transpose
495
- ins (%arg0 : tensor <?x32 x128 xbf16 >)
496
- outs (%0 : tensor <32 x128 x?xbf16 >)
494
+ %transposed = linalg.transpose
495
+ ins (%arg0 : tensor <?x32 x128 xbf16 >)
496
+ outs (%0 : tensor <32 x128 x?xbf16 >)
497
497
permutation = [1 , 2 , 0 ]
498
498
499
499
%2 = tensor.empty (%dim ) : tensor <32 x?x64 x16 x2 xbf16 >
500
- %pack = tensor.pack %transposed
501
- padding_value (%cst : bf16 )
502
- outer_dims_perm = [0 , 2 , 1 ]
503
- inner_dims_pos = [2 , 1 ]
504
- inner_tiles = [16 , 2 ]
500
+ %pack = tensor.pack %transposed
501
+ padding_value (%cst : bf16 )
502
+ outer_dims_perm = [0 , 2 , 1 ]
503
+ inner_dims_pos = [2 , 1 ]
504
+ inner_tiles = [16 , 2 ]
505
505
into %2 : tensor <32 x128 x?xbf16 > -> tensor <32 x?x64 x16 x2 xbf16 >
506
506
return %pack : tensor <32 x?x64 x16 x2 xbf16 >
507
507
}
@@ -513,11 +513,11 @@ func.func @linalg_transpose_tensor_pack_multiple_tiles(%arg0: tensor<?x32x128xbf
513
513
// CHECK: %[[DIM:.+]] = tensor.dim %[[ARG0]], %[[C0]] : tensor<?x32x128xbf16>
514
514
// CHECK: %[[VAL0:.+]] = affine.apply #[[$MAP]]()[%[[DIM]]]
515
515
// CHECK: %[[VAL1:.+]] = tensor.empty(%[[VAL0]]) : tensor<32x?x64x16x2xbf16>
516
- // CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]]
517
- // CHECK-SAME: padding_value(%[[CST]] : bf16)
518
- // CHECK-SAME: outer_dims_perm = [1, 0, 2]
519
- // CHECK-SAME: inner_dims_pos = [0, 2]
520
- // CHECK-SAME: inner_tiles = [16, 2]
516
+ // CHECK: %[[PACK:.+]] = tensor.pack %[[ARG0]]
517
+ // CHECK-SAME: padding_value(%[[CST]] : bf16)
518
+ // CHECK-SAME: outer_dims_perm = [1, 0, 2]
519
+ // CHECK-SAME: inner_dims_pos = [0, 2]
520
+ // CHECK-SAME: inner_tiles = [16, 2]
521
521
// CHECK-SAME: into %[[VAL1]] : tensor<?x32x128xbf16> -> tensor<32x?x64x16x2xbf16>
522
522
// CHECK: return %[[PACK]] : tensor<32x?x64x16x2xbf16>
523
523
// CHECK: }
@@ -526,24 +526,24 @@ func.func @linalg_transpose_tensor_pack_multiple_tiles(%arg0: tensor<?x32x128xbf
526
526
527
527
func.func @linalg_transpose_tensor_unpack_fold (%arg0: tensor <1 x1 x4 x16 xi32 >) -> tensor <16 x4 xi32 > {
528
528
%0 = tensor.empty () : tensor <1 x1 x16 x4 xi32 >
529
- %transposed = linalg.transpose ins (%arg0 : tensor <1 x1 x4 x16 xi32 >)
530
- outs (%0 : tensor <1 x1 x16 x4 xi32 >)
529
+ %transposed = linalg.transpose ins (%arg0 : tensor <1 x1 x4 x16 xi32 >)
530
+ outs (%0 : tensor <1 x1 x16 x4 xi32 >)
531
531
permutation = [1 , 0 , 3 , 2 ]
532
532
%1 = tensor.empty () : tensor <16 x4 xi32 >
533
- %unpack = tensor.unpack %transposed
534
- outer_dims_perm = [0 , 1 ]
535
- inner_dims_pos = [0 , 1 ]
536
- inner_tiles = [16 , 4 ] into
533
+ %unpack = tensor.unpack %transposed
534
+ outer_dims_perm = [0 , 1 ]
535
+ inner_dims_pos = [0 , 1 ]
536
+ inner_tiles = [16 , 4 ] into
537
537
%1 : tensor <1 x1 x16 x4 xi32 > -> tensor <16 x4 xi32 >
538
538
return %unpack : tensor <16 x4 xi32 >
539
539
}
540
540
//CHECK-LABEL: func.func @linalg_transpose_tensor_unpack_fold(
541
541
// CHECK-SAME: %[[ARG0:.+]]: tensor<1x1x4x16xi32>) -> tensor<16x4xi32> {
542
542
// CHECK: %[[OUT:.+]] = tensor.empty() : tensor<16x4xi32>
543
- // CHECK: %[[UNPACK:.+]] = tensor.unpack %[[ARG0]]
544
- // CHECK-SAME: outer_dims_perm = [1, 0]
545
- // CHECK-SAME: inner_dims_pos = [1, 0]
546
- // CHECK-SAME: inner_tiles = [4, 16]
543
+ // CHECK: %[[UNPACK:.+]] = tensor.unpack %[[ARG0]]
544
+ // CHECK-SAME: outer_dims_perm = [1, 0]
545
+ // CHECK-SAME: inner_dims_pos = [1, 0]
546
+ // CHECK-SAME: inner_tiles = [4, 16]
547
547
// CHEKC-SAME: into %[[OUT]] : tensor<1x1x4x16xi32> -> tensor<16x4xi32>
548
548
// CHECK: return %[[UNPACK]] : tensor<16x4xi32>
549
549
// CHECK: }
@@ -555,7 +555,7 @@ func.func @linalg_transpose_tensor_unpack_fold_dynamic_outer_dims_tile_dims_tile
555
555
ins (%arg0 : tensor <?x?x?x?xf32 >)
556
556
outs (%transpose_dest : tensor <?x?x?x?xf32 >)
557
557
permutation = [1 , 0 , 3 , 2 ]
558
-
558
+
559
559
%unpack = tensor.unpack %transposed
560
560
outer_dims_perm = [1 , 0 ]
561
561
inner_dims_pos = [0 , 1 ]
@@ -565,7 +565,7 @@ func.func @linalg_transpose_tensor_unpack_fold_dynamic_outer_dims_tile_dims_tile
565
565
}
566
566
// CHECK: #[[$MAP:.+]] = affine_map<()[s0, s1] -> (s0 * s1)>
567
567
// CHECK-LABEL: func.func @linalg_transpose_tensor_unpack_fold_dynamic_outer_dims_tile_dims_tile_sizes(
568
- // CHECK-SAME: %[[ARG0:.+]]: tensor<?x?x?x?xf32>, %[[ARG1:.+]]: tensor<?x?x?x?xf32>, %[[ARG2:.+]]: tensor<?x?xf32>,
568
+ // CHECK-SAME: %[[ARG0:.+]]: tensor<?x?x?x?xf32>, %[[ARG1:.+]]: tensor<?x?x?x?xf32>, %[[ARG2:.+]]: tensor<?x?xf32>,
569
569
// CHECK-SAME: %[[IDX1:.+]]: index, %[[IDX2:.+]]: index) -> tensor<?x?xf32> {
570
570
// CHECK-DAG: %[[CST1:.+]] = arith.constant 1 : index
571
571
// CHECK-DAG: %[[CST0:.+]] = arith.constant 0 : index
@@ -574,10 +574,10 @@ func.func @linalg_transpose_tensor_unpack_fold_dynamic_outer_dims_tile_dims_tile
574
574
// CHECK-DAG: %[[AMAP0:.+]] = affine.apply #[[$MAP]]()[%[[DIM1]], %[[IDX2]]]
575
575
// CHECK-DAG: %[[AMAP1:.+]] = affine.apply #[[$MAP]]()[%[[DIM0]], %[[IDX1]]]
576
576
// CHECK: %[[OUT:.+]] = tensor.empty(%[[AMAP1]], %[[AMAP0]]) : tensor<?x?xf32>
577
- // CHECK: %[[UNPACK:.+]] = tensor.unpack %[[ARG0]]
578
- // CHECK-SAME: outer_dims_perm = [0, 1]
579
- // CHECK-SAME: inner_dims_pos = [1, 0]
580
- // CHECK-SAME: inner_tiles = [%[[IDX2]], %[[IDX1]]]
577
+ // CHECK: %[[UNPACK:.+]] = tensor.unpack %[[ARG0]]
578
+ // CHECK-SAME: outer_dims_perm = [0, 1]
579
+ // CHECK-SAME: inner_dims_pos = [1, 0]
580
+ // CHECK-SAME: inner_tiles = [%[[IDX2]], %[[IDX1]]]
581
581
// CHECK-SAME: into %[[OUT]] : tensor<?x?x?x?xf32> -> tensor<?x?xf32>
582
582
// CHECK: return %[[UNPACK]] : tensor<?x?xf32>
583
583
// CHECK: }
@@ -602,10 +602,37 @@ func.func @tensor_unpack_linalg_transpose_fold(%arg0: tensor<56x57x1x64xf32>) ->
602
602
// CHECK-LABEL: func.func @tensor_unpack_linalg_transpose_fold(
603
603
// CHECK-SAME: %[[ARG0:.+]]: tensor<56x57x1x64xf32>) -> tensor<3648x56xf32> {
604
604
// CHECK: %[[OUT:.+]] = tensor.empty() : tensor<3648x56xf32>
605
- // CHECK: %[[UNPACK:.+]] = tensor.unpack %[[ARG0]]
606
- // CHECK-SAME: outer_dims_perm = [1, 0]
607
- // CHECK-SAME: inner_dims_pos = [1, 0]
608
- // CHECK-SAME: inner_tiles = [1, 64]
605
+ // CHECK: %[[UNPACK:.+]] = tensor.unpack %[[ARG0]]
606
+ // CHECK-SAME: outer_dims_perm = [1, 0]
607
+ // CHECK-SAME: inner_dims_pos = [1, 0]
608
+ // CHECK-SAME: inner_tiles = [1, 64]
609
609
// CHECK-SAME: into %[[OUT:.+]] : tensor<56x57x1x64xf32> -> tensor<3648x56xf32>
610
610
// CHECK: return %[[UNPACK]] : tensor<3648x56xf32>
611
611
// CHECK: }
612
+
613
+ // -----
614
+
615
+ func.func @tensor_padded_unpack_linalg_transpose_fold (%arg0: tensor <71 x7 x4 x16 x16 xf32 >) -> tensor <100 x71 x64 xf32 > {
616
+ %0 = tensor.empty () : tensor <71 x100 x64 xf32 >
617
+ %pack = tensor.unpack %arg0
618
+ inner_dims_pos = [1 , 2 ]
619
+ inner_tiles = [16 , 16 ]
620
+ into %0 : tensor <71 x7 x4 x16 x16 xf32 > -> tensor <71 x100 x64 xf32 >
621
+
622
+ %1 = tensor.empty () : tensor <100 x71 x64 xf32 >
623
+ %transposed = linalg.transpose
624
+ ins (%pack : tensor <71 x100 x64 xf32 >)
625
+ outs (%1 : tensor <100 x71 x64 xf32 >)
626
+ permutation = [1 , 0 , 2 ]
627
+ return %transposed : tensor <100 x71 x64 xf32 >
628
+ }
629
+ // CHECK-LABEL: func.func @tensor_padded_unpack_linalg_transpose_fold(
630
+ // CHECK-SAME: %[[ARG0:.+]]: tensor<71x7x4x16x16xf32>) -> tensor<100x71x64xf32> {
631
+ // CHECK: %[[OUT:.+]] = tensor.empty() : tensor<100x71x64xf32>
632
+ // CHECK: %[[UNPACK:.+]] = tensor.unpack %[[ARG0]]
633
+ // CHECK-SAME: outer_dims_perm = [1, 0, 2]
634
+ // CHECK-SAME: inner_dims_pos = [0, 2]
635
+ // CHECK-SAME: inner_tiles = [16, 16]
636
+ // CHECK-SAME: into %[[OUT:.+]] : tensor<71x7x4x16x16xf32> -> tensor<100x71x64xf32>
637
+ // CHECK: return %[[UNPACK]] : tensor<100x71x64xf32>
638
+ // CHECK: }
0 commit comments