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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 15:47:47 PDT 2022


craig.topper added a comment.

> The existing cost model decision to incorporate vector length into the cost seems quite odd to me.

Are you refering to the Log2_32_Ceil(VL)? If you don't build some optimized ALU, you need to perform log2(vl) stages to reduce to a single value.

> linear cost on ordered reductions makes little sense to me.

An ordered reduction should be linear across the vector. It also needs to be linear across every vector if we need to split. So it should be (LT.first * NumElements) for reducing each vector including the additional add for the scalar input. LT.first-1 scalar adds to join the reductions, I guess those could be chained using the scalar input to our instructions so maybe that is already costed. Then some base overhead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127447



More information about the llvm-commits mailing list