[Mlir-commits] [mlir] [mlir][vector] Update tests for xfer-permute-lowering (nfc) (PR #101468)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Thu Aug 1 08:00:56 PDT 2024
================
@@ -145,76 +143,109 @@ func.func @xfer_write_non_transposing_permutation_map(
// CHECK: vector.transfer_write %[[TR_VEC]], %[[MEM]]{{\[}}%[[IDX_1]], %[[IDX_2]]], %[[TR_MASK]] {in_bounds = [false, true]} : vector<7x1xf32>, memref<?x?xf32>
func.func @xfer_write_non_transposing_permutation_map_with_mask_out_of_bounds(
%mem : memref<?x?xf32>,
- %arg0 : vector<7xf32>,
+ %vec : vector<7xf32>,
%idx_1 : index,
%idx_2 : index,
%mask : vector<7xi1>) {
- vector.transfer_write %arg0, %mem[%idx_1, %idx_2], %mask
- {permutation_map = affine_map<(d0, d1) -> (d0)>, in_bounds = [false]}
- : vector<7xf32>, memref<?x?xf32>
+ vector.transfer_write %vec, %mem[%idx_1, %idx_2], %mask {
+ permutation_map = affine_map<(d0, d1) -> (d0)>,
+ in_bounds = [false]
+ } : vector<7xf32>, memref<?x?xf32>
+
return
}
// CHECK: func.func @permutation_with_mask_xfer_write_scalable(
-// CHECK-SAME: %[[ARG_0:.*]]: vector<4x[8]xi16>,
-// CHECK-SAME: %[[ARG_1:.*]]: memref<1x4x?x1xi16>,
+// CHECK-SAME: %[[VEC:.*]]: vector<4x[8]xi16>,
+// CHECK-SAME: %[[MEM:.*]]: memref<1x4x?x1xi16>,
// CHECK-SAME: %[[MASK:.*]]: vector<4x[8]xi1>) {
// CHECK: %[[C0:.*]] = arith.constant 0 : index
-// CHECK: %[[BCAST_1:.*]] = vector.broadcast %[[ARG_0]] : vector<4x[8]xi16> to vector<1x4x[8]xi16>
+// CHECK: %[[BCAST_1:.*]] = vector.broadcast %[[VEC]] : vector<4x[8]xi16> to vector<1x4x[8]xi16>
// CHECK: %[[BCAST_2:.*]] = vector.broadcast %[[MASK]] : vector<4x[8]xi1> to vector<1x4x[8]xi1>
// CHECK: %[[TRANSPOSE_1:.*]] = vector.transpose %[[BCAST_2]], [1, 2, 0] : vector<1x4x[8]xi1> to vector<4x[8]x1xi1>
// CHECK: %[[TRANSPOSE_2:.*]] = vector.transpose %[[BCAST_1]], [1, 2, 0] : vector<1x4x[8]xi16> to vector<4x[8]x1xi16>
-// CHECK: vector.transfer_write %[[TRANSPOSE_2]], %[[ARG_1]]{{.*}}, %[[TRANSPOSE_1]] {in_bounds = [true, true, true]} : vector<4x[8]x1xi16>, memref<1x4x?x1xi16>
-func.func @permutation_with_mask_xfer_write_scalable(%arg0: vector<4x[8]xi16>, %mem: memref<1x4x?x1xi16>, %mask: vector<4x[8]xi1>){
- %c0 = arith.constant 0 : index
- vector.transfer_write %arg0, %mem[%c0, %c0, %c0, %c0], %mask {in_bounds = [true, true], permutation_map = affine_map<(d0, d1, d2, d3) -> (d1, d2)>
-} : vector<4x[8]xi16>, memref<1x4x?x1xi16>
+// CHECK: vector.transfer_write %[[TRANSPOSE_2]], %[[MEM]]{{.*}}, %[[TRANSPOSE_1]] {in_bounds = [true, true, true]} : vector<4x[8]x1xi16>, memref<1x4x?x1xi16>
+func.func @permutation_with_mask_xfer_write_scalable(
+ %vec: vector<4x[8]xi16>,
+ %mem: memref<1x4x?x1xi16>,
+ %mask: vector<4x[8]xi1>){
- return
+ %c0 = arith.constant 0 : index
+ vector.transfer_write %vec, %mem[%c0, %c0, %c0, %c0], %mask {
+ in_bounds = [true, true],
+ permutation_map = affine_map<(d0, d1, d2, d3) -> (d1, d2)>
+ } : vector<4x[8]xi16>, memref<1x4x?x1xi16>
+
+ return
}
// transfer_write in MaskOp case not supported.
// CHECK-LABEL: func @masked_permutation_xfer_write_fixed_width
-// CHECK-SAME: %[[ARG_0:.*]]: tensor<?x?xf32>,
-// CHECK-SAME: %[[ARG_1:.*]]: vector<16xf32>,
-// CHECK-SAME: %[[IDX:.*]]: index,
-// CHECK-SAME: %[[MASK:.*]]: vector<16xi1>
+// CHECK-SAME: %[[DEST:.*]]: tensor<?x?xf32>,
+// CHECK-SAME: %[[VEC:.*]]: vector<16xf32>,
+// CHECK-SAME: %[[IDX:.*]]: index,
+// CHECK-SAME: %[[MASK:.*]]: vector<16xi1>
// CHECK-NOT: vector.transpose
-// CHECK: %[[RES:.*]] = vector.mask %[[MASK]] { vector.transfer_write %[[ARG_1]], %[[ARG_0]]{{.*}} vector<16xf32>, tensor<?x?xf32> } : vector<16xi1> -> tensor<?x?xf32>
-func.func @masked_permutation_xfer_write_fixed_width(%t: tensor<?x?xf32>, %val: vector<16xf32>, %idx: index, %mask: vector<16xi1>) -> tensor<?x?xf32> {
- %r = vector.mask %mask { vector.transfer_write %val, %t[%idx, %idx] {permutation_map = affine_map<(d0, d1) -> (d0)>} : vector<16xf32>, tensor<?x?xf32> } : vector<16xi1> -> tensor<?x?xf32>
+// CHECK: %[[RES:.*]] = vector.mask %[[MASK]] { vector.transfer_write %[[VEC]], %[[DEST]]{{.*}} vector<16xf32>, tensor<?x?xf32> } : vector<16xi1> -> tensor<?x?xf32>
+func.func @masked_permutation_xfer_write_fixed_width(
+ %dest: tensor<?x?xf32>,
+ %val: vector<16xf32>,
+ %idx: index,
+ %mask: vector<16xi1>) -> tensor<?x?xf32> {
+
+ %r = vector.mask %mask {
+ vector.transfer_write %val, %dest[%idx, %idx] {
+ permutation_map = affine_map<(d0, d1) -> (d0)>
+ } : vector<16xf32>, tensor<?x?xf32>
+ } : vector<16xi1> -> tensor<?x?xf32>
+
return %r : tensor<?x?xf32>
}
// CHECK-LABEL: func.func @masked_permutation_xfer_write_scalable(
-// CHECK-SAME: %[[ARG_0:.*]]: vector<4x[8]xi16>,
-// CHECK-SAME: %[[ARG_1:.*]]: tensor<?x?x?x?xf32>,
-// CHECK-SAME: %[[MASK:.*]]: vector<4x[8]xi1>)
-// CHECK-SAME: -> tensor<?x?x?x?xf32> {
+// CHECK-SAME: %[[VEC:.*]]: vector<4x[8]xi16>,
+// CHECK-SAME: %[[DEST:.*]]: tensor<?x?x?x?xf32>,
+// CHECK-SAME: %[[MASK:.*]]: vector<4x[8]xi1>)
+// CHECK-SAME: -> tensor<?x?x?x?xf32> {
// CHECK-NOT: vector.transpose
-// CHECK: %[[R:.*]] = vector.mask %[[MASK]] { vector.transfer_write %[[ARG_0]], %[[ARG_1]]{{.*}} : vector<4x[8]xi16>, tensor<?x?x?x?xf32> } : vector<4x[8]xi1> -> tensor<?x?x?x?xf32>
-func.func @masked_permutation_xfer_write_scalable(%arg0: vector<4x[8]xi16>, %t: tensor<?x?x?x?xf32>, %mask: vector<4x[8]xi1>) -> tensor<?x?x?x?xf32> {
- %c0 = arith.constant 0 : index
- %r = vector.mask %mask { vector.transfer_write %arg0, %t[%c0, %c0, %c0, %c0] {in_bounds = [true, true], permutation_map = affine_map<(d0, d1, d2, d3) -> (d1, d2)>
-} : vector<4x[8]xi16>, tensor<?x?x?x?xf32> } : vector<4x[8]xi1> -> tensor<?x?x?x?xf32>
+// CHECK: %[[R:.*]] = vector.mask %[[MASK]] { vector.transfer_write %[[VEC]], %[[DEST]]{{.*}} : vector<4x[8]xi16>, tensor<?x?x?x?xf32> } : vector<4x[8]xi1> -> tensor<?x?x?x?xf32>
----------------
banach-space wrote:
Let me, instead, remove ` %[[R:.*]] ` - it's not used (as in, no need to define variables that are not used)
https://github.com/llvm/llvm-project/pull/101468
More information about the Mlir-commits
mailing list