[PATCH] D127447: [RISCV] Cost model for scalable reductions

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 15:10:11 PDT 2022


reames created this revision.
reames added reviewers: craig.topper, frasercrmck, kito-cheng.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, bollu, simoncook, johnrusso, rbar, asb, hiraditya, arichardson, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: alextsao1999, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

This extends the existing cost model for reductions for scalable vectors.

The existing cost model decision to incorporate vector length into the cost seems quite odd to me.  My best guess is that this is trying to account for cost of high lmul, but even for that, the linear cost on ordered reductions makes little sense to me.  I suspect what we should be doing here is figuring out LMUL, and then using that to bias cost away from high LMUL.

On the scalable side, I used the M value from <vscale x M x iN> value as a rough proxy.  This means that wider vectors are more expensive than narrow ones.  On the other hand, the costing across element types is less than uniform.  We also consider scalable vectors cheaper than most fixed length vectors.

Despite these irregularities, I think we should land this, and then return to the topic of better costs in a separate patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127447

Files:
  llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
  llvm/test/Analysis/CostModel/RISCV/reduce-scalable-fp.ll
  llvm/test/Analysis/CostModel/RISCV/reduce-scalable-int.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127447.435694.patch
Type: text/x-patch
Size: 111792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220609/8624093e/attachment-0001.bin>


More information about the llvm-commits mailing list