<html xmlns:v="urn:schemas-microsoft-com:vml" 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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Roboto;
        panose-1:2 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-CA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">I suggested Neil to apply
</span><a href="https://reviews.llvm.org/D71786">https://reviews.llvm.org/D71786</a> (rpmalloc) and he reported:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><br>
“[..] <span style="color:#14171A;background:white">its about 6.5% faster using the rpmalloc LLVM vs LLVM 9 without. It is a cool 14% faster than LLVM 10 too!</span>”<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="mso-fareast-language:EN-US">(</span><span style="color:black;background:white">https://twitter.com/sheredom/status/1250138086811602944?s=20)</span><span style="mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">I ran some tests locally, and as a first order of approximation,
<i>even without rpmalloc</i> it seems Clang 10 is faster than Clang 9 for a whole build. Although locally when iterating on a single file, it could be slower like Neil suggests.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">The test consists in compiling LLVM|Clang|LLD on release/10.x at HEAD using the compilers below. I built each compiler with Clang 10, except MSVC which is provided for reference. Median timings for
 a clean build (`ninja all`).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">                </span>
<span lang="FR-CA" style="mso-fareast-language:EN-US">Clang 9.0.1                          6 min 48 sec (+/- 23 sec)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-CA" style="mso-fareast-language:EN-US">                Clang 10.0                            5 min 55 sec (+/- 5 sec)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-CA" style="mso-fareast-language:EN-US">                Clang 10.0 optimal           5 min 20 sec (+/- 5 sec)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-CA" style="mso-fareast-language:EN-US">                Clang 11 (994543ab)        6 min (+/- 5 sec)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span lang="FR-CA" style="mso-fareast-language:EN-US">VS2019 16.5.4                    7 min 20 (+/- 15 sec)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-CA" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Tested on Windows 10 build 1909, on a 36-core dual Xeon Gold 6140, with RAID-0 NVMe SSDs. I disabled Windows Defender for the test.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">The greater variability in “Clang 9.0.1” is due to launching two processes for each clang-cl invocation, where as 10+ calls only one (like MSVC), see -fintegrated-cc1.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">“Clang 10.0 optimal” is a two-stage build using ThinLTO and -O3 on the second stage and tailored for the 6140 (-march=skylake-avx512). It also has D71786 (rpmalloc) applied.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">I can possibly take some profile traces, see if anything stands out between 9 and 10.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Alex.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="FR">De :</span></b><span lang="FR"> llvm-dev <llvm-dev-bounces@lists.llvm.org>
<b>De la part de</b> Tobias Hieta via llvm-dev<br>
<b>Envoyé :</b> April 15, 2020 11:17 AM<br>
<b>À :</b> Neil Henning <neil.henning@unity3d.com><br>
<b>Cc :</b> llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Objet :</b> Re: [llvm-dev] 7-8% compile time slowdowns in LLVM 10<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Neil,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">That's unfortunate - I am in the process of updating to clang 10 here and this slow down will impact our developers as well.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">If I have some time this weekend I will try to profile clang and see if I can figure out if there is a single regression or just many smaller things.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Tobias<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, Apr 14, 2020, 10:26 Neil Henning 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:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal">Hey list,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">TL;DR - LLVM 10 is around 7-8% slower than LLVM 9 when compiling the same inputs.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">So here at Unity our Burst HPC# compiler uses LLVM to provide our users with some very optimal codegen. LLVM is used in two ways:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">1. In the Unity editor we JIT compile user code.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">2. We also have an AOT mode for when our users are building a full game.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Particularly for 1., compile time really matters for us. Anything we can do to improve compile time will increase our users' experience when editing their gameplay code and seeing what effect it has on the scene they are using. We keep
 metrics of compile time as a result, and after hearing the concerns from the Rust folks about LLVM 10's slowdowns I had a look at our numbers with an upgraded LLVM 10 toolchain -  you can see a snap from the spreadsheet here that shows an overall 7-8% slowdown
 in the compiler <a href="https://twitter.com/sheredom/status/1247128694554087426" target="_blank">
https://twitter.com/sheredom/status/1247128694554087426</a>.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Also since we keep golden asm files for a huge range of important tests we need to preserve, I can also definitively say that the produced asm does not contain any significant improvements to warrant the extra compile time being used (some
 changes in register selection and a slightly better placement of instructions).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I don't really have any answers to if or how this can be fixed, I just thought this was a useful data point to the community as a whole and I'd raise the visibility.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">-Neil.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%;border-collapse:collapse">
<tbody>
<tr>
<td valign="top" style="padding:0cm 0cm 15.0pt 0cm">
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" align="left" style="border-collapse:collapse">
<tbody>
<tr>
<td width="64" valign="top" style="width:48.0pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="line-height:18.0pt"><span style="font-size:12.5pt"><img border="0" width="64" style="width:.6666in" id="_x0000_i1025" src="https://unity3d.com/profiles/unity3d/themes/unity/images/ui/other/unity-logo-dark-email.png"><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td valign="top" style="padding:0cm 0cm 0cm 0cm">
<div>
<p class="MsoNormal" style="line-height:11.25pt"><b><span style="font-size:10.5pt;font-family:Roboto;color:black">Neil Henning<o:p></o:p></span></b></p>
</div>
</td>
</tr>
<tr>
<td valign="top" style="padding:0cm 0cm 0cm 0cm">
<div>
<p class="MsoNormal" style="line-height:11.25pt"><span style="font-size:10.5pt;font-family:Roboto;color:black">Senior Software Engineer Compiler<o:p></o:p></span></p>
</div>
</td>
</tr>
<tr>
<td valign="top" style="padding:0cm 0cm 0cm 0cm">
<div>
<p class="MsoNormal" style="line-height:11.25pt"><span style="font-size:9.0pt;font-family:Roboto;color:black"><a href="http://unity.com" target="_blank">unity.com</a><o:p></o:p></span></p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</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>