[LLVMdev] Loss of precision with very large branch weights

Philip Reames listmail at philipreames.com
Sat Apr 25 11:03:25 PDT 2015


On 04/24/2015 12:29 PM, Diego Novillo wrote:
>
>
> On Fri, Apr 24, 2015 at 3:28 PM, Xinliang David Li <davidxl at google.com 
> <mailto:davidxl at google.com>> wrote:
>
>     yes -- for count representation, 64 bit is needed. The branch weight
>     here is different and does not needs to be 64bit to represent branch
>     probability precisely.
>
>
> Actually, the branch weights are really counts. They get converted to 
> frequencies.  For frequencies, we don't really need 64bits, as they're 
> just comparative values that can be squished into 32bits.  It's the 
> branch weights being 32 bit quantities that are throwing off the 
> calculations.
Having branch weights as 64 bit seems entirely reasonable to me. 
Increasing the range of the value stored doesn't change the semantics no 
matter how you interpret them.  It does change the calculated 
frequencies, but only to make them more accurate.  I don't see any 
problem with that.

Philip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150425/8980ad40/attachment.html>


More information about the llvm-dev mailing list