Skip to content

Commit 8ef0b0e

Browse files
committed
more tests
1 parent 6ece7aa commit 8ef0b0e

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

mlir/test/Dialect/Vector/canonicalize.mlir

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,6 +2857,37 @@ func.func @contiguous_gather(%base: memref<?xf32>,
28572857

28582858
// -----
28592859

2860+
// CHECK-LABEL: @contiguous_gather_non_zero_start(
2861+
// TODO: Non-zero start is not supported yet.
2862+
// CHECK: %[[R:.*]] = vector.gather
2863+
// CHECK: return %[[R]]
2864+
func.func @contiguous_gather_non_zero_start(%base: memref<?xf32>,
2865+
%mask: vector<16xi1>,
2866+
%passthru: vector<16xf32>) -> vector<16xf32> {
2867+
%c0 = arith.constant 0 : index
2868+
%indices = arith.constant dense<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]> : vector<16xi32>
2869+
%1 = vector.gather %base[%c0][%indices], %mask, %passthru :
2870+
memref<?xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32>
2871+
return %1 : vector<16xf32>
2872+
}
2873+
2874+
// -----
2875+
2876+
// CHECK-LABEL: @contiguous_gather_2d(
2877+
// TODO: Only 1D vectors are supported.
2878+
// CHECK: %[[R:.*]] = vector.gather
2879+
// CHECK: return %[[R]]
2880+
func.func @contiguous_gather_2d(%base: memref<?x?xf32>,
2881+
%mask: vector<4x4xi1>, %passthru: vector<4x4xf32>) -> vector<4x4xf32> {
2882+
%c0 = arith.constant 0 : index
2883+
%indices = arith.constant dense<[[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]]> : vector<4x4xi32>
2884+
%1 = vector.gather %base[%c0, %c0][%indices], %mask, %passthru :
2885+
memref<?x?xf32>, vector<4x4xi32>, vector<4x4xi1>, vector<4x4xf32> into vector<4x4xf32>
2886+
return %1 : vector<4x4xf32>
2887+
}
2888+
2889+
// -----
2890+
28602891
// CHECK-LABEL: @contiguous_gather_const_mask
28612892
// CHECK-SAME: (%[[BASE:.*]]: memref<?xf32>, %[[PASSTHRU:.*]]: vector<16xf32>)
28622893
// CHECK: %[[C0:.*]] = arith.constant 0 : index
@@ -2890,6 +2921,21 @@ func.func @contiguous_gather_step(%base: memref<?xf32>,
28902921

28912922
// -----
28922923

2924+
// CHECK-LABEL: @gather_broadcast(
2925+
// TODO: Broadcast is not supported yet
2926+
// CHECK: %[[R:.*]] = vector.gather
2927+
// CHECK: return %[[R]]
2928+
func.func @gather_broadcast(%base: memref<?xf32>,
2929+
%mask: vector<16xi1>, %passthru: vector<16xf32>) -> vector<16xf32> {
2930+
%c0 = arith.constant 0 : index
2931+
%indices = arith.constant dense<0> : vector<16xi32>
2932+
%1 = vector.gather %base[%c0][%indices], %mask, %passthru :
2933+
memref<?xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32>
2934+
return %1 : vector<16xf32>
2935+
}
2936+
2937+
// -----
2938+
28932939
// CHECK-LABEL: @contiguous_scatter
28942940
// CHECK-SAME: (%[[BASE:.*]]: memref<?xf32>, %[[MASK:.*]]: vector<16xi1>, %[[VALUE:.*]]: vector<16xf32>)
28952941
// CHECK: %[[C0:.*]] = arith.constant 0 : index

0 commit comments

Comments
 (0)