<html><body><p><font size="2">Hi David,</font><br><br><font size="2">I think we should support multi-region outlining with and without PGO information at some point.  However, the scope of the current patch (D38190) should be </font><i><font size="2">with</font></i><font size="2"> PGO information only, as we haven't come up with a viable heuristic to outline multiple regions without PGO data.</font><br><br><font size="2">The current single region outlining (really, the 'tail' region of the function) seems to have some potential in various workloads, so I think it's worthwhile to turn it on by default to expose the optimization to various platforms and get more feedback on modifications/improvements we can add in the future.</font><br><br><font size="2">Cheers,</font><br><br><font size="2">Graham Yiu<br>LLVM Compiler Development<br>IBM Toronto Software Lab<br>Office: (905) 413-4077      C2-707/8200/Markham<br>Email: gyiu@ca.ibm.com</font><br><br><img width="16" height="16" src="cid:1__=8FBB0B5EDFFB1C788f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Xinliang David Li ---11/03/2017 02:58:56 PM---Hi Graham, thanks for driving this. I assume the multi-"><font size="2" color="#424282">Xinliang David Li ---11/03/2017 02:58:56 PM---Hi Graham, thanks for driving this. I assume the multi-region partial inliner you are working on wil</font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">Xinliang David Li <xinliangli@gmail.com></font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">Graham Yiu <gyiu@ca.ibm.com></font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">llvm-dev <llvm-dev@lists.llvm.org>, Jun Lim <junbuml@codeaurora.org></font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">11/03/2017 02:58 PM</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">Re: [RFC] Enable Partial Inliner by default</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br>Hi Graham, thanks for driving this. I assume the multi-region partial inliner you are working on will eventually replace the current single region partial-inliner and be turned on even without PGO.   If that is the plan, is it better to wait until that work is more complete, or the multi-region support will only be used with profile feedback?<br><br>David<br><br><br>On Thu, Nov 2, 2017 at 2:26 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" face="Courier New">Hello,</font><br><font size="2" face="Courier New"><br>I'd like to propose turning on the partial inliner (-enable-partial-inlining) by default.</font><br><font size="2" face="Courier New"><br>We've seen small gains on SPEC2006/2017 runtimes as well as lnt compile-times with a 2nd stage bootstrap of LLVM. We also saw positive gains on our internal workloads.</font><br><font size="2" face="Courier New"><br>-------------------------------------<br>Brief description of Partial Inlining<br>-------------------------------------<br>A pass in opt that runs after the normal inlining pass. Looks for branches to a return block in the entry and immediate successor blocks of a function. If found, it outlines the rest of the function using the CodeExtractor. It then attempts to inline the leftover entry block (and possibly one or more of its successors) to all its callers. This effectively peels the early return block(s) into the caller, which could be executed without incurring the call overhead of the function just to return immediately. Inlining and call overhead cost, as well as branch probabilities of the return block(s) are taken into account before inlining is done. If inlining is not successful, then the changes are discarded.</font><br><font size="2" face="Courier New"><br>eg.</font><br><font size="2" face="Courier New"><br>void foo() {<br>bar();<br>// rest of the code in foo<br>}</font><br><font size="2" face="Courier New"><br>void bar() {<br>if (X)<br>return;<br>// rest of code (to be outlined)<br>}</font><br><font size="2" face="Courier New"><br>After Partial Inlining:</font><br><font size="2" face="Courier New"><br>void foo() {<br>if (!X)<br>bar.outlined();<br>// rest of the code in foo<br>}</font><br><font size="2" face="Courier New"><br>void bar.outlined() {<br>// rest of the code in bar<br>}</font><br><br><font size="2" face="Courier New"><br>Here are the numbers on a Power8 PPCLE running Ubuntu 15.04 in ST-mode</font><br><font size="2" face="Courier New"><br>----------------------------------------------<br>Runtime performance (speed)<br>----------------------------------------------<br>Workload Improvement<br>-------- -----------<br>SPEC2006(C/C++) 0.06% (geomean)<br>SPEC2017(C/C++) 0.10% (geomean) <br>----------------------------------------------<br>Compile time performance for Bootstrapped LLVM<br>----------------------------------------------<br>Workload Improvement<br>-------- -----------<br>SPEC2006(C/C++) 0.41% (cumulative)<br>SPEC2017(C/C++) -0.16% (cumulative)<br>lnt 0.61% (geomean)<br>----------------------------------------------<br>Compile time performance<br>----------------------------------------------<br>Workload Increase<br>-------- --------<br>SPEC2006(C/C++) 1.31% (cumulative)<br>SPEC2017(C/C++) 0.25% (cumulative)<br>----------------------------------------------<br>Code size<br>----------------------------------------------<br>Workload Increase<br>-------- --------<br>SPEC2006(C/C++) 3.90% (geomean)<br>SPEC2017(C/C++) 1.05% (geomean)</font><br><font size="2" face="Courier New"><br>NOTE1: Code size increase in SPEC2006 was mainly attributed to benchmark "astar", which increased by 86%. Removing this outlier, we get a more reasonable increase of 0.58%.</font><br><font size="2" face="Courier New"><br>NOTE2: There is a patch up for review on Phabricator to enhance the partial inliner with the presence of profiling information (</font><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D38190&d=DwMFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=4ST7e3kMd0GTi3w9ByK5Cw&m=Kkz0daeyu83Fsw6kL02b3hcUghoF43AfmFpQP9D5enw&s=9_KVqNqUPSIOyMYiEOvb1Eo2pZNYDWjHyQBn4kc-cBM&e=" target="_blank"><u><font size="2" color="#0000FF" face="Courier New">https://reviews.llvm.org/D38190</font></u></a><font size="2" face="Courier New">).</font><font color="#888888"><br><br></font><font size="2" color="#888888"><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" color="#888888"> 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></ul><br>
<p><p><BR>
</body></html>