Determining maximum vector length supported by the CPU?
Matthias Kretz
m.kretz@gsi.de
Wed May 22 09:27:00 GMT 2019
On Mittwoch, 22. Mai 2019 11:17:57 CEST Richard Biener wrote:
> On Wed, May 22, 2019 at 10:36 AM Martin Reinecke
> <martin@mpa-garching.mpg.de> wrote:
> > Hi Matthias!
> >
> > > I agree, we need more information from the compiler. Esp. whether the
> > > user
> > > specified `-mprefer-avx128` or `-mprefer-vector-width=none/128/256/512`.
> > > OTOH `-msve-vector-bits=N` is reported as __ARM_FEATURE_SVE_BITS. So
> > > that's
> > > covered.
> >
> > Almost ... except that I'd need a platform-agnostic definition. The
> > point is that the code does not care about the underlying hardware at
> > all, only for the vector length supported by it.
>
> And then you run into AVX + SSE vs. AVX2 + SSE cases where the (optimal)
> length depends on the component type...
>
> I wonder if we'd want to have a 'auto' length instead ;)
>
> I suppose exposing a __BIGGEST_VECTOR__ might be possible (not for SVE
> though?).
AVX vs. AVX2 is a valid question. std::experimental::simd solves it by having
the size depend on the element type. So I agree, `vector_size(auto)` seems
like a possible solution. One could then take the sizeof if the number is
important to know.
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://kretzfamily.de
GSI Helmholtzzentrum für Schwerionenforschung https://gsi.de
SIMD easy and portable https://github.com/VcDevel/Vc
──────────────────────────────────────────────────────────────────────────
More information about the Gcc
mailing list