[all-commits] [llvm/llvm-project] 90d62e: [RISCV][TTI] Refine reverse shuffle costing for hi...

Philip Reames via All-commits all-commits at lists.llvm.org
Mon Jun 16 10:20:31 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 90d62e0ae352e67d808f94ffb6d215d033f4ec22
      https://github.com/llvm/llvm-project/commit/90d62e0ae352e67d808f94ffb6d215d033f4ec22
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2025-06-16 (Mon, 16 Jun 2025)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
    M llvm/test/Analysis/CostModel/RISCV/rvv-shuffle.ll
    M llvm/test/Analysis/CostModel/RISCV/shuffle-reverse.ll
    M llvm/test/Transforms/LoopVectorize/RISCV/riscv-vector-reverse.ll

  Log Message:
  -----------
  [RISCV][TTI] Refine reverse shuffle costing for high LMUL (#144155)

This contains two closely related changes:
1) Explicitly recurse on the i1 case - "3" happens to be the right
   magic constant at m1, but is not otherwise correct, and we're
   better off deferring this to existing logic.
2) Match the lowering for high LMUL shuffles - we've switched to using
   a linear number of m1 vrgather instead of a single big vrgather.
   This results in substantially faster (but also larger) code for
   reverse shuffles larger than m1.  Note that fixed vectors need
   a slide at the end, but scalable ones don't.

This will have the effect of biasing the vectorizer towards larger
(particularly scalable larger) vector factors. This increases VF for the
s112 and s1112 loops from TSVC_2 (in all configurations).

We could refine the high LMUL estimates a bit more, but I think getting
the linear scaling right is probably close enough for the moment.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list