romeric/Fastor

Missing maximum() function for AVX512

jakob0 opened this issue · 2 comments

Hi,
when I try to compile code using Fastor::max(), I get a compiler error.

The member function "maximum()" seems to be missing for Fastor::SIMDVector<double, simd_abi::avx512>.

Yes. I did not write this one intentionally. Horizontal operations are very expensive on AVX512 vector lanes. If you're stuck at compiling we can add a scalar variant for now.

Thanks
Roman

Ran into this problem after trying to compile some stuff on a skylake machine for the first time. Would just calling the 256-bit hmax on the upper and lower lane be an okay workaround? Something like:

double _mm512_hmax_pd(__m512d a) {
    __m256d afirst = _mm512_castpd512_pd256(a);
    __m256d asecond = _mm512_extractf64x4_pd (a,0x1);
    return std::fmax( _mm256_hmax_pd(afirst),_mm256_hmax_pd(asecond));
}