[all-commits] [llvm/llvm-project] d3fd28: [RISCV][TTI] Properly model odd vector sized LD/ST...

Philip Reames via All-commits all-commits at lists.llvm.org
Fri Jul 26 12:52:41 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d3fd28a13478786b3ebf092b8ebfcfd0c5e34928
      https://github.com/llvm/llvm-project/commit/d3fd28a13478786b3ebf092b8ebfcfd0c5e34928
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2024-07-26 (Fri, 26 Jul 2024)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
    M llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll
    M llvm/test/Transforms/LoopVectorize/RISCV/short-trip-count.ll

  Log Message:
  -----------
  [RISCV][TTI] Properly model odd vector sized LD/ST operations (#100436)

The motivation for this change is the costing of a LD or ST with nearly
power of 2 vectors (e.g. <3 x i32> or <7 x i32>) on V. There's an
experimental option in SLP to allow emitting these if the cost model
says they're profitable. This really helps with e.g. RGB vectors.

Our actual lowering for these depends on whether a wider container type
is known available. If so, we use a vle or vse on the wider type with a
restricted VL. If not, we split until a legal type is found, and then
apply the vle/vse on the sub-pieces.

This change is intentionally restricted to only the case where promotion
(widening w/VL predication) is involved. We appear to have at least one
bug in our splitting lowering (see discussion on review), and to avoid
exposing this more widely, I chose to not adjust costs for the splitting
case. The current splitting costing assumes scalarization (which is not
true of the actual lowering), but that has the effect of biasing
vectorization away from such cases strongly.

For the widening case, the true cost scales with the next largest legal
type. The default implementation assumes that such a type is scalarized.
Changing that brings our cost in line with our actual lowering decision.
Note that since scalarization is not possible for scalable types, the
prior costing falsely returned Invalid for that case.



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