@@ -1760,10 +1760,6 @@ func.func @pack_dont_drop_attributes(%arg0: tensor<?x?x?xf16>, %arg1: tensor<128
1760
1760
1761
1761
// -----
1762
1762
1763
- //===----------------------------------------------------------------------===//
1764
- // linalg.unpack + tensor.extract_slice
1765
-
1766
-
1767
1763
//===----------------------------------------------------------------------===//
1768
1764
// linalg.fill + linalg.unpack
1769
1765
//===----------------------------------------------------------------------===//
@@ -1787,6 +1783,30 @@ func.func @fold_dst_style_ops_into_unpack(%arg0 : tensor<?x?x16x64xf32>, %init :
1787
1783
// tensor.cast + linalg.unpack
1788
1784
//===----------------------------------------------------------------------===//
1789
1785
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 <1 x1 x8 x1 xi32 >,
1793
+ %res: tensor <7 x?xi32 >) -> tensor <7 x?xi32 > {
1794
+
1795
+ %cast = tensor.cast %src : tensor <1 x1 x8 x1 xi32 > to tensor <1 x1 x?x1 xi32 >
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 <1 x1 x?x1 xi32 > -> tensor <7 x?xi32 >
1801
+ return %unpack : tensor <7 x?xi32 >
1802
+ }
1803
+
1804
+ // -----
1805
+
1806
+ //===----------------------------------------------------------------------===//
1807
+ // linalg.unpack + tensor.extract_slice
1808
+ //===----------------------------------------------------------------------===//
1809
+
1790
1810
func.func @fold_extract_slice_into_unpack (
1791
1811
%src : tensor <28 x2 x?x16 x16 xf32 >, %dest : tensor <28 x32 x?xf32 >, %size : index
1792
1812
) -> tensor <28 x28 x?xf32 > {
@@ -1799,6 +1819,7 @@ func.func @fold_extract_slice_into_unpack(
1799
1819
[0 , 0 , 0 ] [28 , 28 , %size ] [1 , 1 , 1 ] : tensor <28 x32 x?xf32 > to tensor <28 x28 x?xf32 >
1800
1820
return %extracted_slice : tensor <28 x28 x?xf32 >
1801
1821
}
1822
+
1802
1823
// CHECK-LABEL: func @fold_extract_slice_into_unpack
1803
1824
// CHECK-SAME: %[[SRC:.+]]: tensor<28x2x?x16x16xf32>
1804
1825
// CHECK-SAME: %[[DEST:.+]]: tensor<28x32x?xf32>
@@ -1846,6 +1867,7 @@ func.func @no_fold_extract_slice_into_unpack_non_zero_offset(
1846
1867
[0 , 1 ] [28 , 28 ] [1 , 1 ] : tensor <28 x32 xf32 > to tensor <28 x28 xf32 >
1847
1868
return %extracted_slice : tensor <28 x28 xf32 >
1848
1869
}
1870
+
1849
1871
// CHECK-LABEL: func @no_fold_extract_slice_into_unpack_non_zero_offset
1850
1872
// CHECK-SAME: %[[SRC:.+]]: tensor<28x2x16xf32>
1851
1873
// CHECK-SAME: %[[DEST:.+]]: tensor<28x32xf32>
0 commit comments