<div dir="ltr">Thanks Gerolf for explaining the philosophy behind the analysis. I totally agree it requires consistency and watch. <div><br></div><div>I got the purpose of CTMark. Its intent is clear to me. Apart from this have we ever thought of having synthetic tests which are focused on compile-time only? We can write a test suite generator which generates LLVM IR files which stress tests a particular phase of LLVM. E.g. we can have a performance test which stress test just LICM or LSE and so on.</div><div><br></div><div>This will allow us to keep an eye on that phase and track more efficiently. <br></div><div><br></div><div>Thoughts?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 18, 2017 at 9:52 AM, Gerolf Hoflehner <span dir="ltr"><<a href="mailto:ghoflehner@apple.com" target="_blank">ghoflehner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div dir="auto" style="word-wrap:break-word"><div dir="auto" style="word-wrap:break-word"><div dir="auto" style="word-wrap:break-word"><div dir="auto" style="word-wrap:break-word"><div dir="auto" style="word-wrap:break-word"><div dir="auto" style="word-wrap:break-word"><div dir="auto" style="word-wrap:break-word"><br></div><div dir="auto" style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Apr 11, 2017, at 10:25 PM, Madhur Amilkanthwar via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="m_-2207022896920192009Apple-interchange-newline"><div><div dir="ltr">I am interested in knowing more.<div>1. What benchmarks does LLVM community use for compile-time study? I see CTMark, but is that the only one being analyzed?</div></div></div></blockquote><div><br></div></span>CTMark is not cast in stone. Its purpose is for the community to have a trackable proxy for the overall llvm test suite. This assertion is supposed to get evaluated (and the benchmarks in CTMark possibly adjusted) on a regular basis which should happen roughly twice a year at compiler release times. As far as open source is concerned only CTMark is tracked on green dragon for O0g, Os and - forward looking - O3 LTO. This means O0g and Os is watched very closely, while O3 LTO at this stage is just "getting a look” (a double digit increase will certainly raise eyebrows though). The tracking data is at <a href="http://lab.llvm.org:8080/green/view/Compile%20Time/" target="_blank">http://lab.llvm.org:8080/<wbr>green/view/Compile%20Time/</a>. </div><div><br></div><div><span class=""><blockquote type="cite"><div><div dir="ltr"><div>2. Is ASM parsing treated as a bottleneck in the flow? It is not the default in the compilation flow though.</div><div>3. Do we have a target here? how fast does LLVM want to be? </div></div></div></blockquote><div><br></div></span>Our data showed that compile-time increased steadily by double digits in the last 2 years for Os and a little less in O0g. Unfortunately, and for many reasons, it is not straight forward to get that compile-time back by simply setting a X% goal e.g. Y months. Instead it requires establishing a process that allows the open source community to pursue better compile-time. This involves</div><div>a) identify compile time increases quickly.</div><div>b) reason about an increase in “real-time”.</div><div>c) take action and implement improvements.</div><div><br></div><div>CTMark gives focus and the sense of achievability for a). </div><div><br></div><div>b) requires finishing some work in progress and hopefully will become a process ingrained in the llvm/clang dna. Michael’s analysis of compile-time bumps is the basis for classifying the reasons, and many times an increase eg. for a new feature. optimization, tuning etc is the right trade-off. But then it becomes a group decision based on data and insight to accept longer compile-times and not something that simply happened. To help with root causing/reasoning I think the work by Matthias and others [2] on timers/stats combined with per commit tracking on green dragon (which Chris enabled) will form the basis of the methodology.</div><div><br></div><div>c) is different. While a) and b) puts in place barriers to ongoing compile-time increases, c) gives the improvements. Michael’s work on SCEV [1] is an example of this. This (and similar work by others, eg. the refs in this mail thread) shows that clang can get ahead of the game and improve compile-time significantly. It is now time to shoot the azimuth and see where future improvements can come from and where they can take clang compile-time. Some ideas are in Michael’s mail thread, but with additional analysis and insight including from compiling clang itself more opportunities should become apparent. Expect most of the issues to take many weeks or months to analyze and implement. Still ready to join the effort? It takes commitment, not just interest!</div><div><br></div><div>To answer your question about the target: the process is working, compile-time changes are assessed immediately, improvement ideas are followed up on and blogs/articles reporting clang compile-times are all praise. When the best talents in the community devote some of their time and efforts this lofty goal will be hit.</div><div><br></div><div>Cheers</div><div>Gerolf</div><div><br></div><div>References:</div><div>[1] <a href="https://reviews.llvm.org/D30477" target="_blank">https://reviews.llvm.org/<wbr>D30477</a></div><div>[2] <a href="http://lists.llvm.org/pipermail/llvm-dev/2016-December/108088.html" target="_blank">http://lists.llvm.org/<wbr>pipermail/llvm-dev/2016-<wbr>December/108088.html</a> (and more comments in <a href="https://reviews.llvm.org/D31566#716880" target="_blank">https://reviews.llvm.org/<wbr>D31566#716880</a>)</div><div><div class="h5"><div><br><div><br></div><blockquote type="cite"><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 12, 2017 at 8:22 AM, Mikhail Zolotukhin via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<div><br></div><div>It's been a while since I sent the last compile time report [1], where it was shown that LLVM was getting slower over time. But now I'm happy to bring some good news: finally, LLVM is getting faster, not slower :)</div><div><br></div><div>*** Current status ***</div><div>Many areas of LLVM have been examined and improved since then: InstCombine, SCEV, APInt implementation, and that resulted in almost 10% improvement compared to January compiler. I remeasured compile time data for CTMark tests and annotated the biggest changes, the graphs for Os and O0-g are attached below. Thick black line represents geomean, colored thin lines represent individual tests. The data is normalized on the first revision in the range (which is ~Jun, 2015).</div><div><br></div><div>*** Future work ***</div><div>There are still plenty of opportunities to make LLVM faster. Here is a list of some ideas that can further help compile-time:</div><div><br></div><div>- KnownBits Cache. InstCombine and other passes use known bits, which often happens to be pretty expensive. Hal posted a patch [2] that implements a cache for known bits, but there are still some issues to fix there.</div><div>- SCEV. Some parts of SCEV still need to be improved. For instance, createAddRecFromPHI function seems to be very inefficient: it can perform many expensive traversals over entire function/loop nest, and most of them are probably redundant.</div><div>- Forming LCSSA. PR31851 reports that the current implementation of LCSSA forming can be expensive. A WIP patch [3] should address the problem, but probably there are more to be improved here.</div><div>- InstCombine vs InstSimplify. Currently we run InstCombine 6 times in our O3 pipeline. Probably, we don't need full InstCombine all 6 times, and some of its invocations can be replaced with a cheaper clean-up pass.</div><div>- Unnecessary pass dependencies. There are cases in which computing pass dependencies is much more expensive than running the pass itself (especially at O0). It might make sense to find such passes and try replacing their dependencies with lazy computations of required analyses (see e.g. [4]).</div><div>- libcxx. r249742 split a bunch of headers and resulted in noticeable compile time slowdowns. While the change itself seems to be necessary, it would be nice to find a way to mitigate the induced slowdowns.</div><div><br></div><div>Of course, the list is far from complete, so if you happen to know other problematic areas, please let me know. Some of these ideas are already worked on, but there is always a room for volunteers here! So, if you'd like to work on LLVM compile time, please, let me know and let's join our efforts.</div><div><br></div><div>Thanks for your time,</div><div>Michael</div><div><div><br></div><div>[1] <a href="http://lists.llvm.org/pipermail/llvm-dev/2017-January/109188.html" target="_blank">http://lists.llvm.org/pipe<wbr>rmail/llvm-dev/2017-January/<wbr>109188.html</a></div></div><div>[2] <a class="m_-2207022896920192009m_-7569083721501244892m_-3075486418410273754gmail-m_-1855108276665198409moz-txt-link-freetext" href="https://reviews.llvm.org/D31239" target="_blank">https://reviews.llvm.org/D3123<wbr>9</a></div><div>[3] <a href="https://reviews.llvm.org/D31843" target="_blank">https://reviews.llvm.org/D<wbr>31843</a></div><div>[4] <a href="https://reviews.llvm.org/D31302" target="_blank">https://reviews.llvm.org/D<wbr>31302</a></div><div><br></div><div>CTMark -Os:</div><div></div></div><br><div style="word-wrap:break-word"><div></div><div>CTMark -O0-g:</div><div></div></div>
<br><div style="word-wrap:break-word"><div></div><div><br></div></div>
<br>______________________________<wbr>_________________<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="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-2207022896920192009gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><i style="font-size:12.8px">Disclaimer: Views, concerns, thoughts, questions, ideas expressed in this mail are of my own and my employer has no take in it. </i><br></div><div>Thank You.<br>Madhur D. Amilkanthwar<br><br></div></div></div>
</div>
______________________________<wbr>_________________<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="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br></div></blockquote></div><br></div></div></div></div></div></div></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><i style="font-size:12.8px">Disclaimer: Views, concerns, thoughts, questions, ideas expressed in this mail are of my own and my employer has no take in it. </i><br></div><div>Thank You.<br>Madhur D. Amilkanthwar<br><br></div></div></div>
</div>