This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/N] x86_64 vectorization support: vectorized math functions addition to Glibc
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Wed, 12 Nov 2014 18:51:49 +0100
- Subject: Re: [PATCH 1/N] x86_64 vectorization support: vectorized math functions addition to Glibc
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3t=ppndDUBzHzSus7xyuF5hTaLFZ5b273jD39NtddSvsw at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1409101549490 dot 12853 at digraph dot polyomino dot org dot uk> <6D39441BF12EF246A7ABCE6654B0235320F09D65 at LEMAIL01 dot le dot imgtec dot org> <20140911210246 dot GN23797 at brightrain dot aerifal dot cx> <87a9655rnu dot fsf at tassilo dot jf dot intel dot com> <20140912074251 dot GZ17454 at tucnak dot redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1409121700030 dot 1118 at digraph dot polyomino dot org dot uk> <20140912170827 dot GE17454 at tucnak dot redhat dot com> <CAMXFM3u5DM_W=iiVReBszH4TY4Wwf3Vm7d79chwdfD_J5tTz5A at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Nov 12, 2014 at 09:42:11PM +0400, Andrew Senkevich wrote:
> 2014-09-12 21:08 GMT+04:00 Jakub Jelinek <jakub@redhat.com>:
>
> > On Fri, Sep 12, 2014 at 05:03:06PM +0000, Joseph S. Myers wrote:
> >> That's what this patch does - but we need a way for the headers to declare
> >> to GCC which vector ISAs have such versions of a given function available,
> >> in a way that works both for (new GCC, old glibc) (GCC knows about newer
> >> vector ISAs without function versions in that glibc, and mustn't try to
> >> generate calls to functions that glibc doesn't have) and (old GCC, new
> >> glibc) (glibc is declaring availability of vector versions the old GCC
> >> doesn't know how to use, so the references to those vector versions need
> >> to be quietly ignored or conditional on GCC version).
>
> > In Cilk+ there is a way to tell which ISA the elemental function is compiled
> > for. In OpenMP we've made a GCC ABI decision that on i?86/x86_64 all of
> > SSE2, AVX, AVX2 and AVX-512 passing conventions are used; those can be
> > emitted as aliases, thunks or real functions (have to optimize this on GCC
> > side at some point). E.g. in Intel ABI (which uses different letters) it
> > always uses just SSE2.
> > When/if AVX-1024 is added, we won't change the ABI, so one will still have
> > to use two AVX-512 calls; but perhaps we can add as OpenMP extension
> > some clause like Cilk+ has to specify ISA.
>
> As we see processor clause unfortunately not parsed by GCC.
> So no such way to specify ISA for both OpenMP and Cilk+ so far.
Processor clause is parsed for Cilk+. OpenMP doesn't have anything like
that, and I'm not sure it would be appropriate for the standard, because
the standard is not specific to a single CPU architecture and all parties
would need to agree on the names. You actually don't care about the
processors anyway, but about the vector ISA.
> GCC 4.9 and 5.0 both can vectorize in SSE2, AVX, AVX2, AVX-512 (with
> -mavx512f generated 2 calls of AVX2 versions).
Indeed, those 3 are what GCC emits for OpenMP, AVX-512 is not emitted,
for Cilk+ it should emit SSE2 unless processor clause is used.
Jakub