From 162330f25aeec09694fffaaa31ba9b318620eb9c Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Wed, 29 Apr 2020 21:28:15 +0200 Subject: build: rework x86 CPU variants Type: improvement Change-Id: Ief243f88e654e578ef9b8060fcf535b364aececb Signed-off-by: Damjan Marion --- src/vppinfra/cpu.h | 17 ++++++++++++++--- src/vppinfra/string.h | 2 +- src/vppinfra/vector.h | 7 +++++-- 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src/vppinfra') diff --git a/src/vppinfra/cpu.h b/src/vppinfra/cpu.h index 7bd5dfe9722..dc73c90ca34 100644 --- a/src/vppinfra/cpu.h +++ b/src/vppinfra/cpu.h @@ -132,6 +132,9 @@ _ (x86_aes, 1, ecx, 25) \ _ (sha, 7, ebx, 29) \ _ (vaes, 7, ecx, 9) \ _ (vpclmulqdq, 7, ecx, 10) \ +_ (avx512_vnni, 7, ecx, 11) \ +_ (avx512_bitalg, 7, ecx, 12) \ +_ (avx512_vpopcntdq, 7, ecx, 14) \ _ (invariant_tsc, 0x80000007, edx, 8) @@ -245,15 +248,23 @@ clib_cpu_supports_aes () } static inline int -clib_cpu_march_priority_avx512 () +clib_cpu_march_priority_icl () +{ + if (clib_cpu_supports_avx512_bitalg ()) + return 200; + return -1; +} + +static inline int +clib_cpu_march_priority_skx () { if (clib_cpu_supports_avx512f ()) - return 20; + return 100; return -1; } static inline int -clib_cpu_march_priority_avx2 () +clib_cpu_march_priority_hsw () { if (clib_cpu_supports_avx2 ()) return 50; diff --git a/src/vppinfra/string.h b/src/vppinfra/string.h index a3db9264cac..3dafe899a8f 100644 --- a/src/vppinfra/string.h +++ b/src/vppinfra/string.h @@ -71,7 +71,7 @@ void clib_memswap (void *_a, void *_b, uword bytes); * so don't let it anywhere near them. */ #ifndef __COVERITY__ -#if __AVX512F__ +#if __AVX512BITALG__ #include #elif __AVX2__ #include diff --git a/src/vppinfra/vector.h b/src/vppinfra/vector.h index 906d8d8fbfd..8b08db22124 100644 --- a/src/vppinfra/vector.h +++ b/src/vppinfra/vector.h @@ -66,7 +66,7 @@ #endif #endif -#if defined (__AVX512F__) +#if defined (__AVX512BITALG__) #define CLIB_HAVE_VEC512 #endif @@ -168,7 +168,10 @@ typedef u64 u64x _vector_size (8); #include #endif -#if defined (__AVX512F__) +#if defined (__AVX512BITALG__) +/* Due to power level transition issues, we don't preffer AVX-512 on + Skylake X and CascadeLake CPUs, AVX512BITALG is introduced on + icelake CPUs */ #include #endif -- cgit 1.2.3-korg