[PATCH] D26277: [SLP] Fixed cost model for horizontal reduction.

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 9 05:59:47 PST 2016


ABataev marked 3 inline comments as done.
ABataev added inline comments.


================
Comment at: include/llvm/CodeGen/BasicTTIImpl.h:928
     unsigned NumVecElts = Ty->getVectorNumElements();
     unsigned NumReduxLevels = Log2_32(NumVecElts);
+    unsigned ArithCost = 0;
----------------
mkuper wrote:
> The computation is getting pretty hairy. Could you please add comments explaining what exactly it computes?
> 
> I understand you're trying to model the reduction steps performed on illegal vectors and steps performed on legal steps separately, but I'm not sure this computes precisely what we want.
Added several lines of comments trying to explain the new code.


================
Comment at: include/llvm/CodeGen/BasicTTIImpl.h:934
+    unsigned I = 0;
+    for (I = 0; LT.first > 2; ++I) {
+      NumVecElts /= 2;
----------------
mkuper wrote:
> I counts the number of illegal reduction steps, right?
> Maybe give it a more meaningful name? It's not a regular loop counter where it's obvious what it counts up to.
Changed to while loop.


https://reviews.llvm.org/D26277





More information about the llvm-commits mailing list