[PATCH] D105432: [Analysis] Add simple cost model for strict (in-order) reductions

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 6 05:57:26 PDT 2021


david-arm added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:2085
+  InstructionCost
+  getArithmeticStrictReductionCost(unsigned Opcode, VectorType *Ty,
+                                   TTI::TargetCostKind CostKind) {
----------------
dmgreen wrote:
> sdesmalen wrote:
> > Can you unify the interface for getArithmeticReductionCost to take an enum which specifies the kind of reduction we want: tree, pair-wise or in-order?
> > If there is only a single `getReductionCost` interface where the parameters dictate having to specify what cost is being asked for, than that's difficult to get wrong (you need to fill in the parameters), but if there's another slightly more specialized variant available, people may not realise it exists and just call the most basic cost interface instead.
> Oh you got here first.  :)
> 
> I think we can possibly remove IsPairwise entirely. It seems to be only used in a single place nowadays that doesn't seem to me like it would be giving very good cost estimates.
Hi @dmgreen, it turns out removing the pairwise form breaks *lots* of tests. :) I think it's still needed because `TTI::matchVectorReduction` returns the pairwise form for a lot of cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105432



More information about the llvm-commits mailing list