Fastor icon indicating copy to clipboard operation
Fastor copied to clipboard

Missing maximum() function for AVX512

Open jakob0 opened this issue 3 years ago • 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>.

jakob0 avatar May 20 '21 12:05 jakob0

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

romeric avatar Jul 21 '21 04:07 romeric

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));
}

J-S-Robinson avatar Oct 17 '21 04:10 J-S-Robinson