This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/N] x86_64 vectorization support: vectorized math functions addition to Glibc


On Thu, Sep 11, 2014 at 10:33:41PM -0700, Andi Kleen wrote:
> Rich Felker <dalias@libc.org> writes:
> >
> > This really seems like something the compiler should be doing --
> > translating parallelizable calls to the standard math functions into
> > calls to special simd versions (
> 
> Of course gcc already supports that. Even in two different flavours.
> 
> Not sure why the patch doesn't implement one of those ABIs though.

Because GCC supports even another flavor, which presumably the patches
implement.  The two you are mentioning are for compatibility with existing
math libraries.  The third one is used by #pragma omp declare simd
functions and Cilk+ elemental functions.  So, to use those you don't
need any extra gcc support, glibc headers could just add
#if defined(__OPENMP) && __OPENMP >= 201307
#pragma omp declare simd
#endif
on the prototypes (of course maybe with some clauses if needed).

IMHO entry points which take arbitrary length vectors in memory plus counts
are generally useful, you can do whatever you want under the hood, but
entrypoints with arguments directly in vector registers are useful too, you
don't have to use IFUNC for that, the compiler knows what version it
prefers, and if the body of the vectorized loop does more than just
compute a single transcendental function in a tight loop often will be more
handy than having to spill all the vectors to memory and pass it that way.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]