<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">I had a closer look trying to get a case to work vectorizing sqrt. Unfortunately we fail to SLP vectorize even simple cases because the sqrt intrinsic (as well as the other math-related intrinsics) are marked as read-only, creating dependences with user stores.</div>
<div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">I found the code in <span style="font-family:arial">include/llvm/IR/Intrinsics.td</span> where these attributes are set, and there is a comment about them being treated conservatively to model their dependence to hardware FP rounding modes. This could be addressed by having a separate attribute to model FP hardware settings (think of it as sqrt reading a specific system memory location instead of reading all of user memory).</div>
<div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Has something like that been considered in the past, or is there a different long-term strategy for dealing with these implicit dependences?</div>
<div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">If I manually remove the attribute we do SLP-vectorize a simple case and seem to get the expected speedups from using vector sqrt instructions.</div>








</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 17, 2014 at 12:41 PM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">----- Original Message -----<br>
> From: "Nadav Rotem" <<a href="mailto:nrotem@apple.com">nrotem@apple.com</a>><br>
</div><div class="im">> To: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>><br>
> Cc: <a href="mailto:reviews%2BD2535%2Bpublic%2B071e8fd9238b048b@llvm-reviews.chandlerc.com">reviews+D2535+public+071e8fd9238b048b@llvm-reviews.chandlerc.com</a>, <a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>, <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>,<br>

> <a href="mailto:rsilvera@google.com">rsilvera@google.com</a><br>
> Sent: Friday, January 17, 2014 2:18:53 PM<br>
> Subject: Re: [PATCH] Enable SLP-vectorization of intrinsics.<br>
><br>
</div><div class="im">> I think that we are converting some functions to llvm intrinsics.<br>
> Right?<br>
<br>
</div>Clang produces intrinsics for sqrt (only in fast-math mode), pow and fma. I think that's it, and until you get to CodeGen, I don't think we normally convert anything else at the LLVM level.<br>
<span class="HOEnZb"><font color="#888888"><br>
 -Hal<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> On Jan 17, 2014, at 12:11 PM, Hal Finkel <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>> wrote:<br>
><br>
> > ----- Original Message -----<br>
> >> From: "Nadav Rotem" <<a href="mailto:nrotem@apple.com">nrotem@apple.com</a>><br>
> >> To: <a href="mailto:nrotem@apple.com">nrotem@apple.com</a>, <a href="mailto:rsilvera@google.com">rsilvera@google.com</a><br>
> >> Cc: <a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>, <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> >> Sent: Friday, January 17, 2014 2:06:55 PM<br>
> >> Subject: Re: [PATCH] Enable SLP-vectorization of intrinsics.<br>
> >><br>
> >><br>
> >>  The code looks great.  I was wondering if you had a chance to run<br>
> >>  some performance tests on it.  Does it catch anything in the LLVM<br>
> >>  test suite?<br>
> ><br>
> > Why do you expect it to catch anything in the test-suite until we<br>
> > get the function calls too (just as we do in the loop vectorizer)?<br>
> ><br>
> > -Hal<br>
> ><br>
> >><br>
> >> <a href="http://llvm-reviews.chandlerc.com/D2535" target="_blank">http://llvm-reviews.chandlerc.com/D2535</a><br>
> >> _______________________________________________<br>
> >> llvm-commits mailing list<br>
> >> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> >> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
> >><br>
> ><br>
> > --<br>
> > Hal Finkel<br>
> > Assistant Computational Scientist<br>
> > Leadership Computing Facility<br>
> > Argonne National Laboratory<br>
><br>
><br>
<br>
--<br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div><font size="4" face="arial black, sans-serif" style="background-color:rgb(0,0,0)" color="#b45f06"> Raúl E. Silvera </font></div>
<div><br></div></div>
</div>