[PATCH] Enable SLP-vectorization of intrinsics.

Raul Silvera rsilvera at google.com
Tue Jan 21 18:45:22 PST 2014


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.

I found the code in include/llvm/IR/Intrinsics.td 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).

Has something like that been considered in the past, or is there a
different long-term strategy for dealing with these implicit dependences?

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.


On Fri, Jan 17, 2014 at 12:41 PM, Hal Finkel <hfinkel at anl.gov> wrote:

> ----- Original Message -----
> > From: "Nadav Rotem" <nrotem at apple.com>
> > To: "Hal Finkel" <hfinkel at anl.gov>
> > Cc: reviews+D2535+public+071e8fd9238b048b at llvm-reviews.chandlerc.com,
> chandlerc at gmail.com, llvm-commits at cs.uiuc.edu,
> > rsilvera at google.com
> > Sent: Friday, January 17, 2014 2:18:53 PM
> > Subject: Re: [PATCH] Enable SLP-vectorization of intrinsics.
> >
> > I think that we are converting some functions to llvm intrinsics.
> > Right?
>
> 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.
>
>  -Hal
>
> >
> > On Jan 17, 2014, at 12:11 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> >
> > > ----- Original Message -----
> > >> From: "Nadav Rotem" <nrotem at apple.com>
> > >> To: nrotem at apple.com, rsilvera at google.com
> > >> Cc: chandlerc at gmail.com, llvm-commits at cs.uiuc.edu
> > >> Sent: Friday, January 17, 2014 2:06:55 PM
> > >> Subject: Re: [PATCH] Enable SLP-vectorization of intrinsics.
> > >>
> > >>
> > >>  The code looks great.  I was wondering if you had a chance to run
> > >>  some performance tests on it.  Does it catch anything in the LLVM
> > >>  test suite?
> > >
> > > Why do you expect it to catch anything in the test-suite until we
> > > get the function calls too (just as we do in the loop vectorizer)?
> > >
> > > -Hal
> > >
> > >>
> > >> http://llvm-reviews.chandlerc.com/D2535
> > >> _______________________________________________
> > >> llvm-commits mailing list
> > >> llvm-commits at cs.uiuc.edu
> > >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> > >>
> > >
> > > --
> > > Hal Finkel
> > > Assistant Computational Scientist
> > > Leadership Computing Facility
> > > Argonne National Laboratory
> >
> >
>
> --
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory
>



-- 
 Raúl E. Silvera
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140121/0070faa8/attachment.html>


More information about the llvm-commits mailing list