<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 16, 2016 at 7:40 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@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 dir="auto"><span class=""><div><div style="direction:inherit"><br></div></div><div><br>On Sep 16, 2016, at 7:37 PM, Teresa Johnson <<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 16, 2016 at 6:17 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
> On Sep 16, 2016, at 6:13 PM, Carsten Mattner <<a href="mailto:carstenmattner@gmail.com" target="_blank">carstenmattner@gmail.com</a>> wrote:<br>
><br>
> On Sat, Sep 17, 2016 at 2:07 AM, Teresa Johnson via llvm-dev<br>
> <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
>> Yes and to add on - the ThinLTO backend by default will<br>
>> kick off std::thread::hardware_concurre<wbr>ncy # of threads, which I'm finding is<br>
><br>
> Is it just me or does that sound not very intuitive or at least a<br>
> little unexpected?<br>
> It's good that it uses the resources eagerly, but in terms of build systems this<br>
> is certainly surprising if there's no control of that parameter via<br>
> make/ninja/xcode.<br>
<br>
</span>You can control the parallelism used by the linker, but the option is linker dependent<br>
(On MacOS: -Wl,-mllvm,-threads=1)<br></blockquote><div><br></div><div>Wait - this is to control the ThinLTO backend parallelism, right? In which case you wouldn't want to use 1, but rather the number of physical cores.</div><div style="direction:inherit"><br></div></div></div></div></div></blockquote><div style="direction:inherit"><br></div></span><div style="direction:inherit">Well it depends what behavior you want :)</div><div style="direction:inherit"><br></div><div style="direction:inherit">I should have used N to match ninja -jN.</div><span class=""><div style="direction:inherit"><br></div><div style="direction:inherit"><br></div><div style="direction:inherit"><br></div><div style="direction:inherit"><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>When using gold the option is -Wl,-plugin-opt,jobs=N, where N is the amount of backend parallel ThinLTO jobs that will be issued in parallel. So you could try with the default, but if you have HT on then you might want to try with the number of physical cores instead.</div></div></div></div></div></blockquote><div style="direction:inherit"><br></div><div style="direction:inherit"><br></div></span><div style="direction:inherit">How does it affects parallel LTO backends?</div><div style="direction:inherit">(I hope it doesn't)</div></div></blockquote><div><br></div><div>In regular LTO mode, the option will also affect parallel LTO codegen, which is off by default. Is that what you meant? </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span class="HOEnZb"><font color="#888888"><div style="direction:inherit"><br></div><div style="direction:inherit">-- </div><div style="direction:inherit">Mehdi</div></font></span><span class=""><div style="direction:inherit"><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div style="direction:inherit"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><br>
><br>
>> too much for machines with hyperthreading. If that ends up being an issue I can<br>
>> give you a workaround (I've been struggling to find a way that works on various<br>
>> OS and arches to compute the max number of physical cores to fix this in the source).<br>
><br>
> I've been using ninja -jN so far. I suppose when building with ThinLTO I should<br>
> run ninja -j1. Would that<br>
><br>
> What's the workaround?<br>
<br>
</span>Seems like you missed my previous email: : cmake -DLLVM_PARALLEL_LINK_JOBS=1<br>
Also, ninja is parallel by default, so no need to pass -j.<br>
<br>
This way you get nice parallelism during the compile phase, and ninja will issue only one link job at a time.<br>
<br>
—<br>
<span class="m_727118559994454625HOEnZb"><font color="#888888">Mehdi<br>
<br>
<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_727118559994454625gmail_signature" data-smartmail="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> <a href="tel:408-460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</div></div>
</div></blockquote></span></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> 408-460-2413</td></tr></tbody></table></span></div>
</div></div>