@@ -102,6 +102,25 @@ func.func @transfer_read_dims_mismatch_non_zero_indices(
102
102
103
103
// -----
104
104
105
+ func.func @transfer_read_dims_mismatch_non_contiguous_non_zero_indices (
106
+ %subview : memref <1 x3 x3 x2 xf32 , strided <[40 , 10 , 2 , 1 ], offset : ?>>,
107
+ %idx0 : index , %idx1 : index ) -> vector <2 x2 xf32 > {
108
+ %c0 = arith.constant 0 : index
109
+ %cst_1 = arith.constant 0.000000e+00 : f32
110
+ %8 = vector.transfer_read %subview [%c0 , %idx0 , %idx1 , %c0 ], %cst_1 {in_bounds = [true , true ]} : memref <1 x3 x3 x2 xf32 , strided <[40 , 10 , 2 , 1 ], offset : ?>>, vector <2 x2 xf32 >
111
+ return %8 : vector <2 x2 xf32 >
112
+ }
113
+
114
+ // CHECK: #[[$MAP:.+]] = affine_map<()[s0] -> (s0 * 2)>
115
+ // CHECK-LABEL: func.func @transfer_read_dims_mismatch_non_contiguous_non_zero_indices(
116
+ // CHECK: %[[COLLAPSE:.+]] = memref.collapse_shape %{{.*}} {{\[}}[0], [1], [2, 3]] : memref<1x3x3x2xf32, strided<[40, 10, 2, 1], offset: ?>> into memref<1x3x6xf32, strided<[40, 10, 1], offset: ?>>
117
+ // CHECK: %[[APPLY:.*]] = affine.apply #[[$MAP]]()
118
+
119
+ // CHECK-128B-LABEL: func @transfer_read_dims_mismatch_non_contiguous_non_zero_indices(
120
+ // CHECK-128B: memref.collapse_shape
121
+
122
+ // -----
123
+
105
124
// The input memref has a dynamic trailing shape and hence is not flattened.
106
125
// TODO: This case could be supported via memref.dim
107
126
@@ -212,6 +231,25 @@ func.func @transfer_write_dims_mismatch_contiguous(
212
231
213
232
// -----
214
233
234
+ func.func @transfer_write_dims_mismatch_non_contiguous_non_zero_indices (
235
+ %value : vector <2 x2 xf32 >,
236
+ %subview : memref <1 x3 x3 x2 xf32 , strided <[40 , 10 , 2 , 1 ], offset : ?>>,
237
+ %idx0 : index , %idx1 : index ) {
238
+ %c0 = arith.constant 0 : index
239
+ vector.transfer_write %value , %subview [%c0 , %idx0 , %idx1 , %c0 ] {in_bounds = [true , true ]} : vector <2 x2 xf32 >, memref <1 x3 x3 x2 xf32 , strided <[40 , 10 , 2 , 1 ], offset : ?>>
240
+ return
241
+ }
242
+
243
+ // CHECK: #[[$MAP:.+]] = affine_map<()[s0] -> (s0 * 2)>
244
+ // CHECK-LABEL: func.func @transfer_write_dims_mismatch_non_contiguous_non_zero_indices(
245
+ // CHECK: %[[APPLY:.*]] = affine.apply #[[$MAP]]()
246
+ // CHECK: %[[COLLAPSE:.+]] = memref.collapse_shape %{{.*}} {{\[}}[0], [1], [2, 3]] : memref<1x3x3x2xf32, strided<[40, 10, 2, 1], offset: ?>> into memref<1x3x6xf32, strided<[40, 10, 1], offset: ?>>
247
+
248
+ // CHECK-128B-LABEL: func @transfer_write_dims_mismatch_non_contiguous_non_zero_indices(
249
+ // CHECK-128B: memref.collapse_shape
250
+
251
+ // -----
252
+
215
253
func.func @transfer_write_dims_mismatch_non_contiguous (
216
254
%arg : memref <5 x4 x3 x2 xi8 , strided <[24 , 6 , 2 , 1 ], offset : ?>>, %vec : vector <2 x1 x2 x2 xi8 >) {
217
255
%c0 = arith.constant 0 : index
@@ -459,43 +497,6 @@ func.func @fold_unit_dims_entirely(%arg0 : vector<8xi32>,
459
497
// CHECK-128B-LABEL: func @fold_unit_dims_entirely(
460
498
// CHECK-128B-NOT: memref.collapse_shape
461
499
462
-
463
- // -----
464
-
465
- func.func @regression_non_contiguous_dim_read (%subview : memref <1 x3 x3 x2 xf32 , strided <[40 , 10 , 2 , 1 ], offset : ?>>,
466
- %idx0 : index , %idx1 : index ) -> vector <2 x2 xf32 > {
467
- %c0 = arith.constant 0 : index
468
- %cst_1 = arith.constant 0.000000e+00 : f32
469
- %8 = vector.transfer_read %subview [%c0 , %idx0 , %idx1 , %c0 ], %cst_1 {in_bounds = [true , true ]} : memref <1 x3 x3 x2 xf32 , strided <[40 , 10 , 2 , 1 ], offset : ?>>, vector <2 x2 xf32 >
470
- return %8 : vector <2 x2 xf32 >
471
- }
472
-
473
- // CHECK: #[[$MAP:.+]] = affine_map<()[s0] -> (s0 * 2)>
474
- // CHECK-LABEL: func.func @regression_non_contiguous_dim_read(
475
- // CHECK: %[[COLLAPSE:.+]] = memref.collapse_shape %{{.*}} {{\[}}[0], [1], [2, 3]] : memref<1x3x3x2xf32, strided<[40, 10, 2, 1], offset: ?>> into memref<1x3x6xf32, strided<[40, 10, 1], offset: ?>>
476
- // CHECK: %[[APPLY:.*]] = affine.apply #[[$MAP]]()
477
-
478
- // CHECK-128B-LABEL: func @regression_non_contiguous_dim_read(
479
- // CHECK-128B: memref.collapse_shape
480
-
481
- // -----
482
-
483
- func.func @regression_non_contiguous_dim_write (%value : vector <2 x2 xf32 >,
484
- %subview : memref <1 x3 x3 x2 xf32 , strided <[40 , 10 , 2 , 1 ], offset : ?>>,
485
- %idx0 : index , %idx1 : index ) {
486
- %c0 = arith.constant 0 : index
487
- vector.transfer_write %value , %subview [%c0 , %idx0 , %idx1 , %c0 ] {in_bounds = [true , true ]} : vector <2 x2 xf32 >, memref <1 x3 x3 x2 xf32 , strided <[40 , 10 , 2 , 1 ], offset : ?>>
488
- return
489
- }
490
-
491
- // CHECK: #[[$MAP:.+]] = affine_map<()[s0] -> (s0 * 2)>
492
- // CHECK-LABEL: func.func @regression_non_contiguous_dim_write(
493
- // CHECK: %[[APPLY:.*]] = affine.apply #[[$MAP]]()
494
- // CHECK: %[[COLLAPSE:.+]] = memref.collapse_shape %{{.*}} {{\[}}[0], [1], [2, 3]] : memref<1x3x3x2xf32, strided<[40, 10, 2, 1], offset: ?>> into memref<1x3x6xf32, strided<[40, 10, 1], offset: ?>>
495
-
496
- // CHECK-128B-LABEL: func @regression_non_contiguous_dim_write(
497
- // CHECK-128B: memref.collapse_shape
498
-
499
500
// -----
500
501
501
502
func.func @negative_out_of_bound_transfer_read (
0 commit comments