<div dir="ltr">Yes, carefully inserting branches is the way to go!<div><br></div><div>Seriously though - you probably saw that I just committed a fix for PR29025 (r280418).</div><div>For the reproducer you provided, we now have (without forcing vectorization, and without "padding" to have power-of-2 stride):</div><div><br></div><div><div>$ bin/clang -m32 -O2 -o ~/llvm/temp/rgb2yik.exe ~/llvm/temp/rgb2yik.c -mavx && time ~/llvm/temp/rgb2yik.exe</div><div>real<span class="gmail-Apple-tab-span" style="white-space:pre">       </span>0m2.290s<br></div><div>user<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>0m2.289s</div><div>sys<span class="gmail-Apple-tab-span" style="white-space:pre">    </span>0m0.003s</div><div>$ bin/clang -m32 -O2 -o ~/llvm/temp/rgb2yik.exe ~/llvm/temp/rgb2yik.c -mavx -mllvm -enable-interleaved-mem-accesses && time ~/llvm/temp/rgb2yik.exe</div><div>real<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>0m1.095s<br></div><div>user<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>0m1.095s</div><div>sys<span class="gmail-Apple-tab-span" style="white-space:pre">    </span>0m0.002s</div></div><div><br></div><div>Care to give it a spin internally?<br></div><div><br></div><div>Note that this is not a full solution - we still won't vectorize PR27619, and force-vectorizing it is still a bad idea. Getting that right will require more lowering improvements as well as cost model adjustments. But hopefully post-r280418 things should be good enough to avoid regressions for the cases we will vectorize. </div><div>If you still see regressions, more reproducers will be appreciated. :-)</div><div>If there are no more regressions, let me know, and I'll post a patch to enable interleaved access for x86.</div><div><br></div><div>Thanks,</div><div> Michael</div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 1, 2016 at 4:26 PM, Zaks, Ayal <span dir="ltr"><<a href="mailto:ayal.zaks@intel.com" target="_blank">ayal.zaks@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US">
<div class="gmail-m_8332212834057891470WordSection1">
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">So turns out it is a full reproducer after all (choosing to vectorize on AVX), good.<u></u><u></u></span></p><span class="gmail-">
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">></span> The details are in PR29025.<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
</span><p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Interesting. (So we should carefully insert unconditional branches inside shuffle sequences, eh? ;-)<u></u><u></u></span></p><span class="gmail-">
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">></span> But if we modify the program by adding "*out++ = 0" right after "*out++ = q;" (thus eliminating the pesky <12 x i8>), we get:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</span><p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Indeed such padding is a known (programmer) optimization to effectively have power-of-2 strides and/or alignment.<u></u><u></u></span></p><span class="gmail-">
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">></span> So, unfortunately, it turns out I don't have access to DENBench.<span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
</span><p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">If you like we could test your patch to see how it (mis)behaves.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><a name="m_8332212834057891470__MailEndCompose"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></a></p>
<p class="MsoNormal"><a name="m_8332212834057891470______replyseparator"></a><b><span style="font-size:11pt;font-family:calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:calibri,sans-serif"> Michael Kuperstein [mailto:<a href="mailto:mkuper@google.com" target="_blank">mkuper@google.com</a>]
<br>
<b>Sent:</b> Thursday, August 18, 2016 03:57<br>
<b>To:</b> Zaks, Ayal <<a href="mailto:ayal.zaks@intel.com" target="_blank">ayal.zaks@intel.com</a>><br>
<b>Cc:</b> Demikhovsky, Elena <<a href="mailto:elena.demikhovsky@intel.com" target="_blank">elena.demikhovsky@intel.com</a>>; Renato Golin <<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>>; Matthew Simpson <<a href="mailto:mssimpso@codeaurora.org" target="_blank">mssimpso@codeaurora.org</a>>; Nema, Ashutosh <<a href="mailto:Ashutosh.Nema@amd.com" target="_blank">Ashutosh.Nema@amd.com</a>>; Sanjay Patel <<a href="mailto:spatel@rotateright.com" target="_blank">spatel@rotateright.com</a>>; llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span></p><div><div class="gmail-h5"><br>
<b>Subject:</b> Re: [llvm-dev] enabling interleaved access loop vectorization<u></u><u></u></div></div><p></p><div><div class="gmail-h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">So, at least for this example, it looks like we actually want to vectorize with -enable-interleaved-mem-<wbr>accesses, we just need the backend to generate good code for the vector types that produces, specifically, in this case, <12 x i8>.
 The details are in PR29025.<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">The upshot of this is that for the original program (with an outer loop around it):<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">$ bin/clang -m32 -O2 -o ~/llvm/temp/rgb2yik.exe ~/llvm/temp/rgb2yik.c -mavx && time ~/llvm/temp/rgb2yik.exe<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">real<span class="gmail-m_8332212834057891470gmail-apple-tab-span">      </span>0m2.229s<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">user<span class="gmail-m_8332212834057891470gmail-apple-tab-span">      </span>0m2.224s<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">$ bin/clang -m32 -O2 -o ~/llvm/temp/rgb2yik.exe ~/llvm/temp/rgb2yik.c -mavx -mllvm -enable-interleaved-mem-<wbr>accesses && time ~/llvm/temp/rgb2yik.exe<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">real<span class="gmail-m_8332212834057891470gmail-apple-tab-span">      </span>0m2.590s<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">user<span class="gmail-m_8332212834057891470gmail-apple-tab-span">      </span>0m2.584s<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">This indicates that we do have a slight cost modeling issue - the cost model is not quite conservative enough in case we really do use inserts and extracts. One thing we're probably not accounting for is a bunch of GPR spills  - although
 I'm not sure *why* we end up spilling so much. So perhaps this should also be fixed in regalloc.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">But if we modify the program by adding "*out++ = 0" right after "*out++ = q;" (thus eliminating the pesky <12 x i8>), we get:<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">$ bin/clang -m32 -O2 -o ~/llvm/temp/rgb2yik.exe ~/llvm/temp/rgb2yik.c -mavx && time ~/llvm/temp/rgb2yik.exe<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">real<span class="gmail-m_8332212834057891470gmail-apple-tab-span">      </span>0m2.257s<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">user<span class="gmail-m_8332212834057891470gmail-apple-tab-span">      </span>0m2.256s<u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">$ bin/clang -m32 -O2 -o ~/llvm/temp/rgb2yik.exe ~/llvm/temp/rgb2yik.c -mavx -mllvm -enable-interleaved-mem-<wbr>accesses && time ~/llvm/temp/rgb2yik.exe <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">real<span class="gmail-m_8332212834057891470gmail-apple-tab-span">      </span>0m0.958s<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">user<span class="gmail-m_8332212834057891470gmail-apple-tab-span">      </span>0m0.956s<u></u><u></u></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Wed, Aug 17, 2016 at 2:56 PM, Michael Kuperstein <<a href="mailto:mkuper@google.com" target="_blank">mkuper@google.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<div>
<p class="MsoNormal">Thanks Ayal!<u></u><u></u></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Wed, Aug 17, 2016 at 2:14 PM, Zaks, Ayal <<a href="mailto:ayal.zaks@intel.com" target="_blank">ayal.zaks@intel.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Hi Michael,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Don’t quite have a full reproducer for you yet. You’re welcome to try and see what’s happening in 32
 bit mode when enabling  interleaving for the following, based on “</span><a href="https://en.wikipedia.org/wiki/YIQ#From_RGB_to_YIQ" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">https://en.wikipedia.org/<wbr>wiki/YIQ#From_RGB_to_YIQ</span></a><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">”:</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">void rgb2yik (char * in, char * out, int N)</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">{</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">  int j;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">  for (j = 0; j < N; ++j) {</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">    unsigned char r = *in++;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">    unsigned char g = *in++;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">    unsigned char b = *in++;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">    unsigned char y = 0.299*r + 0.587*g + 0.114*b;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">    signed char i = 0.596*r + -0.274*g + -0.321*b;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">    signed char q = 0.211*r + -0.523*g + 0.312*b;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">    *out++ = y;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">    *out++ = (unsigned char)i;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">    *out++ = (unsigned char)q;</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">  }</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">}</span><u></u><u></u></p>
<p class="MsoNormal"><a name="m_8332212834057891470_m_3994730507050443941_m_3720257990479958"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></a></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">but you’d currently need to force it to vectorize to overcome its expected cost.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Ayal.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:11pt;font-family:calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:calibri,sans-serif"> Michael Kuperstein [mailto:</span><a href="mailto:mkuper@google.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">mkuper@google.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">]
<br>
<b>Sent:</b> Wednesday, August 17, 2016 00:51<br>
<b>To:</b> Zaks, Ayal <</span><a href="mailto:ayal.zaks@intel.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">ayal.zaks@intel.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>; Demikhovsky,
 Elena <</span><a href="mailto:elena.demikhovsky@intel.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">elena.demikhovsky@intel.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">><br>
<b>Cc:</b> Renato Golin <</span><a href="mailto:renato.golin@linaro.org" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">renato.golin@linaro.org</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>; Matthew
 Simpson <</span><a href="mailto:mssimpso@codeaurora.org" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">mssimpso@codeaurora.org</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>; Nema, Ashutosh <</span><a href="mailto:Ashutosh.Nema@amd.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">Ashutosh.Nema@amd.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>;
 Sanjay Patel <</span><a href="mailto:spatel@rotateright.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">spatel@rotateright.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>; llvm-dev <</span><a href="mailto:llvm-dev@lists.llvm.org" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">llvm-dev@lists.llvm.org</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">></span><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><br>
<b>Subject:</b> Re: [llvm-dev] enabling interleaved access loop vectorization<u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">Hi Ayal, Elena,<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I'd really like to enable this by default.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">As I wrote above, I didn't see any regressions in internal benchmarks, and there doesn't seem to be anything in SPEC2006 either. I do see a performance improvement in an internal
 benchmark (that is, a real workload). <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Would you be able to provide an example that gets pessimized? I have no doubt you've seen regressions related to this, but the fact they exist doesn't help me analyze them as long
 as I can't see them. :-) I'd really rather look at regressions before making the change - and either try to make the necessary improvements to the cost model, or abandon this as unfeasible for now (pending Ashutosh's work). <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">If you can't, an alternative is to turn this on, and then, if regressions show up on anyone's radar (where we can actually get a reproducer), turn it off again and go back to analysis.
 But I'd strongly prefer to "prefetch" the problem.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">  Michael<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">On Wed, Aug 10, 2016 at 4:32 PM, Michael Kuperstein <<a href="mailto:mkuper@google.com" target="_blank">mkuper@google.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<div>
<p class="MsoNormal">So, unfortunately, it turns out I don't have access to DENBench.<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Do you happen to have a reduced example that gets pessimized by this?<u></u><u></u></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">On Tue, Aug 9, 2016 at 11:25 AM, Michael Kuperstein <<a href="mailto:mkuper@google.com" target="_blank">mkuper@google.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<div>
<p class="MsoNormal">Thanks Ayal!<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I'll take a look at DENBench.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">As another data point - I tried enabling this on our internal benchmarks. I'm seeing one regression, and it seems to be a regression of the "good" kind - without interleaving we
 don't vectorize the innermost loop, and with interleaving we do. The vectorized loop is actually significantly faster when benchmarked in isolation, but in this specific instance, the static loop count is unknown, and the dynamic loop count happens to almost
 always be 1 - and this lives inside a hot outer loop.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">That's something we ought to be handling through PGO (or, conceivably, outer loop vectorization :-) ).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:rgb(136,136,136)"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:rgb(136,136,136)">Michael</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">On Mon, Aug 8, 2016 at 3:21 PM, Zaks, Ayal <<a href="mailto:ayal.zaks@intel.com" target="_blank">ayal.zaks@intel.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">> We also need to understand what to do with edge elements in the vector if their loading is not required.
 We, probably, should issue a masked load in this case.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">The existing code solves such edge cases where the last element of an InterleaveGroup is absent by
 making sure the last iteration (and up to last VF iterations) are peeled and executed scalarly; see requiresScalarEpilogue.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">> All regressions that we see are in 32-bit mode.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">One place to find them, using the default BaseT::<wbr>getInterleavedMemoryOpCost(), is DENBench’s RGB conversions.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Ayal.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11pt;font-family:calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:calibri,sans-serif"> Demikhovsky, Elena
<br>
<b>Sent:</b> Monday, August 08, 2016 00:09<br>
<b>To:</b> Michael Kuperstein <</span><a href="mailto:mkuper@google.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">mkuper@google.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>; Renato Golin
 <</span><a href="mailto:renato.golin@linaro.org" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">renato.golin@linaro.org</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">><br>
<b>Cc:</b> Matthew Simpson <</span><a href="mailto:mssimpso@codeaurora.org" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">mssimpso@codeaurora.org</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>;
 Nema, Ashutosh <</span><a href="mailto:Ashutosh.Nema@amd.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">Ashutosh.Nema@amd.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>; Sanjay Patel <</span><a href="mailto:spatel@rotateright.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">spatel@rotateright.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>;
 llvm-dev <</span><a href="mailto:llvm-dev@lists.llvm.org" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">llvm-dev@lists.llvm.org</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>; Zaks, Ayal <</span><a href="mailto:ayal.zaks@intel.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">ayal.zaks@intel.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">><br>
<b>Subject:</b> RE: [llvm-dev] enabling interleaved access loop vectorization</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">We checked the gathered data again. All regressions that we see are in 32-bit mode. The 64-bit mode
 looks good overall.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:36pt">
<span style="font-family:calibri,sans-serif;color:rgb(47,84,150)">-</span><span style="font-size:7pt;color:rgb(47,84,150)">         
</span><b><i><span style="color:rgb(47,84,150)"> Elena</span></i></b><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p>
<div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0cm 0cm 0cm 4pt">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11pt;font-family:calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:calibri,sans-serif"> Michael Kuperstein [</span><a href="mailto:mkuper@google.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">mailto:mkuper@google.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">]
<br>
<b>Sent:</b> Saturday, August 06, 2016 02:56<br>
<b>To:</b> Renato Golin <</span><a href="mailto:renato.golin@linaro.org" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">renato.golin@linaro.org</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">><br>
<b>Cc:</b> Demikhovsky, Elena <</span><a href="mailto:elena.demikhovsky@intel.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">elena.demikhovsky@intel.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>;
 Matthew Simpson <</span><a href="mailto:mssimpso@codeaurora.org" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">mssimpso@codeaurora.org</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>; Nema, Ashutosh
 <</span><a href="mailto:Ashutosh.Nema@amd.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">Ashutosh.Nema@amd.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>; Sanjay Patel <</span><a href="mailto:spatel@rotateright.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">spatel@rotateright.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>;
 llvm-dev <</span><a href="mailto:llvm-dev@lists.llvm.org" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">llvm-dev@lists.llvm.org</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">>; Zaks, Ayal <</span><a href="mailto:ayal.zaks@intel.com" target="_blank"><span style="font-size:11pt;font-family:calibri,sans-serif">ayal.zaks@intel.com</span></a><span style="font-size:11pt;font-family:calibri,sans-serif">><br>
<b>Subject:</b> Re: [llvm-dev] enabling interleaved access loop vectorization</span><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:46.2pt">
 <u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:46.2pt">
 <u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:46.2pt">
On Fri, Aug 5, 2016 at 4:37 PM, Renato Golin <<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>> wrote:<u></u><u></u></p>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<p class="MsoNormal" style="margin-bottom:12pt;margin-left:46.2pt">
On 6 August 2016 at 00:18, Michael Kuperstein <<a href="mailto:mkuper@google.com" target="_blank">mkuper@google.com</a>> wrote:<br>
> I agree that we can get *more* improvement with better cost modeling, but<br>
> I'd expect to be able to get *some* improvement the way things are right<br>
> now.<br>
<br>
Elena said she saw "some" improvements. :)<u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal" style="margin-left:46.2pt">
 <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:46.2pt">
I didn't mean "some improvements, some regressions", I meant "some of the improvement we'd expect from the full solution". :-)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:46.2pt">
 <u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<p class="MsoNormal" style="margin-bottom:12pt;margin-left:46.2pt">
<br>
> That's why I'm curious about where we saw regressions - I'm wondering<br>
> whether there's really a significant cost modeling issue I'm missing, or<br>
> it's something that's easy to fix so that we can make forward progress,<br>
> while Ashutosh is working on the longer-term solution.<br>
<br>
Sounds like a task to try a few patterns and fiddle with the cost model.<br>
<br>
Arnold did a lot of those during the first months of the vectorizer,<br>
so it might be just a matter of finding the right heuristics, at least<br>
for the low hanging fruits.<br>
<br>
Of course, that'd also involve benchmarking everything else, to make<br>
sure the new heuristics doesn't introduce regressions on<br>
non-interleaved vectorisation.<u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal" style="margin-left:46.2pt">
 <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:46.2pt">
I don't disagree with you.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:46.2pt">
 <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:46.2pt">
All I'm saying is that before fiddling with the heuristics, it'd be good to understand what exactly breaks if we simply flip the flag. If the answer happens to be "nothing" - well, problem solved. Unfortunately, according to Elena, that's not the answer. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:46.2pt">
I'm going to play with it with our internal benchmarks, but it's my understanding that Elena/Ayal already have some idea of what the problems are.<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:46.2pt">
 <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<p>------------------------------<wbr>------------------------------<wbr>---------<br>
Intel Israel (74) Limited<u></u><u></u></p>
<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.<u></u><u></u></p>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<p>------------------------------<wbr>------------------------------<wbr>---------<br>
Intel Israel (74) Limited<u></u><u></u></p>
<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.<u></u><u></u></p>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></div><div><div class="gmail-h5">
<p>------------------------------<wbr>------------------------------<wbr>---------<br>
Intel Israel (74) Limited</p>

<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></div></div></div>

</blockquote></div><br></div></div></div>