3 ms·
(Too late for edit) Looks like Eigen also defaults to EIGEN_FAST_MATH which makes Eigen's psqrt ("packet sqrt") use _mm256_rsqrt_ps instead of _mm256_sqrt_ps [
by boulos 5y ago
(Too late for edit)
Looks like Eigen also defaults to EIGEN_FAST_MATH which makes Eigen's psqrt ("packet sqrt") use _mm256_rsqrt_ps instead of _mm256_sqrt_ps [1].
Interestingly, the thing they're trying to avoid (long latency of sqrt vs rsqrt) hasn't been true for a long time on Intel processors, but apparently is still true for AMD parts according to Agner Fog's tables [2] (though maybe I'm reading them wrong, there is no vsqrtps entry for Zen2/3).
Hopefully, Eigen will separate the single global "fast math" config [3].
[1] https://gitlab.com/libeigen/eigen/-/blob/a75122584594fb98db09d1665b5b39c98b2b967d/Eigen/src/Core/arch/AVX/MathFunctions.h#L110 https://gitlab.com/libeigen/eigen/-/blob/a75122584594fb98db0...
[2] https://agner.org/optimize/instruction_tables.pdf https://agner.org/optimize/instruction_tables.pdf
[3] https://gitlab.com/libeigen/eigen/-/issues/1687 https://gitlab.com/libeigen/eigen/-/issues/1687