Skip to content

Commit a50b963

Browse files
authored
[mlir][vector] Add tests for xfer-flatten patterns (#102210)
Adds tests for scalable vectors in: * vector-transfer-flatten.mlir This is rather straightfoward as the tested patterns (*) do not support scalable vectors. (*) `FlattenContiguousRowMajorTransferReadPattern` and `FlattenContiguousRowMajorTransferWritePattern`
1 parent 67cb040 commit a50b963

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
///----------------------------------------------------------------------------------------
77
/// vector.transfer_read
88
/// [Pattern: FlattenContiguousRowMajorTransferReadPattern]
9+
///
10+
/// NOTE: Scalable vectors are not supported
911
///----------------------------------------------------------------------------------------
1012

1113
func.func @transfer_read_dims_match_contiguous(
@@ -28,6 +30,22 @@ func.func @transfer_read_dims_match_contiguous(
2830
// CHECK-128B-LABEL: func @transfer_read_dims_match_contiguous
2931
// CHECK-128B: memref.collapse_shape
3032

33+
func.func @transfer_read_dims_match_contiguous_scalable(
34+
%mem : memref<5x4x3x2xi8, strided<[24, 6, 2, 1], offset: ?>>) -> vector<5x4x3x[2]xi8> {
35+
36+
%c0 = arith.constant 0 : index
37+
%cst = arith.constant 0 : i8
38+
%res = vector.transfer_read %mem[%c0, %c0, %c0, %c0], %cst :
39+
memref<5x4x3x2xi8, strided<[24, 6, 2, 1], offset: ?>>, vector<5x4x3x[2]xi8>
40+
return %res : vector<5x4x3x[2]xi8>
41+
}
42+
43+
// CHECK-LABEL: func @transfer_read_dims_match_contiguous_scalable
44+
// CHECK-NOT: memref.collapse_shape
45+
46+
// CHECK-128B-LABEL: func @transfer_read_dims_match_contiguous_scalable
47+
// CHECK-128B-NOT: memref.collapse_shape
48+
3149
// -----
3250

3351
func.func @transfer_read_dims_match_contiguous_empty_stride(
@@ -259,6 +277,8 @@ func.func @transfer_read_non_contiguous_src(
259277
///----------------------------------------------------------------------------------------
260278
/// vector.transfer_write
261279
/// [Pattern: FlattenContiguousRowMajorTransferWritePattern]
280+
///
281+
/// NOTE: Scalable vectors are not supported
262282
///----------------------------------------------------------------------------------------
263283

264284
func.func @transfer_write_dims_match_contiguous(
@@ -281,6 +301,22 @@ func.func @transfer_write_dims_match_contiguous(
281301
// CHECK-128B-LABEL: func @transfer_write_dims_match_contiguous(
282302
// CHECK-128B: memref.collapse_shape
283303

304+
func.func @transfer_write_dims_match_contiguous_scalable(
305+
%mem : memref<5x4x3x2xi8, strided<[24, 6, 2, 1], offset: ?>>,
306+
%vec : vector<5x4x3x[2]xi8>) {
307+
308+
%c0 = arith.constant 0 : index
309+
vector.transfer_write %vec, %mem [%c0, %c0, %c0, %c0] :
310+
vector<5x4x3x[2]xi8>, memref<5x4x3x2xi8, strided<[24, 6, 2, 1], offset: ?>>
311+
return
312+
}
313+
314+
// CHECK-LABEL: func @transfer_write_dims_match_contiguous_scalable(
315+
// CHECK-NOT: memref.collapse_shape
316+
317+
// CHECK-128B-LABEL: func @transfer_write_dims_match_contiguous_scalable
318+
// CHECK-128B-NOT: memref.collapse_shape
319+
284320
// -----
285321

286322
func.func @transfer_write_dims_match_contiguous_empty_stride(
@@ -504,7 +540,11 @@ func.func @transfer_write_non_contiguous_src(
504540

505541
///----------------------------------------------------------------------------------------
506542
/// [Pattern: DropUnitDimFromElementwiseOps]
543+
///
507544
/// TODO: Move to a dedicated file - there's no "flattening" in the following tests
545+
/// TODO: Potential duplication with tests from:
546+
/// * "vector-dropleadunitdim-transforms.mlir"
547+
/// * "vector-transfer-drop-unit-dims-patterns.mlir"
508548
///----------------------------------------------------------------------------------------
509549

510550
func.func @fold_unit_dim_add_basic(%vec : vector<1x8xi32>) -> vector<1x8xi32> {

0 commit comments

Comments
 (0)