@@ -2771,12 +2771,12 @@ func.func @pad_and_pack_partially_dynamic(%source: tensor<?x?xf32>, %dest: tenso
27712771
27722772// -----
27732773
2774- func.func @pack_descending_inner_dims_with_padding (%source: tensor <1 x5 x7 xf32 >, %dest: tensor <1 x3 x2 x4 x2 xf32 >, %pad: f32 ) -> tensor <1 x3 x2 x4 x2 xf32 > {
2774+ func.func @pack_transposed_inner_dims_with_padding (%source: tensor <1 x5 x7 xf32 >, %dest: tensor <1 x3 x2 x4 x2 xf32 >, %pad: f32 ) -> tensor <1 x3 x2 x4 x2 xf32 > {
27752775 %0 = linalg.pack %source padding_value (%pad : f32 ) inner_dims_pos = [2 , 1 ] inner_tiles = [4 , 2 ] into %dest : tensor <1 x5 x7 xf32 > -> tensor <1 x3 x2 x4 x2 xf32 >
27762776 return %0 : tensor <1 x3 x2 x4 x2 xf32 >
27772777}
27782778
2779- // CHECK-LABEL: func.func @pack_descending_inner_dims_with_padding (
2779+ // CHECK-LABEL: func.func @pack_transposed_inner_dims_with_padding (
27802780// CHECK-SAME: %[[SOURCE:.*]]: tensor<1x5x7xf32>,
27812781// CHECK-SAME: %[[DEST:.*]]: tensor<1x3x2x4x2xf32>,
27822782// CHECK-SAME: %[[PAD:.*]]: f32)
@@ -2834,6 +2834,38 @@ func.func @unpack_non_adjacent_inner_dims(%source: tensor<10x1x3x4x2xf32>, %dest
28342834
28352835// -----
28362836
2837+ func.func @pack_implementing_transpose (%source: tensor <3 x5 x7 xf32 >, %dest: tensor <3 x7 x5 xf32 >) -> tensor <3 x7 x5 xf32 > {
2838+ %0 = linalg.pack %source outer_dims_perm = [0 , 2 , 1 ] inner_dims_pos = [] inner_tiles = [] into %dest : tensor <3 x5 x7 xf32 > -> tensor <3 x7 x5 xf32 >
2839+ return %0 : tensor <3 x7 x5 xf32 >
2840+ }
2841+
2842+ // CHECK-LABEL: func.func @pack_implementing_transpose(
2843+ // CHECK-SAME: %[[SOURCE:.*]]: tensor<3x5x7xf32>,
2844+ // CHECK-SAME: %[[DEST:.*]]: tensor<3x7x5xf32>)
2845+ // CHECK: %{{.*}} = linalg.pack
2846+ // CHECK-SAME: outer_dims_perm = [0, 2, 1]
2847+ // CHECK-SAME: inner_dims_pos = []
2848+ // CHECK-SAME: inner_tiles = []
2849+ // CHECK-SAME: into %[[DEST]] : tensor<3x5x7xf32> -> tensor<3x7x5xf32>
2850+
2851+ // -----
2852+
2853+ func.func @unpack_implementing_transpose (%source: tensor <3 x7 x5 xf32 >, %dest: tensor <3 x5 x7 xf32 >) -> tensor <3 x5 x7 xf32 > {
2854+ %0 = linalg.unpack %source outer_dims_perm = [0 , 2 , 1 ] inner_dims_pos = [] inner_tiles = [] into %dest : tensor <3 x7 x5 xf32 > -> tensor <3 x5 x7 xf32 >
2855+ return %0 : tensor <3 x5 x7 xf32 >
2856+ }
2857+
2858+ // CHECK-LABEL: func.func @unpack_implementing_transpose(
2859+ // CHECK-SAME: %[[SOURCE:.*]]: tensor<3x7x5xf32>,
2860+ // CHECK-SAME: %[[DEST:.*]]: tensor<3x5x7xf32>)
2861+ // CHECK: %{{.*}} = linalg.unpack
2862+ // CHECK-SAME: outer_dims_perm = [0, 2, 1]
2863+ // CHECK-SAME: inner_dims_pos = []
2864+ // CHECK-SAME: inner_tiles = []
2865+ // CHECK-SAME: into %[[DEST]] : tensor<3x7x5xf32> -> tensor<3x5x7xf32>
2866+
2867+ // -----
2868+
28372869func.func @unpack_fully_dynamic (%source: tensor <?x?x?x?xf32 >, %dest: tensor <?x?xf32 >, %tile_n : index , %tile_m : index ) -> tensor <?x?xf32 > {
28382870 %0 = linalg.unpack %source inner_dims_pos = [0 , 1 ] inner_tiles = [%tile_n , %tile_m ] into %dest : tensor <?x?x?x?xf32 > -> tensor <?x?xf32 >
28392871 return %0 : tensor <?x?xf32 >
0 commit comments