<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 3, 2017 at 2:10 PM, Graham Yiu <span dir="ltr"><<a href="mailto:gyiu@ca.ibm.com" target="_blank">gyiu@ca.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><p><font size="2">Thanks Easwaran.  This is what we've observed as well, where the old PM inliner was only looking hot/cold callee information, which have signficantly smaller boosts/penalties compared to callsite information.</font><br><br><font size="2">Teresa, do you know if there is some documentation/video/<wbr>presentation on how PGO information is represented in LLVM and what information is passed via the IR?  I'm finding some difficulty in getting the big picture via the code.</font></p></div></blockquote><div><br></div><div>The documentation I am aware of is in the Language Ref and a subpage linked from here:</div><div><a href="https://llvm.org/docs/LangRef.html#prof-metadata">https://llvm.org/docs/LangRef.html#prof-metadata</a></div><div><br></div><div>If that doesn't help let me know and I can point you to someone who would know (if I can't answer it myself).</div><div><br></div><div>Teresa </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><p><span class="gmail-"><br><br><font size="2">Graham Yiu<br>LLVM Compiler Development<br>IBM Toronto Software Lab<br>Office: <a href="tel:(905)%20413-4077" value="+19054134077" target="_blank">(905) 413-4077</a>      C2-707/8200/Markham<br>Email: <a href="mailto:gyiu@ca.ibm.com" target="_blank">gyiu@ca.ibm.com</a></font><br><br></span><span class="gmail-"><img width="16" height="16" src="cid:1__=8FBB0B3DDFE040B78f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Teresa Johnson ---10/03/2017 05:00:11 PM---On Tue, Oct 3, 2017 at 1:55 PM, Easwaran Raman <eraman@goo"><font size="2" color="#424282">Teresa Johnson ---10/03/2017 05:00:11 PM---On Tue, Oct 3, 2017 at 1:55 PM, Easwaran Raman <<a href="mailto:eraman@google.com" target="_blank">eraman@google.com</a>> wrote: ></font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">Teresa Johnson <<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>></font><br></span><font size="2" color="#5F5F5F">To:        </font><font size="2">Easwaran Raman <<a href="mailto:eraman@google.com" target="_blank">eraman@google.com</a>></font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">Graham Yiu <<a href="mailto:gyiu@ca.ibm.com" target="_blank">gyiu@ca.ibm.com</a>>, llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">10/03/2017 05:00 PM</font></p><div><div class="gmail-h5"><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">Re: [llvm-dev] PGO information at LTO/thinLTO link step</font><br><hr width="100%" size="2" align="left" noshade style="color:rgb(128,145,165)"><br><br><br><br><br>On Tue, Oct 3, 2017 at 1:55 PM, Easwaran Raman <<a href="mailto:eraman@google.com" target="_blank"><u><font color="#0000FF">eraman@google.com</font></u></a>> wrote:
<ul><br><br>On Tue, Oct 3, 2017 at 1:46 PM, Teresa Johnson via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank"><u><font color="#0000FF">llvm-dev@lists.llvm.org</font></u></a>> wrote:<br><br><br>On Tue, Oct 3, 2017 at 1:38 PM, Graham Yiu <<a href="mailto:gyiu@ca.ibm.com" target="_blank"><u><font color="#0000FF">gyiu@ca.ibm.com</font></u></a>> wrote:
<ul><font size="2">Hi Teresa,</font><br><font size="2"><br>Actually, enabling the new pass manager manually seems to have solved this issue, so this problem is only valid for the old pass manager.</font></ul><br><br>It should not be an issue in the old PM either - the callsite hotness is passed via IR.<br>More precisely, the function entry counts are passed via IR. With the old PM,  we don't have callsite hotness information, but callee's entry count is used to boost the threshold. </ul><br>Thanks for the clarification. (But essentially there should be no difference between the profile info in the IR in the compile step vs the link aka ThinLTO backend steps - the inliner in both cases is working off the same profile info in the IR) 
<ul> <br>As David mentioned, the new PM inliner does a better job of updating call hotness after inlining, but it should be there (some things might look hotter than then should, which seems to be the opposite of the problem you are hitting). Can you send me a reproducer with the old PM?<br><br>Teresa
<ul><br><font size="2"><br>Thanks,</font><br><font size="2"><br>Graham Yiu<br>LLVM Compiler Development<br>IBM Toronto Software Lab<br>Office: </font><a href="tel:(905)%20413-4077" target="_blank"><u><font size="2" color="#0000FF">(905) 413-4077</font></u></a><font size="2"> C2-707/8200/Markham<br>Email: </font><a href="mailto:gyiu@ca.ibm.com" target="_blank"><u><font size="2" color="#0000FF">gyiu@ca.ibm.com</font></u></a><br><br><img src="cid:1__=8FBB0B3DDFE040B78f9e8a93df938690918c8FB@" width="16" height="16" alt="Inactive hide details for Teresa Johnson ---10/03/2017 04:18:17 PM---On Tue, Oct 3, 2017 at 12:54 PM, Graham Yiu via llvm-dev <"><font size="2" color="#424282">Teresa Johnson ---10/03/2017 04:18:17 PM---On Tue, Oct 3, 2017 at 12:54 PM, Graham Yiu via llvm-dev < </font><a href="mailto:llvm-dev@lists.llvm.org" target="_blank"><u><font size="2" color="#0000FF">llvm-dev@lists.llvm.org</font></u></a><font size="2" color="#424282">> wrote:</font><br><font size="2" color="#5F5F5F"><br>From: </font><font size="2">Teresa Johnson <</font><a href="mailto:tejohnson@google.com" target="_blank"><u><font size="2" color="#0000FF">tejohnson@google.com</font></u></a><font size="2">></font><font size="2" color="#5F5F5F"><br>To: </font><font size="2">Graham Yiu <</font><a href="mailto:gyiu@ca.ibm.com" target="_blank"><u><font size="2" color="#0000FF">gyiu@ca.ibm.com</font></u></a><font size="2">></font><font size="2" color="#5F5F5F"><br>Cc: </font><font size="2">llvm-dev <</font><a href="mailto:llvm-dev@lists.llvm.org" target="_blank"><u><font size="2" color="#0000FF">llvm-dev@lists.llvm.org</font></u></a><font size="2">></font><font size="2" color="#5F5F5F"><br>Date: </font><font size="2">10/03/2017 04:18 PM</font><font size="2" color="#5F5F5F"><br>Subject: </font><font size="2">Re: [llvm-dev] PGO information at LTO/thinLTO link step</font><br><hr width="100%" size="2" align="left" noshade><br><br><br><br><br><br>On Tue, Oct 3, 2017 at 12:54 PM, Graham Yiu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank"><u><font color="#0000FF">llvm-dev@lists.llvm.org</font></u></a>> wrote: 
<ul><ul><font size="2">Hello,<br><br>My team and I noticed that callsite hotness information is not preserved from compile to link step with LTO/thinLTO enabled. As a result, the link step inlining pass remains conservative when inlining callsites known to be hot (ie. without the 'HotCallSiteThreshold' which is set at 3000 by default). There are likely many cross-module inlining opportunities lost this way, and diminishes the benefit of using LTO/thinLTO+PGO together.</font></ul></ul><br><br>The callsite hotness is passed via the IR, so it should be there in the LTO/ThinLTO backends (during the link step). Can you provide a reproducer where that isn't happening? <br>Teresa 
<ul><ul><font size="2"><br><br>In general, does LLVM pass profiling information through the IR to the link step other than branch probabilities and function entry counts? If not, are there plans to do so in the future? For inlining specifically, perhaps we can mark callsites with hot/cold attributes during compile step to ensure LTO inlining will give appropriate threshold bonuses/penalties.<br><br>Any thoughts/insights/comments would be appreciated.<br><br>Cheers,<br><br>Graham Yiu<br>LLVM Compiler Development<br>IBM Toronto Software Lab<br>Office: </font><a href="tel:(905)%20413-4077" target="_blank"><u><font size="2" color="#0000FF">(905) 413-4077</font></u></a><font size="2"> C2-707/8200/Markham<br>Email: </font><a href="mailto:gyiu@ca.ibm.com" target="_blank"><u><font size="2" color="#0000FF">gyiu@ca.ibm.com</font></u></a><br><br>______________________________<wbr>_________________<br>LLVM Developers mailing list<u><font color="#0000FF"><br></font></u><a href="mailto:llvm-dev@lists.llvm.org" target="_blank"><u><font color="#0000FF">llvm-dev@lists.llvm.org</font></u></a><u><font color="#0000FF"><br></font></u><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwMFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=4ST7e3kMd0GTi3w9ByK5Cw&m=843dScatsnrNnnksXYIg_bhjifer5nLwDpeZvFGhfsY&s=ophNPzRTV6yMQdp3RxwwiV4szFjf6F8lnEyy9Y5paxw&e=" target="_blank"><u><font color="#0000FF">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</font></u></a></ul></ul><br><br><br>-- 
<table border="1"><tbody><tr valign="top"><td width="90" valign="middle"><font size="2" color="#555555">Teresa Johnson |</font></td><td width="105" valign="middle"><font size="2" color="#555555"> Software Engineer |</font></td><td width="136" valign="middle"><font size="2" color="#555555"> </font><a href="mailto:tejohnson@google.com" target="_blank"><u><font size="2" color="#0000FF">tejohnson@google.com</font></u></a><font size="2" color="#555555"> |</font></td><td width="71" valign="middle"><font size="2" color="#555555"> </font><a href="tel:(408)%20460-2413" target="_blank"><u><font size="2" color="#0000FF">408-460-2413</font></u></a></td></tr></tbody></table><br><br></ul><br><br><br><br>-- 
<table border="1"><tbody><tr valign="top"><td width="90" valign="middle"><font size="2" color="#555555">Teresa Johnson |</font></td><td width="105" valign="middle"><font size="2" color="#555555"> Software Engineer |</font></td><td width="136" valign="middle"><font size="2" color="#555555"> </font><a href="mailto:tejohnson@google.com" target="_blank"><u><font size="2" color="#0000FF">tejohnson@google.com</font></u></a><font size="2" color="#555555"> |</font></td><td width="71" valign="middle"><font size="2" color="#555555"> </font><a href="tel:(408)%20460-2413" target="_blank"><u><font size="2" color="#0000FF">408-460-2413</font></u></a></td></tr></tbody></table><br>______________________________<wbr>_________________<br>LLVM Developers mailing list<u><font color="#0000FF"><br></font></u><a href="mailto:llvm-dev@lists.llvm.org" target="_blank"><u><font color="#0000FF">llvm-dev@lists.llvm.org</font></u></a><u><font color="#0000FF"><br></font></u><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwMFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=4ST7e3kMd0GTi3w9ByK5Cw&m=38hnZvEzFyovf0wgsdGGbzKq028feXdugel47ntZ4Lo&s=SfjVDeS9ryb7NpC-k_7Igt-khIsUZXWe76rgwPv3aVA&e=" target="_blank"><u><font color="#0000FF">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</font></u></a><br><br></ul><br><br><br>-- 
<table border="1"><tbody><tr valign="top"><td width="90" valign="middle"><font size="2" color="#555555">Teresa Johnson |</font></td><td width="105" valign="middle"><font size="2" color="#555555"> Software Engineer |</font></td><td width="136" valign="middle"><font size="2" color="#555555"> </font><a href="mailto:tejohnson@google.com" target="_blank"><u><font size="2" color="#0000FF">tejohnson@google.com</font></u></a><font size="2" color="#555555"> |</font></td><td width="71" valign="middle"><font size="2" color="#555555"> <a href="tel:(408)%20460-2413" value="+14084602413" target="_blank">408-460-2413</a></font></td></tr></tbody></table><br><br><br>
</div></div><p></p></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top:2px solid rgb(213,15,37)">Teresa Johnson |</td><td nowrap style="border-top:2px solid rgb(51,105,232)"> Software Engineer |</td><td nowrap style="border-top:2px solid rgb(0,153,57)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top:2px solid rgb(238,178,17)"> 408-460-2413</td></tr></tbody></table></span></div>
</div></div>