<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 7, 2021 at 1:08 PM Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I believe intra-function hot cold code splitting is in the scope of the Propeller project, which Sriram Tallam worked on. I'm not sure what the status of the feature is at this moment.</div></blockquote><div><br></div><div>This is available in LLVM with option -fsplit-machine-functions with PGO and it uses PGO profiles to split a function's cold basic blocks which can then be placed arbitrarily. It is tested on instrumented PGO where it shows gains of a couple of percent. With Sampled PGO, we are still working on tuning the split.</div><div><br></div><div>We have also added support for Propeller, which uses another round of profiling to precisely layout basic blocks and split functions. While this is more effective that -fsplit-machine-functions, it requires another round of sampled profiling. Please see the documentation here to optimize binaries with Propeller: <span style="color:rgb(0,0,0)">: </span><a href="https://github.com/google/autofdo/blob/propeller/OptimizeClangO3WithPropeller.md" target="_blank">https://github.com/google/autofdo/blob/propeller/OptimizeClangO3WithPropeller.md</a></div><div><br></div><div>Both -fsplit-machine-functions and Propeller use the basic block sections feature to perform function splitting.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>I believe that the hot cold split pass is an IR pass, which means that it outlines code at the IR level. This will prevent the register allocator from working across the boundary between hot and cold code, so I don't believe it has as much performance potential as splitting the function during code generation. Looking at the example, I believe GCC is using this strategy, it is not calling outlined code.</div></div></blockquote><div><br></div><div>Yep, GCC too splits functions just like -fsplit-machine-functions during code generation and not early like hot cold splitting. For performance, we have found this more effective.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 6, 2021 at 2:17 AM chuanqi.xcq via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">Hi,</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div><div style="clear:both">IIRC, clang/llvm has HotColdSplit and partial inline passes which has similar functionality. However, these two passes are not enabled by default for some reasons.</div><div style="clear:both"><br></div><div style="clear:both">Thanks,</div><div style="clear:both">Chuanqi</div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div><blockquote style="margin-right:0px;margin-top:0px;margin-bottom:0px"><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">------------------------------------------------------------------</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">From:陈云星 via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">Send Time:2021年5月6日(星期四) 17:11</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">To:cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">Subject:[cfe-dev] split hot and cold part of a function into separate function</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div>currently, gcc support function attribute “cold”, which can hint compiler split caller function’s cold into two separate function, one is hot the other is cold.<div><br></div><div>One example is here: <a href="https://godbolt.org/z/j7sK4hd48" target="_blank">https://godbolt.org/z/j7sK4hd48</a></div><div><br></div><div>my question is Clang/llvm has such function/capability ?</div></blockquote><div><br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><span><br><div dir="ltr" style="margin-left:0pt" align="left"><table style="border:none;border-collapse:collapse"><colgroup><col width="111"><col width="158"><col width="190"><col width="16"></colgroup><tbody><tr style="height:29.25pt"><td style="border-top:1.5pt solid rgb(213,15,37);vertical-align:top;padding:5pt;overflow:hidden"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13pt;font-family:Roboto,sans-serif;color:rgb(136,136,136);font-weight:700;vertical-align:baseline;white-space:pre-wrap">Sri</span><span style="font-size:12pt;font-family:Roboto,sans-serif;color:rgb(136,136,136);vertical-align:baseline;white-space:pre-wrap"> Tallam |</span></p></td><td style="border-top:1.5pt solid rgb(51,105,232);vertical-align:top;padding:5pt;overflow:hidden"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Roboto,sans-serif;color:rgb(136,136,136);vertical-align:baseline;white-space:pre-wrap"> Software Engineer |</span></p></td><td style="border-top:1.5pt solid rgb(0,153,57);vertical-align:top;padding:5pt;overflow:hidden"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:12pt;font-family:Roboto,sans-serif;color:rgb(136,136,136);vertical-align:baseline;white-space:pre-wrap"> </span><span style="font-size:12pt;font-family:Roboto,sans-serif;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap"><a href="mailto:tmsriram@google.com" target="_blank">tmsriram@google.com</a></span><span style="font-size:12pt;font-family:Roboto,sans-serif;color:rgb(136,136,136);vertical-align:baseline;white-space:pre-wrap"> |</span></p></td></tr></tbody></table></div></span><div></div></div></div></div>