<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 16px; font-family: Calibri, sans-serif;">
<div>
<div>Hi Morten,</div>
<div><br>
</div>
<div>We have experienced a similar slow down in execution performance when upgrading to LLVM 3.7. The issue for us was that our front-end was emitting alloca instruction in non-entry basic blocks. After fixing the generation of LLVM IR in our front-end, we
got similar or better performant with LLVM 3.7. See:</div>
<div><br>
</div>
<div><a href="http://llvm.org/docs/Frontend/PerformanceTips.html#use-of-allocas">http://llvm.org/docs/Frontend/PerformanceTips.html#use-of-allocas</a></div>
<div><br>
</div>
<div>Maybe, this is something that you can double check.</div>
<div><br>
</div>
<div>Here’s a detailed explanation of the cause of the slowdown:</div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px;">
<div>
<pre style="white-space: pre-wrap; background-color: rgb(255, 255, 255);">With LLVM 3.7, We have noticed that the MemCpy pass will attempt to copy LLVM struct using moves that are as large as possible. For example, a struct of 3 floats is copied using a 64-bit and a 32-bit move. It is therefore important that such a struct be aligned on 8-byte boundary, not just 4 bytes! Else, one runs the risk of triggering store-forwarding failure pipelining stalls (which we did encountered really badly with one of our internal performance benchmark). It is therefore important that the SROA pass correctly eliminates the load/store to the alloca memory regions.</pre>
</div>
</blockquote>
<div>Benoit</div>
<div><br>
</div>
<div><br>
</div>
<div>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><b><span style="font-size: 9pt; font-family: Arial, sans-serif; color: rgb(99, 99, 99);">Benoit Belley</span></b><span style="font-size: 9pt; "><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">Sr Principal Developer</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">M&E-Product Development Group</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><b><span style="font-size: 7pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">MAIN</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);"> +1
514 393 1616</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><b><span style="font-size: 7pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">DIRECT</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);"> +1
438 448 6304</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><b><span style="font-size: 7pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">FAX</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);"> +1
514 393 0110</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><a href="http://twitter.com/autodesk" style="color: purple; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">Twitter</span></a><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><a href="https://www.facebook.com/Autodesk" style="color: purple; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">Facebook</span></a><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><b><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">Autodesk, Inc.</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">10 Duke Street</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">Montreal, Quebec, Canada H3C 2L7</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><a href="http://www.autodesk.com/" style="color: purple; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">www.autodesk.com</span></a><span style="color: rgb(146, 147, 150); "><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; "><img border="0" width="283" height="41" id="Picture_x0020_1" src="cid:BAD0AEC9-B582-415E-8145-EA3631A4DA18" alt="Description: Email_Signature_Logobar" type="image/png"><o:p></o:p></p>
<div style="font-family: Calibri; font-size: medium; ">
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">
<span style="font-size: 11.5pt; "> </span></p>
</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org">llvm-dev-bounces@lists.llvm.org</a>> on behalf of Morten Brodersen via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>
<span style="font-weight:bold">Reply-To: </span>Morten Brodersen <<a href="mailto:Morten.Brodersen@constrainttec.com">Morten.Brodersen@constrainttec.com</a>><br>
<span style="font-weight:bold">Date: </span>jeudi 4 février 2016 22:39<br>
<span style="font-weight:bold">To: </span>llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [llvm-dev] MCJit Runtine Performance<br>
</div>
<div><br>
</div>
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div>
<div text="#000000" bgcolor="#FFFFFF">Hi Lang,<br>
<br>
> MCJIT does not compile lazily (though it sounds like that's not an issue here?)<br>
<br>
That is not an issue here since the code JIT's once (a few secs) and then run the generated machine code for hours.<br>
<br>
> Morten - Can you share any test cases that demonstrate the slowdown. I'd love to take a look at this.<br>
<br>
The code is massive so not practical. However I will try and extract an example function that demonstrates the difference (as per previous email).<br>
<br>
<div class="moz-cite-prefix">On 05/02/16 11:52, Lang Hames wrote:<br>
</div>
<blockquote cite="mid:CALLttgrYxh61zpK0q-v-Ng-bidwpazPvmU3yYuF5XaLq6T7m_A@mail.gmail.com" type="cite">
<div dir="ltr">These are some pretty extreme slowdowns. The legacy JIT shared the code generator with MCJIT, and as far as I'm aware there were really only three main differences:
<div><br>
</div>
<div>1) The legacy JIT used a custom instruction encoder, whereas MCJIT uses MC.</div>
<div>2) (Related to 1) MCJIT needs to perform runtime linking of the object files produced by MC.</div>
<div>3) MCJIT does not compile lazily (though it sounds like that's not an issue here?)</div>
<div><br>
</div>
<div>Keno - did you ever look at the codegen pipeline construction for the legacy JIT vs MCJIT? Are we choosing different passes?</div>
<div><br>
</div>
<div>Morten - Can you share any test cases that demonstrate the slowdown. I'd love to take a look at this.</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Lang.</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Feb 4, 2016 at 4:16 PM, Hal Finkel via llvm-dev <span dir="ltr">
<<a moz-do-not-send="true" href="mailto:llvm-dev@lists.llvm.org" target="_blank"></a><a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">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">
<span class="">----- Original Message -----<br>
> From: "Keno Fischer via llvm-dev" <<a moz-do-not-send="true" href="mailto:llvm-dev@lists.llvm.org"></a><a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>
> To: "Morten Brodersen" <<a moz-do-not-send="true" href="mailto:Morten.Brodersen@constrainttec.com">Morten.Brodersen@constrainttec.com</a>><br>
> Cc: "llvm-dev" <<a moz-do-not-send="true" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>
> Sent: Thursday, February 4, 2016 6:05:29 PM<br>
> Subject: Re: [llvm-dev] MCJit Runtine Performance<br>
><br>
><br>
><br>
> Yes, unfortunately, this is very much known. Over in the julia<br>
> project, we've recently gone through this and taken the hit (after<br>
> doing some work to fix the very extreme corner cases that we were<br>
> hitting). We're not entirely sure why the slowdown is this<br>
> noticable, but at least in our case, profiling didn't reveal any<br>
> remaining low hanging fruits that are responsible. One thing you can<br>
> potentially try if you haven't yet is to enable fast ISel and see if<br>
> that brings you closer to the old runtimes.<br>
<br>
</span>And maybe the register allocator? Are you using the greedy one or the linear one? Are there any other MI-level optimizations running?<br>
<br>
-Hal<br>
<div class="HOEnZb">
<div class="h5"><br>
><br>
><br>
> On Thu, Feb 4, 2016 at 7:00 PM, Morten Brodersen via llvm-dev <<br>
> <a moz-do-not-send="true" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a> > wrote:<br>
><br>
><br>
> Hi All,<br>
><br>
> We recently upgraded a number of applications from LLVM 3.5.2 (old<br>
> JIT) to LLVM 3.7.1 (MCJit).<br>
><br>
> We made the minimum changes needed for the switch (no changes to the<br>
> IR generated or the IR optimizations applied).<br>
><br>
> The resulting code pass all tests (8000+).<br>
><br>
> However the runtime performance dropped significantly: 30% to 40% for<br>
> all applications.<br>
><br>
> The applications I am talking about optimize airline rosters and<br>
> pairings. LLVM is used for compiling high level business rules to<br>
> efficient machine code.<br>
><br>
> A typical optimization run takes 6 to 8 hours. So a 30% to 40%<br>
> reduction in speed has real impact (=> we can't upgrade from 3.5.2).<br>
><br>
> We have triple checked and reviewed the changes we made from old JIT<br>
> to MCJIt. We also tried different ways to optimize the IR.<br>
><br>
> However all results indicate that the performance drop happens in the<br>
> (black box) IR to machine code stage.<br>
><br>
> So my question is if the runtime performance reduction is<br>
> known/expected for MCJit vs. old JIT? Or if we might be doing<br>
> something wrong?<br>
><br>
> If you need more information, in order to understand the issue,<br>
> please tell us so that we can provide you with more details.<br>
><br>
> Thanks<br>
> Morten<br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a moz-do-not-send="true" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a moz-do-not-send="true" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a moz-do-not-send="true" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a moz-do-not-send="true" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
<br>
</div>
</div>
<span class="HOEnZb"><font color="#888888">--<br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
</font></span>
<div class="HOEnZb">
<div class="h5">_______________________________________________<br>
LLVM Developers mailing list<br>
<a moz-do-not-send="true" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a moz-do-not-send="true" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</div>
</div>
</blockquote>
</span>
</body>
</html>