[PATCH] D24638: [thinlto] Basic thinlto fdo heuristic

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 06:21:01 PDT 2016


tejohnson added inline comments.

================
Comment at: llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp:291
@@ +290,3 @@
+        Edge.second.Hotness == CalleeInfo::HotnessType::Hot
+            ? Threshold * ImportHotMultiplier
+            : Threshold;
----------------
mehdi_amini wrote:
> tejohnson wrote:
> > mehdi_amini wrote:
> > > This does not seem correct to me. The multiplier should be apply only on the initial "seed" of the call chain, not at every chain.
> > The multiplier is applied to each call independently based on whether it is marked hot. E.g. if we have:
> > A -> B (hot call)
> > and then B has 2 calls:
> > B -> C1 (hot call)
> > and
> > B -> C2 (cold call)
> > 
> > I assume you are referring to A as the "seed" of the call chain? We want to treat the two different calls from B differently, it doesn't matter that the call from A -> B is hot.
> Ok I can see the logic. But I'm not convinced by the multiplier effect.
> i.e. right now as you get further from the original function, the threshold would *increase* since if I follow correctly we multiply by 3 here and by 0.7 later?
> I may miss something here.
> 
> i.e. with a sequence of A->B->C->D (all hot) the threshold evolves this way:
> 
> - call to B: 100
> - call to C: 100*3*0.7 = 210
> - call to D: 210*3*0.7 = 441
> 
> I wonder if a Bonus wouldn't be more appropriate.
> 
> Ok I can see the logic. But I'm not convinced by the multiplier effect.
> i.e. right now as you get further from the original function, the threshold would *increase* since if I follow correctly
> we multiply by 3 here and by 0.7 later?
>I may miss something here.

> i.e. with a sequence of A->B->C->D (all hot) the threshold evolves this way:

> call to B: 100
> call to C: 100*3*0.7 = 210
> call to D: 210*3*0.7 = 441
> I wonder if a Bonus wouldn't be more appropriate.

This isn't the case since (original) Threshold, not NewThreshold, is pushed into the Worklist. So the next level of callees again start with the original threshold, which is then decayed before being passed in here and multiplied. So in your example above, unless I am missing something, we get:

call to B: 100*3 = 300
call to C: 100*0.7*3 = 210
call to D: 100*0.7*0.7*3 = 147


Repository:
  rL LLVM

https://reviews.llvm.org/D24638





More information about the llvm-commits mailing list