[Mlir-commits] [mlir] [mlir][vector] Add tests xfer-permute-lowering (nfc)(2/n) (PR #96033)
Hugo Trachino
llvmlistbot at llvm.org
Thu Aug 1 01:19:17 PDT 2024
================
@@ -83,19 +110,44 @@ func.func @xfer_write_transposing_permutation_map_masked(
/// * vector.broadcast + vector.transpose + vector.transfer_write with a map
/// which _is_ a permutation of a minor identity
-// CHECK-LABEL: func @permutation_with_mask_xfer_write_fixed_width(
-// CHECK: %[[vec:.*]] = arith.constant dense<-2.000000e+00> : vector<7x1xf32>
-// CHECK: %[[mask:.*]] = arith.constant dense<[true, false, true, false, true, true, true]> : vector<7xi1>
-// CHECK: %[[b:.*]] = vector.broadcast %[[mask]] : vector<7xi1> to vector<1x7xi1>
-// CHECK: %[[tp:.*]] = vector.transpose %[[b]], [1, 0] : vector<1x7xi1> to vector<7x1xi1>
-// CHECK: vector.transfer_write %[[vec]], %{{.*}}[%{{.*}}, %{{.*}}], %[[tp]] {in_bounds = [false, true]} : vector<7x1xf32>, memref<?x?xf32>
-func.func @permutation_with_mask_xfer_write_fixed_width(%mem : memref<?x?xf32>, %base1 : index,
- %base2 : index) {
-
- %fn1 = arith.constant -2.0 : f32
- %vf0 = vector.splat %fn1 : vector<7xf32>
- %mask = arith.constant dense<[1, 0, 1, 0, 1, 1, 1]> : vector<7xi1>
- vector.transfer_write %vf0, %mem[%base1, %base2], %mask
+// CHECK-LABEL: func.func @xfer_write_non_transposing_permutation_map(
+// CHECK-SAME: %[[MEM:.*]]: memref<?x?xf32>,
+// CHECK-SAME: %[[VEC:.*]]: vector<7xf32>,
+// CHECK-SAME: %[[BASE_1:.*]]: index, %[[BASE_2:.*]]: index) {
+// CHECK: %[[BC:.*]] = vector.broadcast %[[VEC]] : vector<7xf32> to vector<1x7xf32>
+// CHECK: %[[TR:.*]] = vector.transpose %[[BC]], [1, 0] : vector<1x7xf32> to vector<7x1xf32>
+// CHECK: vector.transfer_write %[[TR]], %[[MEM]]{{\[}}%[[BASE_1]], %[[BASE_2]]] {in_bounds = [false, true]} : vector<7x1xf32>, memref<?x?xf32>
+func.func @xfer_write_non_transposing_permutation_map(
+ %mem : memref<?x?xf32>,
+ %arg0 : vector<7xf32>,
+ %base1 : index,
+ %base2 : index) {
----------------
nujaa wrote:
NIT: I'd suggest to use `%idx1` to match with other tests such as `masked_permutation_xfer_write_fixed_width` and your refacto of transfer-flatten.
I am not unhappy if you make it as part of a separate commit to tackle the above TODO. Also getting rid of `%dim` args and use `%idx`.
https://github.com/llvm/llvm-project/pull/96033
More information about the Mlir-commits
mailing list