<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Open Sans";
        panose-1:2 11 6 6 3 5 4 2 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">This is a topic that has been discussed a few times in the past. Currently CGSCC inliner doesn’t use a size/growth cap, so the value of call site prioritization is questionable as we’re going to inline everything deemed beneficial anyways.
 But prioritization would be helpful for top-down inliner that needs a size/growth cap.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Under Sample PGO, we now have a top-down inliner in sample loader already to handle most of the hot inlining (<a href="https://reviews.llvm.org/D70655">https://reviews.llvm.org/D70655</a>,
<a href="https://reviews.llvm.org/D82919">https://reviews.llvm.org/D82919</a>). Sample loader is a module pass, so the inliner there is module inliner too. And with the new CSSPGO (<a href="https://lists.llvm.org/pipermail/llvm-dev/2020-August/144101.html">https://lists.llvm.org/pipermail/llvm-dev/2020-August/144101.html</a>),
 we’ve changed to use a call site prioritized top-down inliner for sample loader as the inlining there is no longer limited to inline replay (<a href="https://reviews.llvm.org/D94001">https://reviews.llvm.org/D94001</a>). The sample loader inliner is probably
 closer to what you’re planning to do, but such top-down call site prioritization would be most effective when context-sensitive profile is available so inliner can do proper specialization along different inline context.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">+<a id="OWAAM0BD1DF7E9920EB4CB455F647BA8AAB2A" href="mailto:hoy@fb.com"><span style="font-family:"Calibri",sans-serif;text-decoration:none">@Hongtao Yu</span></a>
<a id="OWAAM7420B9583839DA4A835D9741216171CD" href="mailto:wlei@fb.com"><span style="font-family:"Calibri",sans-serif;text-decoration:none">@Lei Wang</span></a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Wenlei<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">llvm-dev <llvm-dev-bounces@lists.llvm.org> on behalf of David Blaikie via llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Date: </b>Monday, August 30, 2021 at 9:52 AM<br>
<b>To: </b>Liqiang Tao <taolq926@gmail.com>, Chandler Carruth <chandlerc@gmail.com>, Arthur Eubanks <aeubanks@google.com>, David Li <davidxl@google.com><br>
<b>Cc: </b>llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Subject: </b>Re: [llvm-dev] [RFC] Add a module inliner<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal">+a couple of folks who might have some thoughts/ideas here<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, Aug 24, 2021 at 8:57 AM Liqiang Tao via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<p style="mso-margin-top-alt:9.6pt;margin-right:0in;margin-bottom:9.6pt;margin-left:0in;box-sizing:border-box;line-height:inherit;white-space:pre-wrap">
<span style="font-size:12.0pt;font-family:"Open Sans",sans-serif;color:#333333">In my GSoC 2021, my goal is to evaluate the value of different callsite visiting orderings, which is inspired by paper[1][2]. I've already enabled doing such an exploration within
 the constraints of the current SCC inliner (</span><a href="https://reviews.llvm.org/D104028" target="_blank"><span style="font-size:12.0pt;font-family:"Open Sans",sans-serif">https://reviews.llvm.org/D104028</span></a><span style="font-size:12.0pt;font-family:"Open Sans",sans-serif;color:#333333">).
 Exploring more advanced callsite orderings is not possible with the current SCC inliner. The current SCC inliner runs on each SCC in a bottom-up traversal, which means that the inline order is limited to a bottom-up order.
<o:p></o:p></span></p>
<p style="mso-margin-top-alt:9.6pt;margin-right:0in;margin-bottom:9.6pt;margin-left:0in;box-sizing:border-box;line-height:inherit;white-space:pre-wrap">
<span style="font-size:12.0pt;font-family:"Open Sans",sans-serif;color:#333333">To address this limitation, I would like to add a module inliner, which processes all call sites in a given module at a time instead of a given SCC. This gives us flexibility on
 the order in which we process call sites.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:9.6pt;margin-right:0in;margin-bottom:9.6pt;margin-left:0in;box-sizing:border-box;line-height:inherit;white-space:pre-wrap">
<span style="font-size:12.0pt;font-family:"Open Sans",sans-serif;color:#333333">The module inliner would be disabled by default, to minimize code churn to the existing codebase and make it easier to remove it. Also, to avoid unnecessary abstractions, which
 would complicate the existing codebase, some code is copied from SCC inliner. Lastly, to foster collaboration, I would propose landing it in trunk rather than a branch.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:9.6pt;margin-right:0in;margin-bottom:9.6pt;margin-left:0in;box-sizing:border-box;line-height:inherit;white-space:pre-wrap">
<span style="font-size:12.0pt;font-family:"Open Sans",sans-serif;color:#333333">Best wishes,<o:p></o:p></span></p>
<p style="mso-margin-top-alt:9.6pt;margin-right:0in;margin-bottom:9.6pt;margin-left:0in;box-sizing:border-box;line-height:inherit;white-space:pre-wrap">
<span style="font-size:12.0pt;font-family:"Open Sans",sans-serif;color:#333333">Liqiang Tao<o:p></o:p></span></p>
<p style="mso-margin-top-alt:9.6pt;margin-right:0in;margin-bottom:9.6pt;margin-left:0in;box-sizing:border-box;line-height:inherit;white-space:pre-wrap">
<span style="font-size:12.0pt;font-family:"Open Sans",sans-serif;color:#333333">---- [1] Aleksandar Prokopec, Gilles Duboscq, David Leopoldseder, and Thomas Würthinger. 2019. An optimization-driven incremental inline substitution algorithm for just-in-time
 compilers. In Proceedings of the 2019 IEEE/ACM International Symposium on Code Generation and Optimization (CGO 2019). [2] Dhruva R. Chakrabarti and Shin-Ming Liu. 2006. Inline Analysis: Beyond Selection Heuristics. In Proceedings of the International Symposium
 on Code Generation and Optimization (CGO '06). <o:p></o:p></span></p>
</div>
<p class="MsoNormal">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>