build: add support for intel alderlake and sapphirerapids 83/38483/2
authorDamjan Marion <damarion@cisco.com>
Tue, 14 Mar 2023 12:34:59 +0000 (13:34 +0100)
committerDave Wallace <dwallacelf@gmail.com>
Tue, 14 Mar 2023 16:01:08 +0000 (16:01 +0000)
Disabled by default..

Type: improvement
Change-Id: I36176c009e0873c048874ae38a7ea0a91449235c
Signed-off-by: Damjan Marion <damarion@cisco.com>
src/cmake/cpu.cmake
src/vppinfra/cpu.h

index 7fb7b59..c10158b 100644 (file)
@@ -126,6 +126,11 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
     OFF
   )
 
+  add_vpp_march_variant(adl
+    FLAGS -march=alderlake -mtune=alderlake -mprefer-vector-width=256
+    OFF
+  )
+
   if (GNU_ASSEMBLER_AVX512_BUG)
      message(WARNING "AVX-512 multiarch variant(s) disabled due to GNU Assembler bug")
   else()
@@ -136,6 +141,11 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
     add_vpp_march_variant(icl
       FLAGS -march=icelake-client -mtune=icelake-client -mprefer-vector-width=512
     )
+
+    add_vpp_march_variant(spr
+      FLAGS -march=sapphirerapids -mtune=sapphirerapids -mprefer-vector-width=512
+      OFF
+    )
   endif()
 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
   set(VPP_DEFAULT_MARCH_FLAGS -march=armv8-a+crc)
index 769bdb5..efa85ad 100644 (file)
@@ -138,6 +138,7 @@ _CLIB_MARCH_FN_REGISTRATION(fn)
   _ (avx512_vpopcntdq, 7, ecx, 14)                                            \
   _ (movdiri, 7, ecx, 27)                                                     \
   _ (movdir64b, 7, ecx, 28)                                                   \
+  _ (enqcmd, 7, ecx, 29)                                                      \
   _ (avx512_fp16, 7, edx, 23)                                                 \
   _ (invariant_tsc, 0x80000007, edx, 8)
 
@@ -238,6 +239,14 @@ clib_cpu_supports_aes ()
 #endif
 }
 
+static inline int
+clib_cpu_march_priority_spr ()
+{
+  if (clib_cpu_supports_enqcmd ())
+    return 300;
+  return -1;
+}
+
 static inline int
 clib_cpu_march_priority_icl ()
 {
@@ -246,6 +255,14 @@ clib_cpu_march_priority_icl ()
   return -1;
 }
 
+static inline int
+clib_cpu_march_priority_adl ()
+{
+  if (clib_cpu_supports_movdiri () && clib_cpu_supports_avx2 ())
+    return 150;
+  return -1;
+}
+
 static inline int
 clib_cpu_march_priority_skx ()
 {
@@ -258,7 +275,7 @@ static inline int
 clib_cpu_march_priority_trm ()
 {
   if (clib_cpu_supports_movdiri ())
-    return 60;
+    return 40;
   return -1;
 }