<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 8, 2016, at 1:09 PM, Sean Silva via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><br class="Apple-interchange-newline"><br class=""><div class="gmail_quote">On Tue, Mar 8, 2016 at 10:42 AM, Richard Smith via llvm-dev<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><span class="">On Tue, Mar 8, 2016 at 8:13 AM, Rafael EspĂ­ndola<br class=""><<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class="">> I have just benchmarked building trunk llvm and clang in Debug,<br class="">> Release and LTO modes (see the attached scrip for the cmake lines).<br class="">><br class="">> The compilers used were clang 3.5, 3.6, 3.7, 3.8 and trunk. In all<br class="">> cases I used the system libgcc and libstdc++.<br class="">><br class="">> For release builds there is a monotonic increase in each version. From<br class="">> 163 minutes with 3.5 to 212 minutes with trunk. For comparison, gcc<br class="">> 5.3.2 takes 205 minutes.<br class="">><br class="">> Debug and LTO show an improvement in 3.7, but have regressed again in 3.8.<br class=""><br class=""></span>I'm curious how these times divide across Clang and various parts of<br class="">LLVM; rerunning with -ftime-report and summing the numbers across all<br class="">compiles could be interesting.<br class=""></blockquote><div class=""><br class=""></div><div class="">Based on the results I posted upthread about the relative time spend in the backend for debug vs release, we can estimate this.</div><div class="">To summarize:</div><div class="">10% of time spent in LLVM for Debug</div><div class="">33% of time spent in LLVM for Release</div><div class="">(I'll abbreviate "in LLVM" as just "backend"; this is "backend" from clang's perspective)</div><div class=""><br class=""></div><div class="">Let's look at the difference between 3.5 and trunk.</div><div class=""><br class=""></div><div class="">For debug, the user time jumps from 174m50.251s to 197m9.932s.</div><div class="">That's {10490.3, 11829.9} seconds, respectively.</div><div class="">For release, the corresponding numbers are:</div><div class="">{9826.71, 12714.3} seconds.<br class=""></div><div class=""><br class=""></div><div class="">debug35 = 10490.251<br class=""></div><div class="">debugTrunk = 11829.932<br class=""></div><div class=""><br class=""></div><div class="">debugTrunk/debug35 == 1.12771<br class=""></div><div class="">debugRatio = 1.12771</div><div class=""><br class=""></div><div class="">release35 = 9826.705<br class=""></div><div class="">releaseTrunk = 12714.288<br class=""></div><div class=""><br class=""></div><div class="">releaseTrunk/release35 == 1.29385<br class=""></div><div class="">releaseRatio = 1.29385</div><div class=""><br class=""></div><div class="">For simplicity, let's use a simple linear model for the distribution of slowdown between the frontend and backend: a constant factor slowdown for the backend, and an independent constant factor slowdown for the frontend. This gives the following linear system:</div><div class="">debugRatio = .1 * backendRatio + (1 - .1) * frontendRatio</div><div class="">releaseRatio = .33 * backendRatio + (1 - .33) * frontendRatio</div><div class=""><br class=""></div><div class="">Solving this linear system we find that under this simple model, the expected slowdown factors are:</div><div class="">backendRatio = 1.77783<br class=""></div><div class="">frontendRatio = 1.05547</div><div class=""><br class=""></div><div class="">Intuitively, backendRatio comes out larger in this comparison because we see the biggest slowdown during release (1.29 vs 1.12), and during release we are spending a larger fraction of time in the backend (33% vs 10%).</div><div class=""><br class=""></div><div class="">Applying this same model to across Rafael's data, we find the following (numbers have been rounded for clarity):</div><div class=""><br class=""></div><div class=""><div class=""><font face="monospace, monospace" class="">transition       backendRatio   frontendRatio</font></div><div class=""><font face="monospace, monospace" class="">3.5->3.6         1.08           1.03</font></div><div class=""><font face="monospace, monospace" class="">3.6->3.7         1.30           0.95</font></div><div class=""><font face="monospace, monospace" class="">3.7->3.8         1.34           1.07</font></div><div class=""><font face="monospace, monospace" class="">3.8->trunk       0.98           1.02</font><span style="font-family: monospace, monospace;" class="">                </span></div></div><div class=""><div class=""><br class=""></div></div><div class=""><div class="">Note that in Rafael's measurements LTO is pretty similar to Release from a CPU time (user time) standpoint. While the final LTO link takes a large amount of real time, it is single threaded. Based on the real time numbers the LTO link was only spending about 20 minutes single-threaded (i.e. about 20 minutes CPU time), which is pretty small compared to the 300-400 minutes of total CPU time. It would be interesting to see the numbers for -O0 or -O1 per-TU together with LTO.</div></div></div></div></div></div></blockquote><div><br class=""></div><div><br class=""></div></div>Just a note about LTO being sequential: Rafael mentioned he was "building trunk llvm and clang". By default I believe it is ~56 link targets that can be run in parallel (provided you have enough RAM to avoid swapping).<div class=""><br class=""></div><div class="">-- </div><div class="">Mehdi</div><div class=""><br class=""></div></body></html>