[llvm-commits] BlockFrequency for BasicBlocks

Jakub Staszak jstaszak at apple.com
Wed Jun 22 18:16:13 PDT 2011


To the cyclic_probability we have to add backedge probability, it is probability of getting to the DST block through the SRC block. In the original algorithm we used floating point numbers, but here we use integers with START_FREQ = 1024, thus we have to "normalize" the value and look at it as a probability  where 1024 is equal to 1.0. 

Previously we used getEdgeFreq which is wrong, because sum of them for some BB from all its predecessors might be greater than START_FREQ.

BTW: I forgot to delete DSE.cpp part, which is use for the testing purpose.

-Kuba

On Jun 22, 2011, at 5:47 PM, Andrew Trick wrote:

> Where do you check underflow of block frequency? It seems that 10 sequential branches with default weights would result in getEdgeFreq() returning zero.
> 
> I'm not sure what getBackSumForBlock() means. The previous code looks correct to me. Can you explain the problem that you're solving?
> 
> Thanks.
> 
> -Andy
> 
> On Jun 22, 2011, at 2:39 PM, Jakub Staszak wrote:
> 
>> 
>> On Jun 21, 2011, at 8:21 PM, Andrew Trick wrote:
>> 
>>> 
>>> Yes, by "1" I meant literal 1, not scaled 1. I think this could happen inside getEdgeFreq() when (N * getBlockFreq(Src)) < D. You should probably check for that case and return the smallest nonzero frequency.
>>> 
>>> You actually shouldn't have a problem in divBlockFreq, but somewhere you should assert that the input BranchProbability is well-formed (N < D).
>> 
>> The bug was in the complete different place. Instead of using backedge probability info (probability of getting to DST block through SRC block) i used edge probability. It caused some problem in very rare cases (only during benchmarking).
>> 
>> 
>>> -Andy
>>> 
>>> 
>> <bf4bb.5.patch>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110622/fe3b958c/attachment.html>


More information about the llvm-commits mailing list