Determining maximum vector length supported by the CPU?
Martin Reinecke
martin@MPA-Garching.MPG.DE
Wed May 22 09:27:00 GMT 2019
On 5/22/19 11:17 AM, Richard Biener wrote:
>> 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...
You mean different vector lengths for float, double, int etc?
I would be fine to have different macros for those, if necessary.
> I wonder if we'd want to have a 'auto' length instead ;)
I know it's weird, but for my code (which is definitely not a synthetic
test case) that would work perfectly :)
If you'd like to have a look:
https://gitlab.mpcdf.mpg.de/mtr/pocketfft/tree/cpp
(the only platform-dependent part is on lines 82-95 of the header file).
Still, I would need a way to determine how long the vectors actually
are. But it would probably be enough to measure this at runtime then.
Cheers,
Martin
More information about the Gcc
mailing list