diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-09-12 07:46:11 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-09-12 07:54:47 -0700 |
commit | ef8adeb0416309082c41a1518caee6961b5c42e8 (patch) | |
tree | 1907bd459f82a962252cc5852bbee9025b3a99ad /sysdeps/x86_64/fpu | |
parent | a166531fdf601560a0005479427f60d3173f8257 (diff) | |
download | glibc-ef8adeb0416309082c41a1518caee6961b5c42e8.tar.gz glibc-ef8adeb0416309082c41a1518caee6961b5c42e8.tar.xz glibc-ef8adeb0416309082c41a1518caee6961b5c42e8.zip |
x86: Add MathVec_Prefer_No_AVX512 to cpu-features [BZ #21967]
AVX512 functions in mathvec are used on machines with AVX512. An AVX2 wrapper is also provided and it can be used when the AVX512 version isn't profitable. MathVec_Prefer_No_AVX512 is addded to cpu-features. If glibc.tune.hwcaps=MathVec_Prefer_No_AVX512 is set in GLIBC_TUNABLES environment variable, the AVX2 wrapper will be used. Tested on x86-64 machines with and without AVX512. Also verified glibc.tune.hwcaps=MathVec_Prefer_No_AVX512 on AVX512 machine. [BZ #21967] * sysdeps/x86/cpu-features.h (bit_arch_MathVec_Prefer_No_AVX512): New. (index_arch_MathVec_Prefer_No_AVX512): Likewise. * sysdeps/x86/cpu-tunables.c (TUNABLE_CALLBACK (set_hwcaps)): Handle MathVec_Prefer_No_AVX512. * sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx512.h (IFUNC_SELECTOR): Return AVX2 version if MathVec_Prefer_No_AVX512 is set.
Diffstat (limited to 'sysdeps/x86_64/fpu')
-rw-r--r-- | sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx512.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx512.h b/sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx512.h index 1857e1f760..fffc9da114 100644 --- a/sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx512.h +++ b/sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx512.h @@ -32,11 +32,14 @@ IFUNC_SELECTOR (void) { const struct cpu_features* cpu_features = __get_cpu_features (); - if (CPU_FEATURES_ARCH_P (cpu_features, AVX512DQ_Usable)) - return OPTIMIZE (skx); - - if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)) - return OPTIMIZE (knl); + if (!CPU_FEATURES_ARCH_P (cpu_features, MathVec_Prefer_No_AVX512)) + { + if (CPU_FEATURES_ARCH_P (cpu_features, AVX512DQ_Usable)) + return OPTIMIZE (skx); + + if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)) + return OPTIMIZE (knl); + } return OPTIMIZE (avx2_wrapper); } |