diff options
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | build-data/packages/libmemif.mk | 4 | ||||
-rw-r--r-- | build-data/packages/sample-plugin.mk | 4 | ||||
-rw-r--r-- | build-data/packages/vom.mk | 4 | ||||
-rw-r--r-- | build-data/packages/vpp.mk | 4 | ||||
-rw-r--r-- | extras/rpm/vpp.spec | 4 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/cmake/cpu.cmake | 14 | ||||
-rw-r--r-- | src/vlib/node_cli.c | 2 | ||||
-rw-r--r-- | src/vppinfra/cpu.h | 17 | ||||
-rw-r--r-- | src/vppinfra/string.h | 2 | ||||
-rw-r--r-- | src/vppinfra/vector.h | 7 | ||||
-rw-r--r-- | test/test_node_variants.py | 55 |
13 files changed, 83 insertions, 45 deletions
@@ -59,11 +59,6 @@ else ifeq ($(filter rhel centos fedora opensuse opensuse-leap opensuse-tumblewee PKG=rpm endif -# on ubuntu 18.04 prefer gcc-8 if it is installed and CC is not set -ifeq ($(OS_VERSION_ID)-$(CC)-$(shell which gcc-8 > /dev/null; echo $$?),18.04-cc-0) - CC = gcc-8 -endif - # +libganglia1-dev if building the gmond plugin DEB_DEPENDS = curl build-essential autoconf automake ccache @@ -86,7 +81,7 @@ ifeq ($(OS_VERSION_ID),16.04) else ifeq ($(OS_VERSION_ID),18.04) DEB_DEPENDS += python-dev DEB_DEPENDS += libssl-dev - DEB_DEPENDS += gcc-8 clang-9 + DEB_DEPENDS += clang-9 else ifeq ($(OS_VERSION_ID),20.04) LIBFFI=libffi7 else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-8) @@ -132,7 +127,7 @@ else RPM_DEPENDS += python36-ply # for vppapigen RPM_DEPENDS += python3-devel python3-pip RPM_DEPENDS += python-virtualenv python36-jsonschema - RPM_DEPENDS += devtoolset-7 + RPM_DEPENDS += devtoolset-9 RPM_DEPENDS += cmake3 RPM_DEPENDS_GROUPS = 'Development Tools' endif diff --git a/build-data/packages/libmemif.mk b/build-data/packages/libmemif.mk index 9bce09b5f25..acc0d64257f 100644 --- a/build-data/packages/libmemif.mk +++ b/build-data/packages/libmemif.mk @@ -27,8 +27,8 @@ libmemif_cmake_args += -DCMAKE_SHARED_LINKER_FLAGS="$($(TAG)_TAG_LDFLAGS)" libmemif_cmake_args += -DCMAKE_PREFIX_PATH:PATH="$(PACKAGE_INSTALL_DIR)/../vpp" # Use devtoolset on centos 7 -ifneq ($(wildcard /opt/rh/devtoolset-7/enable),) -libmemif_cmake_args += -DCMAKE_PROGRAM_PATH:PATH="/opt/rh/devtoolset-7/root/bin" +ifneq ($(wildcard /opt/rh/devtoolset-9/enable),) +libmemif_cmake_args += -DCMAKE_PROGRAM_PATH:PATH="/opt/rh/devtoolset-9/root/bin" endif libmemif_configure = \ diff --git a/build-data/packages/sample-plugin.mk b/build-data/packages/sample-plugin.mk index 77855671b12..34188f9e7a7 100644 --- a/build-data/packages/sample-plugin.mk +++ b/build-data/packages/sample-plugin.mk @@ -31,8 +31,8 @@ sample-plugin_cmake_args += -DCMAKE_SHARED_LINKER_FLAGS="$($(TAG)_TAG_LDFLAGS)" sample-plugin_cmake_args += -DCMAKE_PREFIX_PATH:PATH="$(PACKAGE_INSTALL_DIR)/../vpp" # Use devtoolset on centos 7 -ifneq ($(wildcard /opt/rh/devtoolset-7/enable),) -sample-plugin_cmake_args += -DCMAKE_PROGRAM_PATH:PATH="/opt/rh/devtoolset-7/root/bin" +ifneq ($(wildcard /opt/rh/devtoolset-9/enable),) +sample-plugin_cmake_args += -DCMAKE_PROGRAM_PATH:PATH="/opt/rh/devtoolset-9/root/bin" endif sample-plugin_configure = \ diff --git a/build-data/packages/vom.mk b/build-data/packages/vom.mk index fefd49ac841..f284473beb5 100644 --- a/build-data/packages/vom.mk +++ b/build-data/packages/vom.mk @@ -28,8 +28,8 @@ vom_cmake_args += -DCMAKE_SHARED_LINKER_FLAGS="$($(TAG)_TAG_LDFLAGS)" vom_cmake_args += -DCMAKE_PREFIX_PATH:PATH="$(PACKAGE_INSTALL_DIR)/../vpp" # Use devtoolset on centos 7 -ifneq ($(wildcard /opt/rh/devtoolset-7/enable),) -vom_cmake_args += -DCMAKE_PROGRAM_PATH:PATH="/opt/rh/devtoolset-7/root/bin" +ifneq ($(wildcard /opt/rh/devtoolset-9/enable),) +vom_cmake_args += -DCMAKE_PROGRAM_PATH:PATH="/opt/rh/devtoolset-9/root/bin" endif vom_configure = \ diff --git a/build-data/packages/vpp.mk b/build-data/packages/vpp.mk index 6571cd2cf09..bbff1ba564f 100644 --- a/build-data/packages/vpp.mk +++ b/build-data/packages/vpp.mk @@ -37,8 +37,8 @@ endif endif # Use devtoolset on centos 7 -ifneq ($(wildcard /opt/rh/devtoolset-7/enable),) -vpp_cmake_args += -DCMAKE_PROGRAM_PATH:PATH="/opt/rh/devtoolset-7/root/bin" +ifneq ($(wildcard /opt/rh/devtoolset-9/enable),) +vpp_cmake_args += -DCMAKE_PROGRAM_PATH:PATH="/opt/rh/devtoolset-9/root/bin" endif ifneq ($(VPP_EXTRA_CMAKE_ARGS),) diff --git a/extras/rpm/vpp.spec b/extras/rpm/vpp.spec index 726c9c42f28..f2de430d670 100644 --- a/extras/rpm/vpp.spec +++ b/extras/rpm/vpp.spec @@ -68,7 +68,7 @@ BuildRequires: mbedtls-devel mbedtls BuildREquires: openssl-devel BuildRequires: python36-devel %if 0%{rhel} == 7 -BuildRequires: devtoolset-7-toolchain +BuildRequires: devtoolset-9-toolchain BuildRequires: cmake3 BuildRequires: glibc-static, yum-utils %else @@ -177,7 +177,7 @@ groupadd -f -r vpp %build %if 0%{rhel} < 8 -. /opt/rh/devtoolset-7/enable +. /opt/rh/devtoolset-9/enable %endif %if %{with aesni} make bootstrap diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 16ae7d5451d..1564fd0ad8c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,7 +13,7 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) -set(CMAKE_C_COMPILER_NAMES clang-9 cc) +set(CMAKE_C_COMPILER_NAMES clang-10 clang-9 gcc-9 cc) project(vpp C) diff --git a/src/cmake/cpu.cmake b/src/cmake/cpu.cmake index 0ce8bea31ec..0e47f3325cf 100644 --- a/src/cmake/cpu.cmake +++ b/src/cmake/cpu.cmake @@ -76,17 +76,21 @@ endif() ############################################################################## if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") set(CMAKE_C_FLAGS "-march=corei7 -mtune=corei7-avx ${CMAKE_C_FLAGS}") - check_c_compiler_flag("-march=core-avx2" compiler_flag_march_core_avx2) - if(compiler_flag_march_core_avx2) - list(APPEND MARCH_VARIANTS "avx2\;-march=core-avx2 -mtune=core-avx2") + check_c_compiler_flag("-march=haswell" compiler_flag_march_haswell) + if(compiler_flag_march_haswell) + list(APPEND MARCH_VARIANTS "hsw\;-march=haswell -mtune=haswell") endif() if (GNU_ASSEMBLER_AVX512_BUG) message(WARNING "AVX-512 multiarch variant(s) disabled due to GNU Assembler bug") else() + check_c_compiler_flag("-mprefer-vector-width=256" compiler_flag_mprefer_vector_width) check_c_compiler_flag("-march=skylake-avx512" compiler_flag_march_skylake_avx512) check_c_compiler_flag("-march=icelake-client" compiler_flag_march_icelake_client) - if(compiler_flag_march_skylake_avx512) - list(APPEND MARCH_VARIANTS "avx512\;-march=skylake-avx512 -mtune=skylake-avx512") + if(compiler_flag_march_skylake_avx512 AND compiler_flag_mprefer_vector_width) + list(APPEND MARCH_VARIANTS "skx\;-march=skylake-avx512 -mtune=skylake-avx512 -mprefer-vector-width=256") + endif() + if(compiler_flag_march_icelake_client AND compiler_flag_mprefer_vector_width) + list(APPEND MARCH_VARIANTS "icl\;-march=icelake-client -mtune=icelake-client -mprefer-vector-width=512") endif() endif() elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)") diff --git a/src/vlib/node_cli.c b/src/vlib/node_cli.c index 750f69e5d60..7cfc4a36f8c 100644 --- a/src/vlib/node_cli.c +++ b/src/vlib/node_cli.c @@ -623,7 +623,7 @@ show_node (vlib_main_t * vm, unformat_input_t * input, if (vec_len (s) == 0) s = format (s, "\n %-15s %=8s %6s", "Name", "Priority", "Active"); - s = format (s, "\n %-15s %=8u %=6s", fnr->name, fnr->priority, + s = format (s, "\n %-15s %8d %=6s", fnr->name, fnr->priority, fnr->function == n->function ? "yes" : ""); fnr = fnr->next_registration; } 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 <vppinfra/memcpy_avx512.h> #elif __AVX2__ #include <vppinfra/memcpy_avx2.h> 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 <vppinfra/vector_avx2.h> #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 <vppinfra/vector_avx512.h> #endif diff --git a/test/test_node_variants.py b/test/test_node_variants.py index 8298dc863a4..3632910e3cb 100644 --- a/test/test_node_variants.py +++ b/test/test_node_variants.py @@ -67,48 +67,73 @@ class TestNodeVariant(VppTestCase): self.assertEqual(variant_info[0], variant) -class TestAVX512Variant(TestNodeVariant): - """ Test avx512 Node Variants """ +class TestICLVariant(TestNodeVariant): + """ Test icl Node Variants """ - VARIANT = "avx512" - LINUX_VARIANT = VARIANT + "f" + VARIANT = "icl" + LINUX_VARIANT = "avx512_bitalg" @classmethod def setUpConstants(cls): - super(TestAVX512Variant, cls).setUpConstants(cls.VARIANT) + super(TestICLVariant, cls).setUpConstants(cls.VARIANT) @classmethod def setUpClass(cls): - super(TestAVX512Variant, cls).setUpClass() + super(TestICLVariant, cls).setUpClass() @classmethod def tearDownClass(cls): - super(TestAVX512Variant, cls).tearDownClass() + super(TestICLVariant, cls).tearDownClass() @unittest.skipUnless(skipVariant(LINUX_VARIANT), VARIANT + " not a supported variant, skip.") - def test_avx512(self): + def test_icl(self): self.checkVariant(self.VARIANT) -class TestAVX2Variant(TestNodeVariant): +class TestSKXVariant(TestNodeVariant): + """ Test skx Node Variants """ + + VARIANT = "skx" + LINUX_VARIANT = "avx512f" + + @classmethod + def setUpConstants(cls): + super(TestSKXVariant, cls).setUpConstants(cls.VARIANT) + + @classmethod + def setUpClass(cls): + super(TestSKXVariant, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + super(TestSKXVariant, cls).tearDownClass() + + @unittest.skipUnless(skipVariant(LINUX_VARIANT), + VARIANT + " not a supported variant, skip.") + def test_skx(self): + self.checkVariant(self.VARIANT) + + +class TestHSWVariant(TestNodeVariant): """ Test avx2 Node Variants """ - VARIANT = "avx2" + VARIANT = "hsw" + LINUX_VARIANT = "avx2" @classmethod def setUpConstants(cls): - super(TestAVX2Variant, cls).setUpConstants(cls.VARIANT) + super(TestHSWVariant, cls).setUpConstants(cls.VARIANT) @classmethod def setUpClass(cls): - super(TestAVX2Variant, cls).setUpClass() + super(TestHSWVariant, cls).setUpClass() @classmethod def tearDownClass(cls): - super(TestAVX2Variant, cls).tearDownClass() + super(TestHSWVariant, cls).tearDownClass() - @unittest.skipUnless(skipVariant(VARIANT), + @unittest.skipUnless(skipVariant(LINUX_VARIANT), VARIANT + " not a supported variant, skip.") - def test_avx2(self): + def test_hsw(self): self.checkVariant(self.VARIANT) |