[RISCV][CostModel] Model vrgather.vv as being quadradic in LMUL
authorPhilip Reames <preames@rivosinc.com>
Tue, 18 Jul 2023 16:46:15 +0000 (09:46 -0700)
committerPhilip Reames <listmail@philipreames.com>
Tue, 18 Jul 2023 18:52:34 +0000 (11:52 -0700)
commit7cc6b80d9a97602bd8f3bc5333cd26020a3726da
treeb238c7f6854255c961cbad11b69fc0522696162e
parentd2ac0069a21b79efdcd32ba4cc44dc7f08a25b8b
[RISCV][CostModel] Model vrgather.vv as being quadradic in LMUL

vrgather.vv across multiple vector registers (i.e. LMUL > 1) requires all to all data movement. This includes two conceptual sets of changes:

    For permutes, we were modeling these as being linear in LMUL.
    For reverse, we were modeling them as being fixed cost in LMUL.

Both were wrong, and have been adjusted to O(LMUL^2).  Noticed via code inspection while looking at something else.

Its worth asking whether we should be lowering reverse to something other than a vrgather at high LMULs. That shuffle is quite expensive.  (Future work)

Differential Revision: https://reviews.llvm.org/D152019
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
llvm/test/Analysis/CostModel/RISCV/rvv-shuffle.ll
llvm/test/Analysis/CostModel/RISCV/shuffle-interleave.ll
llvm/test/Analysis/CostModel/RISCV/shuffle-permute.ll
llvm/test/Analysis/CostModel/RISCV/shuffle-reverse.ll
llvm/test/Transforms/LoopVectorize/RISCV/interleaved-accesses.ll
llvm/test/Transforms/LoopVectorize/RISCV/riscv-vector-reverse.ll