Skip to content

Commit b653357

Browse files
authored
[mlir][vector][NFC] Make function name more meaningful in lit tests. (#94538)
It also moves the test near other similar test cases.
1 parent c467e60 commit b653357

File tree

1 file changed

+38
-37
lines changed

1 file changed

+38
-37
lines changed

mlir/test/Dialect/Vector/vector-transfer-flatten.mlir

+38-37
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@ func.func @transfer_read_dims_mismatch_non_zero_indices(
102102

103103
// -----
104104

105+
func.func @transfer_read_dims_mismatch_non_contiguous_non_zero_indices(
106+
%subview : memref<1x3x3x2xf32, strided<[40, 10, 2, 1], offset: ?>>,
107+
%idx0 : index, %idx1 : index) -> vector<2x2xf32> {
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<1x3x3x2xf32, strided<[40, 10, 2, 1], offset: ?>>, vector<2x2xf32>
111+
return %8 : vector<2x2xf32>
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+
105124
// The input memref has a dynamic trailing shape and hence is not flattened.
106125
// TODO: This case could be supported via memref.dim
107126

@@ -212,6 +231,25 @@ func.func @transfer_write_dims_mismatch_contiguous(
212231

213232
// -----
214233

234+
func.func @transfer_write_dims_mismatch_non_contiguous_non_zero_indices(
235+
%value : vector<2x2xf32>,
236+
%subview : memref<1x3x3x2xf32, 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<2x2xf32>, memref<1x3x3x2xf32, 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+
215253
func.func @transfer_write_dims_mismatch_non_contiguous(
216254
%arg : memref<5x4x3x2xi8, strided<[24, 6, 2, 1], offset: ?>>, %vec : vector<2x1x2x2xi8>) {
217255
%c0 = arith.constant 0 : index
@@ -459,43 +497,6 @@ func.func @fold_unit_dims_entirely(%arg0 : vector<8xi32>,
459497
// CHECK-128B-LABEL: func @fold_unit_dims_entirely(
460498
// CHECK-128B-NOT: memref.collapse_shape
461499

462-
463-
// -----
464-
465-
func.func @regression_non_contiguous_dim_read(%subview : memref<1x3x3x2xf32, strided<[40, 10, 2, 1], offset: ?>>,
466-
%idx0 : index, %idx1 : index) -> vector<2x2xf32> {
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<1x3x3x2xf32, strided<[40, 10, 2, 1], offset: ?>>, vector<2x2xf32>
470-
return %8 : vector<2x2xf32>
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<2x2xf32>,
484-
%subview : memref<1x3x3x2xf32, 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<2x2xf32>, memref<1x3x3x2xf32, 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-
499500
// -----
500501

501502
func.func @negative_out_of_bound_transfer_read(

0 commit comments

Comments
 (0)