[Mlir-commits] [mlir] [mlir][linalg] Vectorization support for convolution of i1 type (PR #109480)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Mon Sep 23 01:05:56 PDT 2024
================
@@ -654,6 +654,35 @@ func.func @conv_1d_nwc_wcf_mixed_int_fp_memref(%input: memref<1x2x3xi8>, %filter
// CHECK: %[[CONTRACT:.+]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[CAST0]], %[[CAST1]], %[[READ2]]
// CHECK: vector.transfer_write %[[CONTRACT]], %arg2[%[[I0]], %[[I0]], %[[I0]]]
+// -----
+
+func.func @conv2d_i1_i1_i1(%arg0: tensor<1x8x6xi1>, %arg1: tensor<8x8x1xi1>, %arg2: tensor<1x8x6xi1>) -> tensor<1x8x6xi1> {
+ %0 = linalg.conv_1d_ncw_fcw
+ {dilations = dense<1> : vector<1xi64>, strides = dense<1> : vector<1xi64>}
+ ins(%arg0, %arg1 : tensor<1x8x6xi1>, tensor<8x8x1xi1>)
+ outs(%arg2 : tensor<1x8x6xi1>) -> tensor<1x8x6xi1>
+ return %0 : tensor<1x8x6xi1>
+}
----------------
banach-space wrote:
Could you adopt one of the existing tests for `linalg.conv_1d_ncw_fcw` instead? And move this next to the original example that you would adopt? Thanks! This way it will be much easier to see all the cases that are tested for a particular Op. Also, it would be good to add a few more examples for `i1`.
IIUC, the only difference between `i1` and e.g. `i32` would be the combining Op in `vector.contract`? If that's the case, then IMHO you can write rather _reduced_ `CHECK` lines that primarily verify the contract Op. Everything else should be identical to what we get today for `i32`, right? As per https://mlir.llvm.org/getting_started/TestingGuide/:
> focus on testing the minimal set of functionalities needed
There's obviously room for interpretation and having more `CHECK` lines is also totally fine :)
https://github.com/llvm/llvm-project/pull/109480
More information about the Mlir-commits
mailing list