[Mlir-commits] [mlir] [MLIR][Vector] Implement transferXXPermutationLowering as MaskableOpRewritePattern (PR #91987)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Tue May 14 02:10:49 PDT 2024
================
@@ -46,6 +46,52 @@ func.func @permutation_with_mask_xfer_write_scalable(%arg0: vector<4x[8]xi16>, %
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: %[[RES:.*]] = vector.mask %[[MASK]] { vector.transfer_write %[[ARG_1]], %[[ARG_0]][%[[IDX]], %[[IDX]]] {{.*}} vector<16xf32>, tensor<?x?xf32> } : vector<16xi1> -> tensor<?x?xf32>
+// CHECK: return %[[RES]]
----------------
banach-space wrote:
[NIT] Note that for a negative test, this would be sufficient ("less is more"):
```mlir
// CHECK-LABEL: func @masked_permutation_xfer_write_fixed_width
// CHECK-NOT: vector.transpose
// CHECK: vector.mask %{{.*}} { vector.transfer_write {{.*}} } : vector<16xi1> -> tensor<?x?xf32>
```
It's quite tempting to test more, but we only need to check that:
* there is not `vector.tranpose` (that would indicate that the patter was applied)
* the original masked Op is still there
This is a matter of preference though, both approaches are valid :)
https://github.com/llvm/llvm-project/pull/91987
More information about the Mlir-commits
mailing list