@@ -101,3 +101,29 @@ func.func @subview_strided(%input: memref<4x1024xf32>) -> memref<1x64xf32, strid
101
101
%1 = memref.subview %0 [%cst_1 , 64 ] [1 , 64 ] [2 , 2 ] : memref <2 x256 xf32 , strided <[2048 , 2 ], offset : ?>> to memref <1 x64 xf32 , strided <[4096 , 4 ], offset : ?>>
102
102
return %1 : memref <1 x64 xf32 , strided <[4096 , 4 ], offset : ?>>
103
103
}
104
+
105
+ // -----
106
+
107
+ // CHECK-LABEL: func.func @single_dynamic_size_subview(
108
+ // CHECK-SAME: %[[SRC:.*]]: memref<256x?xf32, strided<[?, ?], offset: ?>>,
109
+ // CHECK-SAME: %{{.*}}: index,
110
+ // CHECK-SAME: %[[SIZE:.*]]: index) -> memref<8x?xf32, strided<[?, ?], offset: ?>> {
111
+ func.func @single_dynamic_size_subview (%arg0: memref <256 x?xf32 , strided <[?, ?], offset : ?>>, %arg1 : index , %arg2 : index ) -> memref <8 x?xf32 , strided <[?, ?], offset : ?>>{
112
+ %subview = memref.subview %arg0 [0 , 0 ][8 , %arg1 ][1 , 1 ] : memref <256 x?xf32 , strided <[?, ?], offset : ?>> to memref <8 x?xf32 , strided <[?, ?], offset : ?>>
113
+ %subview_1 = memref.subview %subview [0 , 0 ][8 , %arg2 ][1 , 1 ] : memref <8 x?xf32 , strided <[?, ?], offset : ?>> to memref <8 x?xf32 , strided <[?, ?], offset : ?>>
114
+ // CHECK: %{{.*}} = memref.subview %[[SRC]][0, 0] [8, %[[SIZE]]] [1, 1] : memref<256x?xf32, strided<[?, ?], offset: ?>> to memref<8x?xf32, strided<[?, ?], offset: ?>>
115
+ return %subview_1 : memref <8 x?xf32 , strided <[?, ?], offset : ?>>
116
+ }
117
+
118
+ // -----
119
+
120
+ // CHECK-LABEL: func.func @all_dynamic_size_subview(
121
+ // CHECK-SAME: %[[SRC:.*]]: memref<256x?xf32, strided<[?, ?], offset: ?>>,
122
+ // CHECK-SAME: %{{.*}}: index,
123
+ // CHECK-SAME: %[[SIZE:.*]]: index) -> memref<?x?xf32, strided<[?, ?], offset: ?>> {
124
+ func.func @all_dynamic_size_subview (%arg0: memref <256 x?xf32 , strided <[?, ?], offset : ?>>, %arg1: index , %arg2: index ) -> memref <?x?xf32 , strided <[?, ?], offset : ?>> {
125
+ %subview = memref.subview %arg0 [0 , 0 ] [%arg2 , %arg2 ] [1 , 1 ] : memref <256 x?xf32 , strided <[?, ?], offset : ?>> to memref <?x?xf32 , strided <[?, ?], offset : ?>>
126
+ // CHECK: %{{.*}} = memref.subview %[[SRC]][0, 0] {{\[}}%[[SIZE]], %[[SIZE]]] [1, 1] : memref<256x?xf32, strided<[?, ?], offset: ?>> to memref<?x?xf32, strided<[?, ?], offset: ?>>
127
+ return %subview : memref <?x?xf32 , strided <[?, ?], offset : ?>>
128
+ }
129
+
0 commit comments