<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 26, 2014 at 7:12 PM, <span dir="ltr"><<a href="mailto:ibaev@codeaurora.org" target="_blank">ibaev@codeaurora.org</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The BlockFrequency analysis has been useful for machine block placement,<br>
register allocation and other function-level optimizations. How could we<br>
extend it for use in an inter-procedural (whole-program) context? For<br>
example, if we would like to compare the hotness of two call sites in<br>
different functions, or calculate the hotness of two global variables<br>
referenced in multiple functions.<br></blockquote><div><br></div><div>BlockFrequency can not be used for inter-procedural analysis. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
If the ratio of a block BB frequency to the entry block frequency is the<br>
expected number of times the block BB will execute per entry to the<br>
function (according to LLVM Block Frequency Terminology page), would the<br>
multiplication of that ratio to the profile count of the function be a<br>
reasonable approximation of BB total execution count?<br></blockquote><div><br></div><div>The answer depends on how BB frequency is computed. If BB frequency is directly scaled from BB profile count (Execution count), then the answer is 'yes'. In the current implementation, the answer is 'no'. LLVM only keeps branch probability information from the profile data, and BB frequency is computed from branch probabilities: There are known limitations of the frequency propagation algorithm to make the resulting frequency 'distorted'. To name a few: loop scale is capped at 4096; branch weight is incremented by 1 (leading to issues such as computed loop trip count as low as half of the actual count); limitation of handling irreducible loops etc. In fact, frequency can not be reliably be used for comparison across different loop nests.</div><div><br></div><div>We have plans to address those issues to improve PGO.</div><div><br></div><div>thanks,</div><div><br></div><div>David</div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks,<br>
Ivan<br>
<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div></div></div>