[PATCH] D127511: [RISCV] Refine costs for i1 reductions

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 10:11:48 PDT 2022


frasercrmck added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:329
+    // cost 2, but we don't have enough info here so we slightly over cost.
+    return 3;
+
----------------
One thing I've noticed is that we do use increasingly more `vmnand` as the vectors become larger and have to be split. Should we be taking this into account? See e.g. an `and` reduce with -riscv-v-vector-bits-min=128:

<256 x i1>:
        vmnot.m v8, v0
        vcpop.m a0, v8

<512 x i1>:
        vmand.mm        v8, v8, v10
        vmand.mm        v9, v0, v9
        vmnand.mm       v8, v9, v8
        vcpop.m a0, v8

<1024 x i1>:
        vmand.mm        v10, v10, v14
        vmand.mm        v8, v8, v12
        vmand.mm        v8, v8, v10
        vmand.mm        v9, v9, v13
        vmand.mm        v10, v0, v11
        vmand.mm        v9, v10, v9
        vmnand.mm       v8, v9, v8
        vcpop.m a0, v8


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127511/new/

https://reviews.llvm.org/D127511



More information about the llvm-commits mailing list