Skip to content

Commit f716ccd

Browse files
committed
nit mlir/test/Dialect/Linalg/canonicalize.mlir
1 parent be791b7 commit f716ccd

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

mlir/test/Dialect/Linalg/canonicalize.mlir

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,10 +1760,6 @@ func.func @pack_dont_drop_attributes(%arg0: tensor<?x?x?xf16>, %arg1: tensor<128
17601760

17611761
// -----
17621762

1763-
//===----------------------------------------------------------------------===//
1764-
// linalg.unpack + tensor.extract_slice
1765-
1766-
17671763
//===----------------------------------------------------------------------===//
17681764
// linalg.fill + linalg.unpack
17691765
//===----------------------------------------------------------------------===//
@@ -1787,6 +1783,30 @@ func.func @fold_dst_style_ops_into_unpack(%arg0 : tensor<?x?x16x64xf32>, %init :
17871783
// tensor.cast + linalg.unpack
17881784
//===----------------------------------------------------------------------===//
17891785

1786+
// CHECK-LABEL: func.func @fold_cast_unpack_dynamic_tile_size(
1787+
// CHECK-SAME: %[[SRC:.*]]: tensor<1x1x8x1xi32>,
1788+
// CHECK-SAME: %[[DEST:.*]]: tensor<7x?xi32>) -> tensor<7x?xi32> {
1789+
// CHECK: %[[RES:.*]] = linalg.unpack %[[SRC]] inner_dims_pos = [0, 1] inner_tiles = [8, 1] into %[[DEST]] {test_attr} : tensor<1x1x8x1xi32> -> tensor<7x?xi32>
1790+
// CHECK: return %[[RES]] : tensor<7x?xi32>
1791+
func.func @fold_cast_unpack_dynamic_tile_size(
1792+
%src: tensor<1x1x8x1xi32>,
1793+
%res: tensor<7x?xi32>) -> tensor<7x?xi32> {
1794+
1795+
%cast = tensor.cast %src : tensor<1x1x8x1xi32> to tensor<1x1x?x1xi32>
1796+
%c8 = arith.constant 8 : index
1797+
%unpack = linalg.unpack %cast
1798+
inner_dims_pos = [0, 1]
1799+
inner_tiles = [%c8, 1]
1800+
into %res {test_attr} : tensor<1x1x?x1xi32> -> tensor<7x?xi32>
1801+
return %unpack : tensor<7x?xi32>
1802+
}
1803+
1804+
// -----
1805+
1806+
//===----------------------------------------------------------------------===//
1807+
// linalg.unpack + tensor.extract_slice
1808+
//===----------------------------------------------------------------------===//
1809+
17901810
func.func @fold_extract_slice_into_unpack(
17911811
%src : tensor<28x2x?x16x16xf32>, %dest : tensor<28x32x?xf32>, %size : index
17921812
) -> tensor<28x28x?xf32> {
@@ -1799,6 +1819,7 @@ func.func @fold_extract_slice_into_unpack(
17991819
[0, 0, 0] [28, 28, %size] [1, 1, 1] : tensor<28x32x?xf32> to tensor<28x28x?xf32>
18001820
return %extracted_slice : tensor<28x28x?xf32>
18011821
}
1822+
18021823
// CHECK-LABEL: func @fold_extract_slice_into_unpack
18031824
// CHECK-SAME: %[[SRC:.+]]: tensor<28x2x?x16x16xf32>
18041825
// CHECK-SAME: %[[DEST:.+]]: tensor<28x32x?xf32>
@@ -1846,6 +1867,7 @@ func.func @no_fold_extract_slice_into_unpack_non_zero_offset(
18461867
[0, 1] [28, 28] [1, 1] : tensor<28x32xf32> to tensor<28x28xf32>
18471868
return %extracted_slice : tensor<28x28xf32>
18481869
}
1870+
18491871
// CHECK-LABEL: func @no_fold_extract_slice_into_unpack_non_zero_offset
18501872
// CHECK-SAME: %[[SRC:.+]]: tensor<28x2x16xf32>
18511873
// CHECK-SAME: %[[DEST:.+]]: tensor<28x32xf32>

0 commit comments

Comments
 (0)