This is the mail archive of the 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, 27 Nov 2014, Andrew Senkevich wrote:

> 2014-11-27 20:17 GMT+03:00 Joseph Myers <>:
> > This is all that is needed.  It needs to be written in a
> > compiler-independent manner (and agreed between compilers), and state
> > explicitly that the semantics of those pragmas are independent of the
> > processor for which code is being generated (so, for example, those
> > pragmas must not be interpreted as meaning AVX512 versions of functions
> > are available even if code is being built for a processor with AVX512
> > support) and that any future ABI extension that defines additional vector
> > function versions will also define a different pragma to declare their
> > availability.

Should be something like: "OpenMP vector function ABI for x86_64" (as it's 
about the meaning of #pragma omp declare simd for x86_64, and then glibc 
is simply a user - any other library could equally rely on such an ABI to 
describe the meaning of such a pragma in its headers).

> #pragma omp declare simd notinbranch simdlen(2) for some function
> âfuncâ means what the name of vector version is:
> _ZGVbN2v_func (it is SSE4 implementation).
> #pragma omp declare simd notinbranch simdlen(4) for some function
> âfuncâ means what the following names are available:
> _ZGVcN4v_func (it is AVX implementation)
> and
> _ZGVdN4v_func (it is AVX2 implementation).
> Every vector function should be provided by Glibc for each supported
> ISA (currently SSE4, AVX and AVX2).

The generic statement would seem to mean: if simdlen(2) is used then only 
the SSE4 version is needed; if simdlen(4) is used then the AVX and AVX2 
versions are needed; only if both are used are all three versions then 
needed.  Is that accurate?  This ABI document should be defining what any 
library can rely on when providing SIMD function implementations and an 
associated installed header that may be used with multiple compilers, 
rather than talking specifically about glibc choices.

> Those pragmas must not be interpreted as meaning AVX512 versions of
> functions are available even if code is being built for a processor
> with AVX512 support.

This should say "for example" or similar (AVX512 is simply an illustrative 

> Is it Ok and where is the proper place to put this document, include
> to documentation I think, not to wiki?

I suggest putting the OpenMP ABI for x86_64 alongside that other ABI 
document you mentioned.  Or, you could add all the relevant OpenMP 
information to the x86_64 ABI document: - discussed on the mailing list.

The important thing is not so much where it goes - it's that OpenMP 
maintainers for relevant compilers (probably GCC, LLVM, Intel compiler) 
agree that it represents how they intend to interpret the pragmas, so that 
when glibc installs headers with those pragmas we can be confident 
compilers will interpret them as intended and so programs can be built 
with one compiler to use these functions in glibc built with another 

Joseph S. Myers

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