[PATCH] Enable SLP-vectorization of intrinsics.

Hal Finkel hfinkel at anl.gov
Wed Jan 22 14:13:21 PST 2014


----- Original Message -----
> From: "Raul Silvera" <rsilvera at google.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "Nadav Rotem" <nrotem at apple.com>, reviews+D2535+public+071e8fd9238b048b at llvm-reviews.chandlerc.com, "Chandler
> Carruth" <chandlerc at gmail.com>, "llvm-commits" <llvm-commits at cs.uiuc.edu>
> Sent: Wednesday, January 22, 2014 4:08:31 PM
> Subject: Re: [PATCH] Enable SLP-vectorization of intrinsics.
> 
> 
> 
> Well, either removing that or implementing a mechanism to fully model
> this would resolve the issue.
> If this is known to be widely broken the former would be the easiest
> to do, of course. Who should we consult on this, llvm-dev? Should I
> prepare a patch?

You can try asking on llvmdev. If that does not trigger any useful discussion, then just submit a patch.

> 
> 
> This impacts more than just vectorization, I can construct simple
> testcases where we fail to common scalar sqrt calls.

Yep.

 -Hal

> 
> 
> 
> 
> 
> On Wed, Jan 22, 2014 at 6:58 AM, Hal Finkel < hfinkel at anl.gov >
> wrote:
> 
> 
> 
> ----- Original Message -----
> > From: "Raul Silvera" < rsilvera at google.com >
> > To: "Hal Finkel" < hfinkel at anl.gov >
> 
> > Cc: "Nadav Rotem" < nrotem at apple.com >,
> > reviews+D2535+public+071e8fd9238b048b at llvm-reviews.chandlerc.com ,
> > "Chandler
> > Carruth" < chandlerc at gmail.com >, "llvm-commits" <
> > llvm-commits at cs.uiuc.edu >
> > Sent: Tuesday, January 21, 2014 8:45:22 PM
> > Subject: Re: [PATCH] Enable SLP-vectorization of intrinsics.
> > 
> > 
> > 
> 
> > 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?
> 
> To be honest, I'm not exactly sure why we both modeling this at all.
> Clang/LLVM have a stated policy of not supporting floating-point
> environment access (#pragma STDC FENV_ACCESS ON is not supported --
> Clang will complain if you try). Our modeling of these things is
> explicitly broken in other respects.
> 
> -Hal
> 
> 
> > 
> > 
> > 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
> > 
> > 
> 
> --
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory
> 
> 
> 
> 
> --
> 
> 
> Raúl E. Silvera
> 
>




More information about the llvm-commits mailing list