* [PATCH 0/3] remove driver-specific logic for AVX builds @ 2025-03-14 17:23 Bruce Richardson 2025-03-14 17:23 ` [PATCH 1/3] build: add generalized AVX handling for drivers Bruce Richardson ` (5 more replies) 0 siblings, 6 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-14 17:23 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson A number of drivers had special optimized AVX2 and AVX512 code paths for performance reasons, and these tended to have copy-pasted logic to build those files. Centralise that logic in the main drivers/meson.build file to avoid duplication. Bruce Richardson (3): build: add generalized AVX handling for drivers net/intel: use common AVX build code drivers/net: build use common AVX handling drivers/meson.build | 30 ++++++++++++++++++++++++++++++ drivers/net/bnxt/meson.build | 10 +--------- drivers/net/enic/meson.build | 10 +--------- drivers/net/intel/i40e/meson.build | 26 ++------------------------ drivers/net/intel/iavf/meson.build | 25 ++----------------------- drivers/net/intel/ice/meson.build | 25 ++----------------------- drivers/net/intel/idpf/meson.build | 25 ++----------------------- drivers/net/nfp/meson.build | 10 +--------- drivers/net/octeon_ep/meson.build | 14 ++------------ drivers/net/virtio/meson.build | 9 +-------- 10 files changed, 44 insertions(+), 140 deletions(-) -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH 1/3] build: add generalized AVX handling for drivers 2025-03-14 17:23 [PATCH 0/3] remove driver-specific logic for AVX builds Bruce Richardson @ 2025-03-14 17:23 ` Bruce Richardson 2025-03-14 17:23 ` [PATCH 2/3] net/intel: use common AVX build code Bruce Richardson ` (4 subsequent siblings) 5 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-14 17:23 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson Add support to the top-level driver build file for AVX2 and AVX512 specific sources. This should simplify driver builds by avoiding the need to constantly reimplement the same build logic Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/meson.build | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/meson.build b/drivers/meson.build index 05391a575d..c42c7764bf 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -126,6 +126,8 @@ foreach subpath:subdirs name = drv annotate_locks = true sources = [] + sources_avx2 = [] + sources_avx512 = [] headers = [] driver_sdk_headers = [] # public headers included by drivers objs = [] @@ -235,6 +237,34 @@ foreach subpath:subdirs dpdk_includes += include_directories(drv_path) endif + # handle avx2 and avx512 source files + if arch_subdir == 'x86' + if sources_avx2.length() > 0 + avx2_lib = static_library(lib_name + '_avx2_lib', + sources_avx2, + dependencies: static_deps, + include_directories: includes, + c_args: [cflags, cc_avx2_flags]) + objs += avx2_lib.extract_objects(sources_avx2) + endif + if sources_avx512.length() > 0 + cflags += '-DCC_AVX512_SUPPORT' + avx512_args = [cflags, cc_avx512_flags] + if cc.has_argument('-march=skylake-avx512') + avx512_args += '-march=skylake-avx512' + if cc.has_argument('-Wno-overriding-option') + avx512_args += '-Wno-overriding-option' + endif + endif + avx512_lib = static_library(lib_name + '_avx512_lib', + sources_avx512, + dependencies: static_deps, + include_directories: includes, + c_args: avx512_args) + objs += avx512_lib.extract_objects(sources_avx512) + endif + endif + # generate pmdinfo sources by building a temporary # lib and then running pmdinfogen on the contents of # that lib. The final lib reuses the object files and -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH 2/3] net/intel: use common AVX build code 2025-03-14 17:23 [PATCH 0/3] remove driver-specific logic for AVX builds Bruce Richardson 2025-03-14 17:23 ` [PATCH 1/3] build: add generalized AVX handling for drivers Bruce Richardson @ 2025-03-14 17:23 ` Bruce Richardson 2025-03-14 17:23 ` [PATCH 3/3] drivers/net: build use common AVX handling Bruce Richardson ` (3 subsequent siblings) 5 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-14 17:23 UTC (permalink / raw) To: dev Cc: david.marchand, Bruce Richardson, Ian Stokes, Vladimir Medvedkin, Anatoly Burakov, Jingjing Wu, Praveen Shetty Remove driver-specific build instructions for the AVX2 and AVX-512 code, and rely instead on the generic driver build file. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/net/intel/i40e/meson.build | 26 ++------------------------ drivers/net/intel/iavf/meson.build | 25 ++----------------------- drivers/net/intel/ice/meson.build | 25 ++----------------------- drivers/net/intel/idpf/meson.build | 25 ++----------------------- 4 files changed, 8 insertions(+), 93 deletions(-) diff --git a/drivers/net/intel/i40e/meson.build b/drivers/net/intel/i40e/meson.build index 2973ed1a01..25a3d72714 100644 --- a/drivers/net/intel/i40e/meson.build +++ b/drivers/net/intel/i40e/meson.build @@ -40,35 +40,13 @@ includes += include_directories('base') if arch_subdir == 'x86' sources += files('i40e_rxtx_vec_sse.c') + sources_avx2 = files('i40e_rxtx_vec_avx2.c') + sources_avx512 = files('i40e_rxtx_vec_avx512.c') if is_windows and cc.get_id() != 'clang' cflags += ['-fno-asynchronous-unwind-tables'] endif - i40e_avx2_lib = static_library('i40e_avx2_lib', - 'i40e_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += i40e_avx2_lib.extract_objects('i40e_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - i40e_avx512_lib = static_library('i40e_avx512_lib', - 'i40e_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev, - static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: avx512_args) - objs += i40e_avx512_lib.extract_objects('i40e_rxtx_vec_avx512.c') - endif elif arch_subdir == 'ppc' sources += files('i40e_rxtx_vec_altivec.c') elif arch_subdir == 'arm' diff --git a/drivers/net/intel/iavf/meson.build b/drivers/net/intel/iavf/meson.build index f7eac7c57a..fc3e4d2f28 100644 --- a/drivers/net/intel/iavf/meson.build +++ b/drivers/net/intel/iavf/meson.build @@ -28,34 +28,13 @@ includes += include_directories('base') if arch_subdir == 'x86' sources += files('iavf_rxtx_vec_sse.c') + sources_avx2 = files('iavf_rxtx_vec_avx2.c') + sources_avx512 = files('iavf_rxtx_vec_avx512.c') if is_windows and cc.get_id() != 'clang' cflags += ['-fno-asynchronous-unwind-tables'] endif - iavf_avx2_lib = static_library('iavf_avx2_lib', - 'iavf_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += iavf_avx2_lib.extract_objects('iavf_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - iavf_avx512_lib = static_library('iavf_avx512_lib', - 'iavf_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev], - include_directories: includes, - c_args: avx512_args) - objs += iavf_avx512_lib.extract_objects('iavf_rxtx_vec_avx512.c') - endif elif arch_subdir == 'arm' sources += files('iavf_rxtx_vec_neon.c') endif diff --git a/drivers/net/intel/ice/meson.build b/drivers/net/intel/ice/meson.build index cbdf38c1c4..a33ec59272 100644 --- a/drivers/net/intel/ice/meson.build +++ b/drivers/net/intel/ice/meson.build @@ -34,34 +34,13 @@ endif if arch_subdir == 'x86' sources += files('ice_rxtx_vec_sse.c') + sources_avx2 = files('ice_rxtx_vec_avx2.c') + sources_avx512 = files('ice_rxtx_vec_avx512.c') if is_windows and cc.get_id() != 'clang' cflags += ['-fno-asynchronous-unwind-tables'] endif - ice_avx2_lib = static_library('ice_avx2_lib', - 'ice_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += ice_avx2_lib.extract_objects('ice_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - ice_avx512_lib = static_library('ice_avx512_lib', - 'ice_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: avx512_args) - objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') - endif endif sources += files( diff --git a/drivers/net/intel/idpf/meson.build b/drivers/net/intel/idpf/meson.build index 4b272d02b1..10465f0f36 100644 --- a/drivers/net/intel/idpf/meson.build +++ b/drivers/net/intel/idpf/meson.build @@ -19,29 +19,8 @@ sources = files( ) if arch_subdir == 'x86' and dpdk_conf.get('RTE_IOVA_IN_MBUF') == 1 - idpf_avx2_lib = static_library('idpf_avx2_lib', - 'idpf_common_rxtx_avx2.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += idpf_avx2_lib.extract_objects('idpf_common_rxtx_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - idpf_common_avx512_lib = static_library('idpf_common_avx512_lib', - 'idpf_common_rxtx_avx512.c', - dependencies: static_rte_mbuf, - include_directories: includes, - c_args: avx512_args) - objs += idpf_common_avx512_lib.extract_objects('idpf_common_rxtx_avx512.c') - endif + sources_avx2 = files('idpf_common_rxtx_avx2.c') + sources_avx512 = files('idpf_common_rxtx_avx512.c') endif subdir('base') -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH 3/3] drivers/net: build use common AVX handling 2025-03-14 17:23 [PATCH 0/3] remove driver-specific logic for AVX builds Bruce Richardson 2025-03-14 17:23 ` [PATCH 1/3] build: add generalized AVX handling for drivers Bruce Richardson 2025-03-14 17:23 ` [PATCH 2/3] net/intel: use common AVX build code Bruce Richardson @ 2025-03-14 17:23 ` Bruce Richardson 2025-03-14 17:31 ` David Marchand 2025-03-14 17:44 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds Bruce Richardson ` (2 subsequent siblings) 5 siblings, 1 reply; 48+ messages in thread From: Bruce Richardson @ 2025-03-14 17:23 UTC (permalink / raw) To: dev Cc: david.marchand, Bruce Richardson, Ajit Khaparde, Somnath Kotur, John Daley, Hyong Youb Kim, Chaoyong He, Vamsi Attunuru, Maxime Coquelin, Chenbo Xia Remove from remaining net drivers the special-case code to handle AVX2 or AVX512 specific files. These can be built instead using drivers/meson.build. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/net/bnxt/meson.build | 10 +--------- drivers/net/enic/meson.build | 10 +--------- drivers/net/nfp/meson.build | 10 +--------- drivers/net/octeon_ep/meson.build | 14 ++------------ drivers/net/virtio/meson.build | 9 +-------- 5 files changed, 6 insertions(+), 47 deletions(-) diff --git a/drivers/net/bnxt/meson.build b/drivers/net/bnxt/meson.build index fd82d0c409..dcca7df916 100644 --- a/drivers/net/bnxt/meson.build +++ b/drivers/net/bnxt/meson.build @@ -58,15 +58,7 @@ subdir('hcapi/cfa_v3') if arch_subdir == 'x86' sources += files('bnxt_rxtx_vec_sse.c') - # build AVX2 code with instruction set explicitly enabled for runtime selection - bnxt_avx2_lib = static_library('bnxt_avx2_lib', - 'bnxt_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, - static_rte_bus_pci, - static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += bnxt_avx2_lib.extract_objects('bnxt_rxtx_vec_avx2.c') + sources_avx2 = files('bnxt_rxtx_vec_avx2.c') elif arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64') sources += files('bnxt_rxtx_vec_neon.c') endif diff --git a/drivers/net/enic/meson.build b/drivers/net/enic/meson.build index cfe5ec170a..2b3052fae8 100644 --- a/drivers/net/enic/meson.build +++ b/drivers/net/enic/meson.build @@ -29,17 +29,9 @@ sources = files( deps += ['hash'] includes += include_directories('base') -# Build the avx2 handler for 64-bit X86 targets, even though 'machine' -# may not. This is to support users who build for the min supported machine -# and need to run the binary on newer CPUs too. if dpdk_conf.has('RTE_ARCH_X86_64') cflags += '-DENIC_RXTX_VEC' - enic_avx2_lib = static_library('enic_avx2_lib', - 'enic_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += enic_avx2_lib.extract_objects('enic_rxtx_vec_avx2.c') + sources_avx2 = files('enic_rxtx_vec_avx2.c') endif annotate_locks = false diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build index 0a12b7dce7..a98b584042 100644 --- a/drivers/net/nfp/meson.build +++ b/drivers/net/nfp/meson.build @@ -52,19 +52,11 @@ cflags += no_wvla_cflag if arch_subdir == 'x86' includes += include_directories('../../common/nfp') - avx2_sources = files( + sources_avx2 = files( 'nfdk/nfp_nfdk_vec_avx2_dp.c', 'nfp_rxtx_vec_avx2.c', ) - nfp_avx2_lib = static_library('nfp_avx2_lib', - avx2_sources, - dependencies: [static_rte_ethdev, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags] - ) - - objs += nfp_avx2_lib.extract_all_objects(recursive: true) else sources += files( 'nfp_rxtx_vec_stub.c', diff --git a/drivers/net/octeon_ep/meson.build b/drivers/net/octeon_ep/meson.build index 1b34db3edc..9bf4627894 100644 --- a/drivers/net/octeon_ep/meson.build +++ b/drivers/net/octeon_ep/meson.build @@ -15,18 +15,8 @@ sources = files( if arch_subdir == 'x86' sources += files('cnxk_ep_rx_sse.c') - if cc.get_define('__AVX2__', args: machine_args) != '' - cflags += ['-DCC_AVX2_SUPPORT'] - sources += files('cnxk_ep_rx_avx.c') - elif cc.has_multi_arguments(cc_avx2_flags) - cflags += ['-DCC_AVX2_SUPPORT'] - otx_ep_avx2_lib = static_library('otx_ep_avx2_lib', - 'cnxk_ep_rx_avx.c', - dependencies: [static_rte_ethdev, static_rte_pci, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += otx_ep_avx2_lib.extract_objects('cnxk_ep_rx_avx.c') - endif + cflags += ['-DCC_AVX2_SUPPORT'] + sources_avx2 = files('cnxk_ep_rx_avx.c') endif if arch_subdir == 'arm' diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build index c1c4a85bea..01bfb3c47d 100644 --- a/drivers/net/virtio/meson.build +++ b/drivers/net/virtio/meson.build @@ -27,15 +27,8 @@ cflags += no_wvla_cflag if arch_subdir == 'x86' if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] cflags += ['-DVIRTIO_RXTX_PACKED_VEC'] - virtio_avx512_lib = static_library('virtio_avx512_lib', - 'virtio_rxtx_packed.c', - dependencies: [static_rte_ethdev, - static_rte_kvargs, static_rte_bus_pci], - include_directories: includes, - c_args: cflags + cc_avx512_flags) - objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed.c') + sources_avx512 = files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH 3/3] drivers/net: build use common AVX handling 2025-03-14 17:23 ` [PATCH 3/3] drivers/net: build use common AVX handling Bruce Richardson @ 2025-03-14 17:31 ` David Marchand 2025-03-14 17:37 ` Bruce Richardson 0 siblings, 1 reply; 48+ messages in thread From: David Marchand @ 2025-03-14 17:31 UTC (permalink / raw) To: Bruce Richardson Cc: dev, Ajit Khaparde, Somnath Kotur, John Daley, Hyong Youb Kim, Chaoyong He, Vamsi Attunuru, Maxime Coquelin, Chenbo Xia On Fri, Mar 14, 2025 at 6:24 PM Bruce Richardson <bruce.richardson@intel.com> wrote: > diff --git a/drivers/net/octeon_ep/meson.build b/drivers/net/octeon_ep/meson.build > index 1b34db3edc..9bf4627894 100644 > --- a/drivers/net/octeon_ep/meson.build > +++ b/drivers/net/octeon_ep/meson.build > @@ -15,18 +15,8 @@ sources = files( > > if arch_subdir == 'x86' > sources += files('cnxk_ep_rx_sse.c') > - if cc.get_define('__AVX2__', args: machine_args) != '' > - cflags += ['-DCC_AVX2_SUPPORT'] > - sources += files('cnxk_ep_rx_avx.c') > - elif cc.has_multi_arguments(cc_avx2_flags) > - cflags += ['-DCC_AVX2_SUPPORT'] > - otx_ep_avx2_lib = static_library('otx_ep_avx2_lib', > - 'cnxk_ep_rx_avx.c', > - dependencies: [static_rte_ethdev, static_rte_pci, static_rte_bus_pci], > - include_directories: includes, > - c_args: [cflags, cc_avx2_flags]) > - objs += otx_ep_avx2_lib.extract_objects('cnxk_ep_rx_avx.c') > - endif > + cflags += ['-DCC_AVX2_SUPPORT'] Could it be set by drivers/meson.build? Similarly to AVX512. > + sources_avx2 = files('cnxk_ep_rx_avx.c') > endif > > if arch_subdir == 'arm' -- David Marchand ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH 3/3] drivers/net: build use common AVX handling 2025-03-14 17:31 ` David Marchand @ 2025-03-14 17:37 ` Bruce Richardson 0 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-14 17:37 UTC (permalink / raw) To: David Marchand Cc: dev, Ajit Khaparde, Somnath Kotur, John Daley, Hyong Youb Kim, Chaoyong He, Vamsi Attunuru, Maxime Coquelin, Chenbo Xia On Fri, Mar 14, 2025 at 06:31:08PM +0100, David Marchand wrote: > On Fri, Mar 14, 2025 at 6:24 PM Bruce Richardson > <bruce.richardson@intel.com> wrote: > > diff --git a/drivers/net/octeon_ep/meson.build b/drivers/net/octeon_ep/meson.build > > index 1b34db3edc..9bf4627894 100644 > > --- a/drivers/net/octeon_ep/meson.build > > +++ b/drivers/net/octeon_ep/meson.build > > @@ -15,18 +15,8 @@ sources = files( > > > > if arch_subdir == 'x86' > > sources += files('cnxk_ep_rx_sse.c') > > - if cc.get_define('__AVX2__', args: machine_args) != '' > > - cflags += ['-DCC_AVX2_SUPPORT'] > > - sources += files('cnxk_ep_rx_avx.c') > > - elif cc.has_multi_arguments(cc_avx2_flags) > > - cflags += ['-DCC_AVX2_SUPPORT'] > > - otx_ep_avx2_lib = static_library('otx_ep_avx2_lib', > > - 'cnxk_ep_rx_avx.c', > > - dependencies: [static_rte_ethdev, static_rte_pci, static_rte_bus_pci], > > - include_directories: includes, > > - c_args: [cflags, cc_avx2_flags]) > > - objs += otx_ep_avx2_lib.extract_objects('cnxk_ep_rx_avx.c') > > - endif > > + cflags += ['-DCC_AVX2_SUPPORT'] > > Could it be set by drivers/meson.build? > Similarly to AVX512. > Yes, but really I'd rather see it removed. It's now the same as the defines for x86, since we always build AVX2 support when building for x86, because all compilers we support can generate AVX2 code. /Bruce ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v2 0/4] remove driver-specific logic for AVX builds 2025-03-14 17:23 [PATCH 0/3] remove driver-specific logic for AVX builds Bruce Richardson ` (2 preceding siblings ...) 2025-03-14 17:23 ` [PATCH 3/3] drivers/net: build use common AVX handling Bruce Richardson @ 2025-03-14 17:44 ` Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 1/4] build: add generalized AVX handling for drivers Bruce Richardson ` (4 more replies) 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson 5 siblings, 5 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-14 17:44 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson A number of drivers had special optimized AVX2 and AVX512 code paths for performance reasons, and these tended to have copy-pasted logic to build those files. Centralise that logic in the main drivers/meson.build file to avoid duplication. v2: add patch 4 to remove use of unnecessary CC_AVX2_SUPPORT flag Bruce Richardson (4): build: add generalized AVX handling for drivers net/intel: use common AVX build code drivers/net: build use common AVX handling drivers/net: remove AVX2 build-time define drivers/meson.build | 30 +++++++++++++++++++++++++++ drivers/net/bnxt/bnxt_ethdev.c | 2 -- drivers/net/bnxt/meson.build | 10 +-------- drivers/net/enic/meson.build | 10 +-------- drivers/net/intel/i40e/meson.build | 26 ++--------------------- drivers/net/intel/iavf/meson.build | 25 ++-------------------- drivers/net/intel/ice/meson.build | 25 ++-------------------- drivers/net/intel/idpf/meson.build | 25 ++-------------------- drivers/net/nfp/meson.build | 10 +-------- drivers/net/octeon_ep/meson.build | 13 +----------- drivers/net/octeon_ep/otx_ep_ethdev.c | 4 ---- drivers/net/virtio/meson.build | 9 +------- 12 files changed, 43 insertions(+), 146 deletions(-) -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v2 1/4] build: add generalized AVX handling for drivers 2025-03-14 17:44 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds Bruce Richardson @ 2025-03-14 17:44 ` Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 2/4] net/intel: use common AVX build code Bruce Richardson ` (3 subsequent siblings) 4 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-14 17:44 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson Add support to the top-level driver build file for AVX2 and AVX512 specific sources. This should simplify driver builds by avoiding the need to constantly reimplement the same build logic Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/meson.build | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/meson.build b/drivers/meson.build index 05391a575d..c42c7764bf 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -126,6 +126,8 @@ foreach subpath:subdirs name = drv annotate_locks = true sources = [] + sources_avx2 = [] + sources_avx512 = [] headers = [] driver_sdk_headers = [] # public headers included by drivers objs = [] @@ -235,6 +237,34 @@ foreach subpath:subdirs dpdk_includes += include_directories(drv_path) endif + # handle avx2 and avx512 source files + if arch_subdir == 'x86' + if sources_avx2.length() > 0 + avx2_lib = static_library(lib_name + '_avx2_lib', + sources_avx2, + dependencies: static_deps, + include_directories: includes, + c_args: [cflags, cc_avx2_flags]) + objs += avx2_lib.extract_objects(sources_avx2) + endif + if sources_avx512.length() > 0 + cflags += '-DCC_AVX512_SUPPORT' + avx512_args = [cflags, cc_avx512_flags] + if cc.has_argument('-march=skylake-avx512') + avx512_args += '-march=skylake-avx512' + if cc.has_argument('-Wno-overriding-option') + avx512_args += '-Wno-overriding-option' + endif + endif + avx512_lib = static_library(lib_name + '_avx512_lib', + sources_avx512, + dependencies: static_deps, + include_directories: includes, + c_args: avx512_args) + objs += avx512_lib.extract_objects(sources_avx512) + endif + endif + # generate pmdinfo sources by building a temporary # lib and then running pmdinfogen on the contents of # that lib. The final lib reuses the object files and -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v2 2/4] net/intel: use common AVX build code 2025-03-14 17:44 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 1/4] build: add generalized AVX handling for drivers Bruce Richardson @ 2025-03-14 17:44 ` Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 3/4] drivers/net: build use common AVX handling Bruce Richardson ` (2 subsequent siblings) 4 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-14 17:44 UTC (permalink / raw) To: dev Cc: david.marchand, Bruce Richardson, Ian Stokes, Vladimir Medvedkin, Anatoly Burakov, Jingjing Wu, Praveen Shetty Remove driver-specific build instructions for the AVX2 and AVX-512 code, and rely instead on the generic driver build file. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/net/intel/i40e/meson.build | 26 ++------------------------ drivers/net/intel/iavf/meson.build | 25 ++----------------------- drivers/net/intel/ice/meson.build | 25 ++----------------------- drivers/net/intel/idpf/meson.build | 25 ++----------------------- 4 files changed, 8 insertions(+), 93 deletions(-) diff --git a/drivers/net/intel/i40e/meson.build b/drivers/net/intel/i40e/meson.build index 2973ed1a01..25a3d72714 100644 --- a/drivers/net/intel/i40e/meson.build +++ b/drivers/net/intel/i40e/meson.build @@ -40,35 +40,13 @@ includes += include_directories('base') if arch_subdir == 'x86' sources += files('i40e_rxtx_vec_sse.c') + sources_avx2 = files('i40e_rxtx_vec_avx2.c') + sources_avx512 = files('i40e_rxtx_vec_avx512.c') if is_windows and cc.get_id() != 'clang' cflags += ['-fno-asynchronous-unwind-tables'] endif - i40e_avx2_lib = static_library('i40e_avx2_lib', - 'i40e_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += i40e_avx2_lib.extract_objects('i40e_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - i40e_avx512_lib = static_library('i40e_avx512_lib', - 'i40e_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev, - static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: avx512_args) - objs += i40e_avx512_lib.extract_objects('i40e_rxtx_vec_avx512.c') - endif elif arch_subdir == 'ppc' sources += files('i40e_rxtx_vec_altivec.c') elif arch_subdir == 'arm' diff --git a/drivers/net/intel/iavf/meson.build b/drivers/net/intel/iavf/meson.build index f7eac7c57a..fc3e4d2f28 100644 --- a/drivers/net/intel/iavf/meson.build +++ b/drivers/net/intel/iavf/meson.build @@ -28,34 +28,13 @@ includes += include_directories('base') if arch_subdir == 'x86' sources += files('iavf_rxtx_vec_sse.c') + sources_avx2 = files('iavf_rxtx_vec_avx2.c') + sources_avx512 = files('iavf_rxtx_vec_avx512.c') if is_windows and cc.get_id() != 'clang' cflags += ['-fno-asynchronous-unwind-tables'] endif - iavf_avx2_lib = static_library('iavf_avx2_lib', - 'iavf_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += iavf_avx2_lib.extract_objects('iavf_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - iavf_avx512_lib = static_library('iavf_avx512_lib', - 'iavf_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev], - include_directories: includes, - c_args: avx512_args) - objs += iavf_avx512_lib.extract_objects('iavf_rxtx_vec_avx512.c') - endif elif arch_subdir == 'arm' sources += files('iavf_rxtx_vec_neon.c') endif diff --git a/drivers/net/intel/ice/meson.build b/drivers/net/intel/ice/meson.build index cbdf38c1c4..a33ec59272 100644 --- a/drivers/net/intel/ice/meson.build +++ b/drivers/net/intel/ice/meson.build @@ -34,34 +34,13 @@ endif if arch_subdir == 'x86' sources += files('ice_rxtx_vec_sse.c') + sources_avx2 = files('ice_rxtx_vec_avx2.c') + sources_avx512 = files('ice_rxtx_vec_avx512.c') if is_windows and cc.get_id() != 'clang' cflags += ['-fno-asynchronous-unwind-tables'] endif - ice_avx2_lib = static_library('ice_avx2_lib', - 'ice_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += ice_avx2_lib.extract_objects('ice_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - ice_avx512_lib = static_library('ice_avx512_lib', - 'ice_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: avx512_args) - objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') - endif endif sources += files( diff --git a/drivers/net/intel/idpf/meson.build b/drivers/net/intel/idpf/meson.build index 4b272d02b1..10465f0f36 100644 --- a/drivers/net/intel/idpf/meson.build +++ b/drivers/net/intel/idpf/meson.build @@ -19,29 +19,8 @@ sources = files( ) if arch_subdir == 'x86' and dpdk_conf.get('RTE_IOVA_IN_MBUF') == 1 - idpf_avx2_lib = static_library('idpf_avx2_lib', - 'idpf_common_rxtx_avx2.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += idpf_avx2_lib.extract_objects('idpf_common_rxtx_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - idpf_common_avx512_lib = static_library('idpf_common_avx512_lib', - 'idpf_common_rxtx_avx512.c', - dependencies: static_rte_mbuf, - include_directories: includes, - c_args: avx512_args) - objs += idpf_common_avx512_lib.extract_objects('idpf_common_rxtx_avx512.c') - endif + sources_avx2 = files('idpf_common_rxtx_avx2.c') + sources_avx512 = files('idpf_common_rxtx_avx512.c') endif subdir('base') -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v2 3/4] drivers/net: build use common AVX handling 2025-03-14 17:44 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 1/4] build: add generalized AVX handling for drivers Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 2/4] net/intel: use common AVX build code Bruce Richardson @ 2025-03-14 17:44 ` Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 4/4] drivers/net: remove AVX2 build-time define Bruce Richardson 2025-03-17 9:50 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds David Marchand 4 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-14 17:44 UTC (permalink / raw) To: dev Cc: david.marchand, Bruce Richardson, Ajit Khaparde, Somnath Kotur, John Daley, Hyong Youb Kim, Chaoyong He, Vamsi Attunuru, Maxime Coquelin, Chenbo Xia Remove from remaining net drivers the special-case code to handle AVX2 or AVX512 specific files. These can be built instead using drivers/meson.build. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/net/bnxt/meson.build | 10 +--------- drivers/net/enic/meson.build | 10 +--------- drivers/net/nfp/meson.build | 10 +--------- drivers/net/octeon_ep/meson.build | 14 ++------------ drivers/net/virtio/meson.build | 9 +-------- 5 files changed, 6 insertions(+), 47 deletions(-) diff --git a/drivers/net/bnxt/meson.build b/drivers/net/bnxt/meson.build index fd82d0c409..dcca7df916 100644 --- a/drivers/net/bnxt/meson.build +++ b/drivers/net/bnxt/meson.build @@ -58,15 +58,7 @@ subdir('hcapi/cfa_v3') if arch_subdir == 'x86' sources += files('bnxt_rxtx_vec_sse.c') - # build AVX2 code with instruction set explicitly enabled for runtime selection - bnxt_avx2_lib = static_library('bnxt_avx2_lib', - 'bnxt_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, - static_rte_bus_pci, - static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += bnxt_avx2_lib.extract_objects('bnxt_rxtx_vec_avx2.c') + sources_avx2 = files('bnxt_rxtx_vec_avx2.c') elif arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64') sources += files('bnxt_rxtx_vec_neon.c') endif diff --git a/drivers/net/enic/meson.build b/drivers/net/enic/meson.build index cfe5ec170a..2b3052fae8 100644 --- a/drivers/net/enic/meson.build +++ b/drivers/net/enic/meson.build @@ -29,17 +29,9 @@ sources = files( deps += ['hash'] includes += include_directories('base') -# Build the avx2 handler for 64-bit X86 targets, even though 'machine' -# may not. This is to support users who build for the min supported machine -# and need to run the binary on newer CPUs too. if dpdk_conf.has('RTE_ARCH_X86_64') cflags += '-DENIC_RXTX_VEC' - enic_avx2_lib = static_library('enic_avx2_lib', - 'enic_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += enic_avx2_lib.extract_objects('enic_rxtx_vec_avx2.c') + sources_avx2 = files('enic_rxtx_vec_avx2.c') endif annotate_locks = false diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build index 0a12b7dce7..a98b584042 100644 --- a/drivers/net/nfp/meson.build +++ b/drivers/net/nfp/meson.build @@ -52,19 +52,11 @@ cflags += no_wvla_cflag if arch_subdir == 'x86' includes += include_directories('../../common/nfp') - avx2_sources = files( + sources_avx2 = files( 'nfdk/nfp_nfdk_vec_avx2_dp.c', 'nfp_rxtx_vec_avx2.c', ) - nfp_avx2_lib = static_library('nfp_avx2_lib', - avx2_sources, - dependencies: [static_rte_ethdev, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags] - ) - - objs += nfp_avx2_lib.extract_all_objects(recursive: true) else sources += files( 'nfp_rxtx_vec_stub.c', diff --git a/drivers/net/octeon_ep/meson.build b/drivers/net/octeon_ep/meson.build index 1b34db3edc..9bf4627894 100644 --- a/drivers/net/octeon_ep/meson.build +++ b/drivers/net/octeon_ep/meson.build @@ -15,18 +15,8 @@ sources = files( if arch_subdir == 'x86' sources += files('cnxk_ep_rx_sse.c') - if cc.get_define('__AVX2__', args: machine_args) != '' - cflags += ['-DCC_AVX2_SUPPORT'] - sources += files('cnxk_ep_rx_avx.c') - elif cc.has_multi_arguments(cc_avx2_flags) - cflags += ['-DCC_AVX2_SUPPORT'] - otx_ep_avx2_lib = static_library('otx_ep_avx2_lib', - 'cnxk_ep_rx_avx.c', - dependencies: [static_rte_ethdev, static_rte_pci, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += otx_ep_avx2_lib.extract_objects('cnxk_ep_rx_avx.c') - endif + cflags += ['-DCC_AVX2_SUPPORT'] + sources_avx2 = files('cnxk_ep_rx_avx.c') endif if arch_subdir == 'arm' diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build index c1c4a85bea..01bfb3c47d 100644 --- a/drivers/net/virtio/meson.build +++ b/drivers/net/virtio/meson.build @@ -27,15 +27,8 @@ cflags += no_wvla_cflag if arch_subdir == 'x86' if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] cflags += ['-DVIRTIO_RXTX_PACKED_VEC'] - virtio_avx512_lib = static_library('virtio_avx512_lib', - 'virtio_rxtx_packed.c', - dependencies: [static_rte_ethdev, - static_rte_kvargs, static_rte_bus_pci], - include_directories: includes, - c_args: cflags + cc_avx512_flags) - objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed.c') + sources_avx512 = files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v2 4/4] drivers/net: remove AVX2 build-time define 2025-03-14 17:44 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds Bruce Richardson ` (2 preceding siblings ...) 2025-03-14 17:44 ` [PATCH v2 3/4] drivers/net: build use common AVX handling Bruce Richardson @ 2025-03-14 17:44 ` Bruce Richardson 2025-03-17 9:47 ` David Marchand 2025-03-17 9:50 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds David Marchand 4 siblings, 1 reply; 48+ messages in thread From: Bruce Richardson @ 2025-03-14 17:44 UTC (permalink / raw) To: dev Cc: david.marchand, Bruce Richardson, Ajit Khaparde, Somnath Kotur, Vamsi Attunuru Since all supported compilers can generate AVX2 code, we will always enable the build of the AVX2 files on x86. This means that CC_AVX2_SUPPORT is always true on x86, so it can be removed and a regular "#ifdef RTE_ARCH_x86" used in its place. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/net/bnxt/bnxt_ethdev.c | 2 -- drivers/net/octeon_ep/meson.build | 1 - drivers/net/octeon_ep/otx_ep_ethdev.c | 4 ---- 3 files changed, 7 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 144d4377bd..a318604c20 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -3238,8 +3238,6 @@ static const struct { #if defined(RTE_ARCH_X86) {bnxt_crx_pkts_vec, "Vector SSE"}, {bnxt_recv_pkts_vec, "Vector SSE"}, -#endif -#if defined(RTE_ARCH_X86) && defined(CC_AVX2_SUPPORT) {bnxt_crx_pkts_vec_avx2, "Vector AVX2"}, {bnxt_recv_pkts_vec_avx2, "Vector AVX2"}, #endif diff --git a/drivers/net/octeon_ep/meson.build b/drivers/net/octeon_ep/meson.build index 9bf4627894..a4a7663d1d 100644 --- a/drivers/net/octeon_ep/meson.build +++ b/drivers/net/octeon_ep/meson.build @@ -15,7 +15,6 @@ sources = files( if arch_subdir == 'x86' sources += files('cnxk_ep_rx_sse.c') - cflags += ['-DCC_AVX2_SUPPORT'] sources_avx2 = files('cnxk_ep_rx_avx.c') endif diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c index 8b14734b0c..10f2f8a2e0 100644 --- a/drivers/net/octeon_ep/otx_ep_ethdev.c +++ b/drivers/net/octeon_ep/otx_ep_ethdev.c @@ -91,11 +91,9 @@ otx_ep_set_rx_func(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts; #ifdef RTE_ARCH_X86 eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_sse; -#ifdef CC_AVX2_SUPPORT if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256 && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1) eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_avx; -#endif #elif defined(RTE_ARCH_ARM64) eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_neon; #endif @@ -105,11 +103,9 @@ otx_ep_set_rx_func(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts; #ifdef RTE_ARCH_X86 eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_sse; -#ifdef CC_AVX2_SUPPORT if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256 && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1) eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_avx; -#endif #elif defined(RTE_ARCH_ARM64) eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_neon; #endif -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v2 4/4] drivers/net: remove AVX2 build-time define 2025-03-14 17:44 ` [PATCH v2 4/4] drivers/net: remove AVX2 build-time define Bruce Richardson @ 2025-03-17 9:47 ` David Marchand 0 siblings, 0 replies; 48+ messages in thread From: David Marchand @ 2025-03-17 9:47 UTC (permalink / raw) To: Bruce Richardson; +Cc: dev, Ajit Khaparde, Somnath Kotur, Vamsi Attunuru On Fri, Mar 14, 2025 at 6:44 PM Bruce Richardson <bruce.richardson@intel.com> wrote: > > Since all supported compilers can generate AVX2 code, we will always > enable the build of the AVX2 files on x86. This means that > CC_AVX2_SUPPORT is always true on x86, so it can be removed and a > regular "#ifdef RTE_ARCH_x86" used in its place. > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> > --- > drivers/net/bnxt/bnxt_ethdev.c | 2 -- > drivers/net/octeon_ep/meson.build | 1 - > drivers/net/octeon_ep/otx_ep_ethdev.c | 4 ---- > 3 files changed, 7 deletions(-) > > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c > index 144d4377bd..a318604c20 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -3238,8 +3238,6 @@ static const struct { > #if defined(RTE_ARCH_X86) > {bnxt_crx_pkts_vec, "Vector SSE"}, > {bnxt_recv_pkts_vec, "Vector SSE"}, > -#endif > -#if defined(RTE_ARCH_X86) && defined(CC_AVX2_SUPPORT) I was wondering why this was not coming along a meson.build. On the principle, this Fixes: d58c6c077cc2 ("net/bnxt: add AVX2 Rx for compressed CQE") > {bnxt_crx_pkts_vec_avx2, "Vector AVX2"}, > {bnxt_recv_pkts_vec_avx2, "Vector AVX2"}, > #endif -- David Marchand ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v2 0/4] remove driver-specific logic for AVX builds 2025-03-14 17:44 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds Bruce Richardson ` (3 preceding siblings ...) 2025-03-14 17:44 ` [PATCH v2 4/4] drivers/net: remove AVX2 build-time define Bruce Richardson @ 2025-03-17 9:50 ` David Marchand 2025-03-18 11:51 ` Bruce Richardson 4 siblings, 1 reply; 48+ messages in thread From: David Marchand @ 2025-03-17 9:50 UTC (permalink / raw) To: Bruce Richardson; +Cc: dev On Fri, Mar 14, 2025 at 6:44 PM Bruce Richardson <bruce.richardson@intel.com> wrote: > > A number of drivers had special optimized AVX2 and AVX512 code paths > for performance reasons, and these tended to have copy-pasted logic > to build those files. Centralise that logic in the main > drivers/meson.build file to avoid duplication. > > v2: add patch 4 to remove use of unnecessary CC_AVX2_SUPPORT flag > > Bruce Richardson (4): > build: add generalized AVX handling for drivers > net/intel: use common AVX build code > drivers/net: build use common AVX handling > drivers/net: remove AVX2 build-time define > > drivers/meson.build | 30 +++++++++++++++++++++++++++ > drivers/net/bnxt/bnxt_ethdev.c | 2 -- > drivers/net/bnxt/meson.build | 10 +-------- > drivers/net/enic/meson.build | 10 +-------- > drivers/net/intel/i40e/meson.build | 26 ++--------------------- > drivers/net/intel/iavf/meson.build | 25 ++-------------------- > drivers/net/intel/ice/meson.build | 25 ++-------------------- > drivers/net/intel/idpf/meson.build | 25 ++-------------------- > drivers/net/nfp/meson.build | 10 +-------- > drivers/net/octeon_ep/meson.build | 13 +----------- > drivers/net/octeon_ep/otx_ep_ethdev.c | 4 ---- > drivers/net/virtio/meson.build | 9 +------- > 12 files changed, 43 insertions(+), 146 deletions(-) event/dlb2 can be converted too, or is there something special about this driver? As part of the discussion on the base drivers, and seeing this series, it would be cool if we had a generic framework to specify a set of cflags for a set of sources. But at least this series lgtm and is a first step. -- David Marchand ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v2 0/4] remove driver-specific logic for AVX builds 2025-03-17 9:50 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds David Marchand @ 2025-03-18 11:51 ` Bruce Richardson 0 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 11:51 UTC (permalink / raw) To: David Marchand; +Cc: dev On Mon, Mar 17, 2025 at 10:50:24AM +0100, David Marchand wrote: > On Fri, Mar 14, 2025 at 6:44 PM Bruce Richardson > <bruce.richardson@intel.com> wrote: > > > > A number of drivers had special optimized AVX2 and AVX512 code paths > > for performance reasons, and these tended to have copy-pasted logic > > to build those files. Centralise that logic in the main > > drivers/meson.build file to avoid duplication. > > > > v2: add patch 4 to remove use of unnecessary CC_AVX2_SUPPORT flag > > > > Bruce Richardson (4): > > build: add generalized AVX handling for drivers > > net/intel: use common AVX build code > > drivers/net: build use common AVX handling > > drivers/net: remove AVX2 build-time define > > > > drivers/meson.build | 30 +++++++++++++++++++++++++++ > > drivers/net/bnxt/bnxt_ethdev.c | 2 -- > > drivers/net/bnxt/meson.build | 10 +-------- > > drivers/net/enic/meson.build | 10 +-------- > > drivers/net/intel/i40e/meson.build | 26 ++--------------------- > > drivers/net/intel/iavf/meson.build | 25 ++-------------------- > > drivers/net/intel/ice/meson.build | 25 ++-------------------- > > drivers/net/intel/idpf/meson.build | 25 ++-------------------- > > drivers/net/nfp/meson.build | 10 +-------- > > drivers/net/octeon_ep/meson.build | 13 +----------- > > drivers/net/octeon_ep/otx_ep_ethdev.c | 4 ---- > > drivers/net/virtio/meson.build | 9 +------- > > 12 files changed, 43 insertions(+), 146 deletions(-) > > event/dlb2 can be converted too, or is there something special about > this driver? > Ideally, yes, but it's also a bit special in that it only builds *either* the SSE code path or the AVX-512 one, and has duplicate symbols/functions in the two files. This is a bit strange, and probably not what we want, so I may need to do some work on it before converting it to this scheme. > > As part of the discussion on the base drivers, and seeing this series, > it would be cool if we had a generic framework to specify a set of > cflags for a set of sources. I'd rather not have that. Meson doesn't support having per-c-file flags, and I don't think we should resort to massive amounts of hackery to try and support this. I think having the same set of cflags across a whole component is a good principle, one which we should only violate when we have to e.g. for base dirs, and for ISA-specific files. > But at least this series lgtm and is a first step. > Thanks. /Bruce ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 00/11] remove component-specific logic for AVX builds 2025-03-14 17:23 [PATCH 0/3] remove driver-specific logic for AVX builds Bruce Richardson ` (3 preceding siblings ...) 2025-03-14 17:44 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds Bruce Richardson @ 2025-03-18 17:34 ` Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 01/11] build: add generalized AVX handling for drivers Bruce Richardson ` (11 more replies) 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson 5 siblings, 12 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:34 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson A number of libs and drivers had special optimized AVX2 and AVX512 code paths for performance reasons, and these tended to have copy-pasted logic to build those files. Centralise that logic in the main drivers/ and lib/ meson.build files to avoid duplication. v3: add patch for event/dlb2 AVX512 handling. add common code for libraries as well as drivers. v2: add patch 4 to remove use of unnecessary CC_AVX2_SUPPORT flag Bruce Richardson (11): build: add generalized AVX handling for drivers net/intel: use common AVX build code drivers/net: build use common AVX handling drivers/net: remove AVX2 build-time define event/dlb2: build using common AVX handling build: add generalized AVX handling for libs acl: use common AVX build handling fib: use common AVX build handling net: simplify build-time logic for x86 net: use common AVX512 build code member: use common AVX512 build support drivers/event/dlb2/dlb2_sse.c | 4 ++ drivers/event/dlb2/meson.build | 16 +------- drivers/meson.build | 30 ++++++++++++++ drivers/net/bnxt/bnxt_ethdev.c | 2 - drivers/net/bnxt/meson.build | 10 +---- drivers/net/enic/meson.build | 10 +---- drivers/net/intel/i40e/meson.build | 26 +----------- drivers/net/intel/iavf/meson.build | 25 +----------- drivers/net/intel/ice/meson.build | 25 +----------- drivers/net/intel/idpf/meson.build | 25 +----------- drivers/net/nfp/meson.build | 10 +---- drivers/net/octeon_ep/meson.build | 13 +----- drivers/net/octeon_ep/otx_ep_ethdev.c | 4 -- drivers/net/virtio/meson.build | 9 +---- lib/acl/meson.build | 54 ++----------------------- lib/fib/dir24_8.c | 6 +-- lib/fib/meson.build | 18 +-------- lib/fib/trie.c | 6 +-- lib/member/meson.build | 46 ++++----------------- lib/meson.build | 34 +++++++++++++++- lib/net/meson.build | 58 +++------------------------ lib/net/rte_net_crc.c | 16 ++++---- 22 files changed, 114 insertions(+), 333 deletions(-) -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 01/11] build: add generalized AVX handling for drivers 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson @ 2025-03-18 17:34 ` Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 02/11] net/intel: use common AVX build code Bruce Richardson ` (10 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:34 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson Add support to the top-level driver build file for AVX2 and AVX512 specific sources. This should simplify driver builds by avoiding the need to constantly reimplement the same build logic Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/meson.build | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/meson.build b/drivers/meson.build index 05391a575d..45082f9338 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -126,6 +126,8 @@ foreach subpath:subdirs name = drv annotate_locks = true sources = [] + sources_avx2 = [] + sources_avx512 = [] headers = [] driver_sdk_headers = [] # public headers included by drivers objs = [] @@ -235,6 +237,34 @@ foreach subpath:subdirs dpdk_includes += include_directories(drv_path) endif + # handle avx2 and avx512 source files + if arch_subdir == 'x86' + if sources_avx2.length() > 0 + avx2_lib = static_library(lib_name + '_avx2_lib', + sources_avx2, + dependencies: static_deps, + include_directories: includes, + c_args: [cflags, cc_avx2_flags]) + objs += avx2_lib.extract_objects(sources_avx2) + endif + if sources_avx512.length() > 0 and cc_has_avx512 + cflags += '-DCC_AVX512_SUPPORT' + avx512_args = [cflags, cc_avx512_flags] + if cc.has_argument('-march=skylake-avx512') + avx512_args += '-march=skylake-avx512' + if cc.has_argument('-Wno-overriding-option') + avx512_args += '-Wno-overriding-option' + endif + endif + avx512_lib = static_library(lib_name + '_avx512_lib', + sources_avx512, + dependencies: static_deps, + include_directories: includes, + c_args: avx512_args) + objs += avx512_lib.extract_objects(sources_avx512) + endif + endif + # generate pmdinfo sources by building a temporary # lib and then running pmdinfogen on the contents of # that lib. The final lib reuses the object files and -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 02/11] net/intel: use common AVX build code 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 01/11] build: add generalized AVX handling for drivers Bruce Richardson @ 2025-03-18 17:34 ` Bruce Richardson 2025-03-19 10:11 ` David Marchand 2025-03-18 17:34 ` [PATCH v3 03/11] drivers/net: build use common AVX handling Bruce Richardson ` (9 subsequent siblings) 11 siblings, 1 reply; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:34 UTC (permalink / raw) To: dev Cc: david.marchand, Bruce Richardson, Ian Stokes, Vladimir Medvedkin, Anatoly Burakov, Jingjing Wu, Praveen Shetty Remove driver-specific build instructions for the AVX2 and AVX-512 code, and rely instead on the generic driver build file. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/net/intel/i40e/meson.build | 26 ++------------------------ drivers/net/intel/iavf/meson.build | 25 ++----------------------- drivers/net/intel/ice/meson.build | 25 ++----------------------- drivers/net/intel/idpf/meson.build | 25 ++----------------------- 4 files changed, 8 insertions(+), 93 deletions(-) diff --git a/drivers/net/intel/i40e/meson.build b/drivers/net/intel/i40e/meson.build index 2973ed1a01..25a3d72714 100644 --- a/drivers/net/intel/i40e/meson.build +++ b/drivers/net/intel/i40e/meson.build @@ -40,35 +40,13 @@ includes += include_directories('base') if arch_subdir == 'x86' sources += files('i40e_rxtx_vec_sse.c') + sources_avx2 = files('i40e_rxtx_vec_avx2.c') + sources_avx512 = files('i40e_rxtx_vec_avx512.c') if is_windows and cc.get_id() != 'clang' cflags += ['-fno-asynchronous-unwind-tables'] endif - i40e_avx2_lib = static_library('i40e_avx2_lib', - 'i40e_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += i40e_avx2_lib.extract_objects('i40e_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - i40e_avx512_lib = static_library('i40e_avx512_lib', - 'i40e_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev, - static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: avx512_args) - objs += i40e_avx512_lib.extract_objects('i40e_rxtx_vec_avx512.c') - endif elif arch_subdir == 'ppc' sources += files('i40e_rxtx_vec_altivec.c') elif arch_subdir == 'arm' diff --git a/drivers/net/intel/iavf/meson.build b/drivers/net/intel/iavf/meson.build index f7eac7c57a..fc3e4d2f28 100644 --- a/drivers/net/intel/iavf/meson.build +++ b/drivers/net/intel/iavf/meson.build @@ -28,34 +28,13 @@ includes += include_directories('base') if arch_subdir == 'x86' sources += files('iavf_rxtx_vec_sse.c') + sources_avx2 = files('iavf_rxtx_vec_avx2.c') + sources_avx512 = files('iavf_rxtx_vec_avx512.c') if is_windows and cc.get_id() != 'clang' cflags += ['-fno-asynchronous-unwind-tables'] endif - iavf_avx2_lib = static_library('iavf_avx2_lib', - 'iavf_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += iavf_avx2_lib.extract_objects('iavf_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - iavf_avx512_lib = static_library('iavf_avx512_lib', - 'iavf_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev], - include_directories: includes, - c_args: avx512_args) - objs += iavf_avx512_lib.extract_objects('iavf_rxtx_vec_avx512.c') - endif elif arch_subdir == 'arm' sources += files('iavf_rxtx_vec_neon.c') endif diff --git a/drivers/net/intel/ice/meson.build b/drivers/net/intel/ice/meson.build index cbdf38c1c4..a33ec59272 100644 --- a/drivers/net/intel/ice/meson.build +++ b/drivers/net/intel/ice/meson.build @@ -34,34 +34,13 @@ endif if arch_subdir == 'x86' sources += files('ice_rxtx_vec_sse.c') + sources_avx2 = files('ice_rxtx_vec_avx2.c') + sources_avx512 = files('ice_rxtx_vec_avx512.c') if is_windows and cc.get_id() != 'clang' cflags += ['-fno-asynchronous-unwind-tables'] endif - ice_avx2_lib = static_library('ice_avx2_lib', - 'ice_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += ice_avx2_lib.extract_objects('ice_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - ice_avx512_lib = static_library('ice_avx512_lib', - 'ice_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: avx512_args) - objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') - endif endif sources += files( diff --git a/drivers/net/intel/idpf/meson.build b/drivers/net/intel/idpf/meson.build index 4b272d02b1..10465f0f36 100644 --- a/drivers/net/intel/idpf/meson.build +++ b/drivers/net/intel/idpf/meson.build @@ -19,29 +19,8 @@ sources = files( ) if arch_subdir == 'x86' and dpdk_conf.get('RTE_IOVA_IN_MBUF') == 1 - idpf_avx2_lib = static_library('idpf_avx2_lib', - 'idpf_common_rxtx_avx2.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += idpf_avx2_lib.extract_objects('idpf_common_rxtx_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - idpf_common_avx512_lib = static_library('idpf_common_avx512_lib', - 'idpf_common_rxtx_avx512.c', - dependencies: static_rte_mbuf, - include_directories: includes, - c_args: avx512_args) - objs += idpf_common_avx512_lib.extract_objects('idpf_common_rxtx_avx512.c') - endif + sources_avx2 = files('idpf_common_rxtx_avx2.c') + sources_avx512 = files('idpf_common_rxtx_avx512.c') endif subdir('base') -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v3 02/11] net/intel: use common AVX build code 2025-03-18 17:34 ` [PATCH v3 02/11] net/intel: use common AVX build code Bruce Richardson @ 2025-03-19 10:11 ` David Marchand 2025-03-19 11:17 ` Bruce Richardson 0 siblings, 1 reply; 48+ messages in thread From: David Marchand @ 2025-03-19 10:11 UTC (permalink / raw) To: Bruce Richardson Cc: dev, Ian Stokes, Vladimir Medvedkin, Anatoly Burakov, Jingjing Wu, Praveen Shetty On Tue, Mar 18, 2025 at 6:35 PM Bruce Richardson <bruce.richardson@intel.com> wrote: > > Remove driver-specific build instructions for the AVX2 and AVX-512 code, > and rely instead on the generic driver build file. > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> There is a small merge conflict, so a rebase will be needed. Some nits. > --- > drivers/net/intel/i40e/meson.build | 26 ++------------------------ > drivers/net/intel/iavf/meson.build | 25 ++----------------------- > drivers/net/intel/ice/meson.build | 25 ++----------------------- > drivers/net/intel/idpf/meson.build | 25 ++----------------------- > 4 files changed, 8 insertions(+), 93 deletions(-) > > diff --git a/drivers/net/intel/i40e/meson.build b/drivers/net/intel/i40e/meson.build > index 2973ed1a01..25a3d72714 100644 > --- a/drivers/net/intel/i40e/meson.build > +++ b/drivers/net/intel/i40e/meson.build > @@ -40,35 +40,13 @@ includes += include_directories('base') > > if arch_subdir == 'x86' > sources += files('i40e_rxtx_vec_sse.c') > + sources_avx2 = files('i40e_rxtx_vec_avx2.c') > + sources_avx512 = files('i40e_rxtx_vec_avx512.c') I prefer += (which is also used later in this series). > > if is_windows and cc.get_id() != 'clang' > cflags += ['-fno-asynchronous-unwind-tables'] > endif > > - i40e_avx2_lib = static_library('i40e_avx2_lib', > - 'i40e_rxtx_vec_avx2.c', > - dependencies: [static_rte_ethdev, static_rte_kvargs, static_rte_hash], > - include_directories: includes, > - c_args: [cflags, cc_avx2_flags]) > - objs += i40e_avx2_lib.extract_objects('i40e_rxtx_vec_avx2.c') > - > - if cc_has_avx512 > - cflags += ['-DCC_AVX512_SUPPORT'] > - avx512_args = cflags + cc_avx512_flags > - if cc.has_argument('-march=skylake-avx512') > - avx512_args += '-march=skylake-avx512' > - if cc.has_argument('-Wno-overriding-option') > - avx512_args += '-Wno-overriding-option' > - endif > - endif > - i40e_avx512_lib = static_library('i40e_avx512_lib', > - 'i40e_rxtx_vec_avx512.c', > - dependencies: [static_rte_ethdev, > - static_rte_kvargs, static_rte_hash], > - include_directories: includes, > - c_args: avx512_args) > - objs += i40e_avx512_lib.extract_objects('i40e_rxtx_vec_avx512.c') > - endif > elif arch_subdir == 'ppc' Below seems not indented the same as above. > sources += files('i40e_rxtx_vec_altivec.c') > elif arch_subdir == 'arm' -- David Marchand ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v3 02/11] net/intel: use common AVX build code 2025-03-19 10:11 ` David Marchand @ 2025-03-19 11:17 ` Bruce Richardson 0 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 11:17 UTC (permalink / raw) To: David Marchand Cc: dev, Ian Stokes, Vladimir Medvedkin, Anatoly Burakov, Jingjing Wu, Praveen Shetty On Wed, Mar 19, 2025 at 11:11:17AM +0100, David Marchand wrote: > On Tue, Mar 18, 2025 at 6:35 PM Bruce Richardson > <bruce.richardson@intel.com> wrote: > > > > Remove driver-specific build instructions for the AVX2 and AVX-512 code, > > and rely instead on the generic driver build file. > > > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> > > There is a small merge conflict, so a rebase will be needed. > > Some nits. > > > --- > > drivers/net/intel/i40e/meson.build | 26 ++------------------------ > > drivers/net/intel/iavf/meson.build | 25 ++----------------------- > > drivers/net/intel/ice/meson.build | 25 ++----------------------- > > drivers/net/intel/idpf/meson.build | 25 ++----------------------- > > 4 files changed, 8 insertions(+), 93 deletions(-) > > > > diff --git a/drivers/net/intel/i40e/meson.build b/drivers/net/intel/i40e/meson.build > > index 2973ed1a01..25a3d72714 100644 > > --- a/drivers/net/intel/i40e/meson.build > > +++ b/drivers/net/intel/i40e/meson.build > > @@ -40,35 +40,13 @@ includes += include_directories('base') > > > > if arch_subdir == 'x86' > > sources += files('i40e_rxtx_vec_sse.c') > > + sources_avx2 = files('i40e_rxtx_vec_avx2.c') > > + sources_avx512 = files('i40e_rxtx_vec_avx512.c') > > I prefer += (which is also used later in this series). > Ack, will change. > > > > if is_windows and cc.get_id() != 'clang' > > cflags += ['-fno-asynchronous-unwind-tables'] > > endif > > > > - i40e_avx2_lib = static_library('i40e_avx2_lib', > > - 'i40e_rxtx_vec_avx2.c', > > - dependencies: [static_rte_ethdev, static_rte_kvargs, static_rte_hash], > > - include_directories: includes, > > - c_args: [cflags, cc_avx2_flags]) > > - objs += i40e_avx2_lib.extract_objects('i40e_rxtx_vec_avx2.c') > > - > > - if cc_has_avx512 > > - cflags += ['-DCC_AVX512_SUPPORT'] > > - avx512_args = cflags + cc_avx512_flags > > - if cc.has_argument('-march=skylake-avx512') > > - avx512_args += '-march=skylake-avx512' > > - if cc.has_argument('-Wno-overriding-option') > > - avx512_args += '-Wno-overriding-option' > > - endif > > - endif > > - i40e_avx512_lib = static_library('i40e_avx512_lib', > > - 'i40e_rxtx_vec_avx512.c', > > - dependencies: [static_rte_ethdev, > > - static_rte_kvargs, static_rte_hash], > > - include_directories: includes, > > - c_args: avx512_args) > > - objs += i40e_avx512_lib.extract_objects('i40e_rxtx_vec_avx512.c') > > - endif > > elif arch_subdir == 'ppc' > > Below seems not indented the same as above. > Yes, the indentation is incorrect, but since I'm not modifying these lines, I'm not going to do a whitespace adjustment - save polluting the history. /Bruce ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 03/11] drivers/net: build use common AVX handling 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 01/11] build: add generalized AVX handling for drivers Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 02/11] net/intel: use common AVX build code Bruce Richardson @ 2025-03-18 17:34 ` Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 04/11] drivers/net: remove AVX2 build-time define Bruce Richardson ` (8 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:34 UTC (permalink / raw) To: dev Cc: david.marchand, Bruce Richardson, Ajit Khaparde, Somnath Kotur, John Daley, Hyong Youb Kim, Chaoyong He, Vamsi Attunuru, Maxime Coquelin, Chenbo Xia Remove from remaining net drivers the special-case code to handle AVX2 or AVX512 specific files. These can be built instead using drivers/meson.build. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/net/bnxt/meson.build | 10 +--------- drivers/net/enic/meson.build | 10 +--------- drivers/net/nfp/meson.build | 10 +--------- drivers/net/octeon_ep/meson.build | 14 ++------------ drivers/net/virtio/meson.build | 9 +-------- 5 files changed, 6 insertions(+), 47 deletions(-) diff --git a/drivers/net/bnxt/meson.build b/drivers/net/bnxt/meson.build index fd82d0c409..dcca7df916 100644 --- a/drivers/net/bnxt/meson.build +++ b/drivers/net/bnxt/meson.build @@ -58,15 +58,7 @@ subdir('hcapi/cfa_v3') if arch_subdir == 'x86' sources += files('bnxt_rxtx_vec_sse.c') - # build AVX2 code with instruction set explicitly enabled for runtime selection - bnxt_avx2_lib = static_library('bnxt_avx2_lib', - 'bnxt_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, - static_rte_bus_pci, - static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += bnxt_avx2_lib.extract_objects('bnxt_rxtx_vec_avx2.c') + sources_avx2 = files('bnxt_rxtx_vec_avx2.c') elif arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64') sources += files('bnxt_rxtx_vec_neon.c') endif diff --git a/drivers/net/enic/meson.build b/drivers/net/enic/meson.build index cfe5ec170a..2b3052fae8 100644 --- a/drivers/net/enic/meson.build +++ b/drivers/net/enic/meson.build @@ -29,17 +29,9 @@ sources = files( deps += ['hash'] includes += include_directories('base') -# Build the avx2 handler for 64-bit X86 targets, even though 'machine' -# may not. This is to support users who build for the min supported machine -# and need to run the binary on newer CPUs too. if dpdk_conf.has('RTE_ARCH_X86_64') cflags += '-DENIC_RXTX_VEC' - enic_avx2_lib = static_library('enic_avx2_lib', - 'enic_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += enic_avx2_lib.extract_objects('enic_rxtx_vec_avx2.c') + sources_avx2 = files('enic_rxtx_vec_avx2.c') endif annotate_locks = false diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build index 0a12b7dce7..a98b584042 100644 --- a/drivers/net/nfp/meson.build +++ b/drivers/net/nfp/meson.build @@ -52,19 +52,11 @@ cflags += no_wvla_cflag if arch_subdir == 'x86' includes += include_directories('../../common/nfp') - avx2_sources = files( + sources_avx2 = files( 'nfdk/nfp_nfdk_vec_avx2_dp.c', 'nfp_rxtx_vec_avx2.c', ) - nfp_avx2_lib = static_library('nfp_avx2_lib', - avx2_sources, - dependencies: [static_rte_ethdev, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags] - ) - - objs += nfp_avx2_lib.extract_all_objects(recursive: true) else sources += files( 'nfp_rxtx_vec_stub.c', diff --git a/drivers/net/octeon_ep/meson.build b/drivers/net/octeon_ep/meson.build index 1b34db3edc..9bf4627894 100644 --- a/drivers/net/octeon_ep/meson.build +++ b/drivers/net/octeon_ep/meson.build @@ -15,18 +15,8 @@ sources = files( if arch_subdir == 'x86' sources += files('cnxk_ep_rx_sse.c') - if cc.get_define('__AVX2__', args: machine_args) != '' - cflags += ['-DCC_AVX2_SUPPORT'] - sources += files('cnxk_ep_rx_avx.c') - elif cc.has_multi_arguments(cc_avx2_flags) - cflags += ['-DCC_AVX2_SUPPORT'] - otx_ep_avx2_lib = static_library('otx_ep_avx2_lib', - 'cnxk_ep_rx_avx.c', - dependencies: [static_rte_ethdev, static_rte_pci, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += otx_ep_avx2_lib.extract_objects('cnxk_ep_rx_avx.c') - endif + cflags += ['-DCC_AVX2_SUPPORT'] + sources_avx2 = files('cnxk_ep_rx_avx.c') endif if arch_subdir == 'arm' diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build index c1c4a85bea..01bfb3c47d 100644 --- a/drivers/net/virtio/meson.build +++ b/drivers/net/virtio/meson.build @@ -27,15 +27,8 @@ cflags += no_wvla_cflag if arch_subdir == 'x86' if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] cflags += ['-DVIRTIO_RXTX_PACKED_VEC'] - virtio_avx512_lib = static_library('virtio_avx512_lib', - 'virtio_rxtx_packed.c', - dependencies: [static_rte_ethdev, - static_rte_kvargs, static_rte_bus_pci], - include_directories: includes, - c_args: cflags + cc_avx512_flags) - objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed.c') + sources_avx512 = files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 04/11] drivers/net: remove AVX2 build-time define 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson ` (2 preceding siblings ...) 2025-03-18 17:34 ` [PATCH v3 03/11] drivers/net: build use common AVX handling Bruce Richardson @ 2025-03-18 17:34 ` Bruce Richardson 2025-03-18 17:42 ` Ajit Khaparde 2025-03-18 17:34 ` [PATCH v3 05/11] event/dlb2: build using common AVX handling Bruce Richardson ` (7 subsequent siblings) 11 siblings, 1 reply; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:34 UTC (permalink / raw) To: dev Cc: david.marchand, Bruce Richardson, Ajit Khaparde, Somnath Kotur, Vamsi Attunuru Since all supported compilers can generate AVX2 code, we will always enable the build of the AVX2 files on x86. This means that CC_AVX2_SUPPORT is always true on x86, so it can be removed and a regular "#ifdef RTE_ARCH_x86" used in its place. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/net/bnxt/bnxt_ethdev.c | 2 -- drivers/net/octeon_ep/meson.build | 1 - drivers/net/octeon_ep/otx_ep_ethdev.c | 4 ---- 3 files changed, 7 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 144d4377bd..a318604c20 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -3238,8 +3238,6 @@ static const struct { #if defined(RTE_ARCH_X86) {bnxt_crx_pkts_vec, "Vector SSE"}, {bnxt_recv_pkts_vec, "Vector SSE"}, -#endif -#if defined(RTE_ARCH_X86) && defined(CC_AVX2_SUPPORT) {bnxt_crx_pkts_vec_avx2, "Vector AVX2"}, {bnxt_recv_pkts_vec_avx2, "Vector AVX2"}, #endif diff --git a/drivers/net/octeon_ep/meson.build b/drivers/net/octeon_ep/meson.build index 9bf4627894..a4a7663d1d 100644 --- a/drivers/net/octeon_ep/meson.build +++ b/drivers/net/octeon_ep/meson.build @@ -15,7 +15,6 @@ sources = files( if arch_subdir == 'x86' sources += files('cnxk_ep_rx_sse.c') - cflags += ['-DCC_AVX2_SUPPORT'] sources_avx2 = files('cnxk_ep_rx_avx.c') endif diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c index 8b14734b0c..10f2f8a2e0 100644 --- a/drivers/net/octeon_ep/otx_ep_ethdev.c +++ b/drivers/net/octeon_ep/otx_ep_ethdev.c @@ -91,11 +91,9 @@ otx_ep_set_rx_func(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts; #ifdef RTE_ARCH_X86 eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_sse; -#ifdef CC_AVX2_SUPPORT if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256 && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1) eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_avx; -#endif #elif defined(RTE_ARCH_ARM64) eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_neon; #endif @@ -105,11 +103,9 @@ otx_ep_set_rx_func(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts; #ifdef RTE_ARCH_X86 eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_sse; -#ifdef CC_AVX2_SUPPORT if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256 && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1) eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_avx; -#endif #elif defined(RTE_ARCH_ARM64) eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_neon; #endif -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v3 04/11] drivers/net: remove AVX2 build-time define 2025-03-18 17:34 ` [PATCH v3 04/11] drivers/net: remove AVX2 build-time define Bruce Richardson @ 2025-03-18 17:42 ` Ajit Khaparde 0 siblings, 0 replies; 48+ messages in thread From: Ajit Khaparde @ 2025-03-18 17:42 UTC (permalink / raw) To: Bruce Richardson; +Cc: dev, david.marchand, Somnath Kotur, Vamsi Attunuru [-- Attachment #1: Type: text/plain, Size: 3143 bytes --] On Tue, Mar 18, 2025 at 10:35 AM Bruce Richardson <bruce.richardson@intel.com> wrote: > > Since all supported compilers can generate AVX2 code, we will always > enable the build of the AVX2 files on x86. This means that > CC_AVX2_SUPPORT is always true on x86, so it can be removed and a > regular "#ifdef RTE_ARCH_x86" used in its place. > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> For bnxt: Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com> > --- > drivers/net/bnxt/bnxt_ethdev.c | 2 -- > drivers/net/octeon_ep/meson.build | 1 - > drivers/net/octeon_ep/otx_ep_ethdev.c | 4 ---- > 3 files changed, 7 deletions(-) > > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c > index 144d4377bd..a318604c20 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -3238,8 +3238,6 @@ static const struct { > #if defined(RTE_ARCH_X86) > {bnxt_crx_pkts_vec, "Vector SSE"}, > {bnxt_recv_pkts_vec, "Vector SSE"}, > -#endif > -#if defined(RTE_ARCH_X86) && defined(CC_AVX2_SUPPORT) > {bnxt_crx_pkts_vec_avx2, "Vector AVX2"}, > {bnxt_recv_pkts_vec_avx2, "Vector AVX2"}, > #endif > diff --git a/drivers/net/octeon_ep/meson.build b/drivers/net/octeon_ep/meson.build > index 9bf4627894..a4a7663d1d 100644 > --- a/drivers/net/octeon_ep/meson.build > +++ b/drivers/net/octeon_ep/meson.build > @@ -15,7 +15,6 @@ sources = files( > > if arch_subdir == 'x86' > sources += files('cnxk_ep_rx_sse.c') > - cflags += ['-DCC_AVX2_SUPPORT'] > sources_avx2 = files('cnxk_ep_rx_avx.c') > endif > > diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c > index 8b14734b0c..10f2f8a2e0 100644 > --- a/drivers/net/octeon_ep/otx_ep_ethdev.c > +++ b/drivers/net/octeon_ep/otx_ep_ethdev.c > @@ -91,11 +91,9 @@ otx_ep_set_rx_func(struct rte_eth_dev *eth_dev) > eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts; > #ifdef RTE_ARCH_X86 > eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_sse; > -#ifdef CC_AVX2_SUPPORT > if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256 && > rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1) > eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_avx; > -#endif > #elif defined(RTE_ARCH_ARM64) > eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_neon; > #endif > @@ -105,11 +103,9 @@ otx_ep_set_rx_func(struct rte_eth_dev *eth_dev) > eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts; > #ifdef RTE_ARCH_X86 > eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_sse; > -#ifdef CC_AVX2_SUPPORT > if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256 && > rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1) > eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_avx; > -#endif > #elif defined(RTE_ARCH_ARM64) > eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_neon; > #endif > -- > 2.43.0 > [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 4205 bytes --] ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 05/11] event/dlb2: build using common AVX handling 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson ` (3 preceding siblings ...) 2025-03-18 17:34 ` [PATCH v3 04/11] drivers/net: remove AVX2 build-time define Bruce Richardson @ 2025-03-18 17:34 ` Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 06/11] build: add generalized AVX handling for libs Bruce Richardson ` (6 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:34 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Konstantin Ananyev, Pravin Pathak remove special-case handling for AVX512, and rely on mechanisms in the drivers meson.build file. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/event/dlb2/dlb2_sse.c | 4 ++++ drivers/event/dlb2/meson.build | 16 ++-------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/event/dlb2/dlb2_sse.c b/drivers/event/dlb2/dlb2_sse.c index f2e1f9fb7e..06474d61dd 100644 --- a/drivers/event/dlb2/dlb2_sse.c +++ b/drivers/event/dlb2/dlb2_sse.c @@ -5,6 +5,8 @@ #include <stdint.h> #include <stdbool.h> +#ifndef CC_AVX512_SUPPORT + #include "dlb2_priv.h" #include "dlb2_iface.h" #include "dlb2_inline_fns.h" @@ -226,3 +228,5 @@ dlb2_event_build_hcws(struct dlb2_port *qm_port, break; } } + +#endif /* no CC_AVX512_SUPPORT */ diff --git a/drivers/event/dlb2/meson.build b/drivers/event/dlb2/meson.build index c024edb311..13d0fa544e 100644 --- a/drivers/event/dlb2/meson.build +++ b/drivers/event/dlb2/meson.build @@ -20,22 +20,10 @@ sources = files( 'pf/base/dlb2_resource.c', 'rte_pmd_dlb2.c', 'dlb2_selftest.c', + 'dlb2_sse.c', ) -if target_has_avx512 - cflags += '-DCC_AVX512_SUPPORT' - sources += files('dlb2_avx512.c') - -elif cc_has_avx512 - cflags += '-DCC_AVX512_SUPPORT' - avx512_tmplib = static_library('avx512_tmp', - 'dlb2_avx512.c', - dependencies: [static_rte_eal, static_rte_eventdev], - c_args: cflags + cc_avx512_flags) - objs += avx512_tmplib.extract_objects('dlb2_avx512.c') -else - sources += files('dlb2_sse.c') -endif +sources_avx512 += files('dlb2_avx512.c') headers = files('rte_pmd_dlb2.h') -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 06/11] build: add generalized AVX handling for libs 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson ` (4 preceding siblings ...) 2025-03-18 17:34 ` [PATCH v3 05/11] event/dlb2: build using common AVX handling Bruce Richardson @ 2025-03-18 17:34 ` Bruce Richardson 2025-03-18 17:35 ` [PATCH v3 07/11] acl: use common AVX build handling Bruce Richardson ` (5 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:34 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson Add support to the top-level lib build file for AVX2 and AVX512 specific sources. This should simplify library builds by avoiding the need to constantly reimplement the same build logic Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/meson.build | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/meson.build b/lib/meson.build index ce92cb5537..30ac84263c 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -122,6 +122,9 @@ foreach l:libraries use_function_versioning = false annotate_locks = true sources = [] + sources_avx2 = [] + sources_avx512 = [] + cflags_avx512 = [] # extra cflags for the avx512 code, e.g. extra avx512 feature flags headers = [] indirect_headers = [] # public headers not directly included by apps driver_sdk_headers = [] # public headers included by drivers @@ -242,7 +245,36 @@ foreach l:libraries cflags += '-Wthread-safety' endif - # first build static lib + # handle avx2 and avx512 source files + if arch_subdir == 'x86' + if sources_avx2.length() > 0 + avx2_lib = static_library(libname + '_avx2_lib', + sources_avx2, + dependencies: static_deps, + include_directories: includes, + c_args: [cflags, cc_avx2_flags]) + objs += avx2_lib.extract_objects(sources_avx2) + endif + if sources_avx512.length() > 0 and cc_has_avx512 + cflags += '-DCC_AVX512_SUPPORT' + avx512_args = [cflags, cflags_avx512, cc_avx512_flags] + if cc.has_argument('-march=skylake-avx512') + avx512_args += '-march=skylake-avx512' + if cc.has_argument('-Wno-overriding-option') + avx512_args += '-Wno-overriding-option' + endif + endif + avx512_lib = static_library(libname + '_avx512_lib', + sources_avx512, + dependencies: static_deps, + include_directories: includes, + c_args: avx512_args) + objs += avx512_lib.extract_objects(sources_avx512) + endif + endif + + + # build static lib static_lib = static_library(libname, sources, objects: objs, -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 07/11] acl: use common AVX build handling 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson ` (5 preceding siblings ...) 2025-03-18 17:34 ` [PATCH v3 06/11] build: add generalized AVX handling for libs Bruce Richardson @ 2025-03-18 17:35 ` Bruce Richardson 2025-03-19 10:16 ` David Marchand 2025-03-18 17:35 ` [PATCH v3 08/11] fib: " Bruce Richardson ` (4 subsequent siblings) 11 siblings, 1 reply; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:35 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Konstantin Ananyev remove custom logic for building AVX2 and AVX-512 files. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/acl/meson.build | 54 ++++----------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/lib/acl/meson.build b/lib/acl/meson.build index a80c172812..87e9f25f8e 100644 --- a/lib/acl/meson.build +++ b/lib/acl/meson.build @@ -15,57 +15,11 @@ headers = files('rte_acl.h', 'rte_acl_osdep.h') if dpdk_conf.has('RTE_ARCH_X86') sources += files('acl_run_sse.c') - - avx2_tmplib = static_library('avx2_tmp', - 'acl_run_avx2.c', - dependencies: static_rte_eal, - c_args: [cflags, cc_avx2_flags]) - objs += avx2_tmplib.extract_objects('acl_run_avx2.c') - - # compile AVX512 version if: - # we are building 64-bit binary AND binutils can generate proper code - - if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok - - # compile AVX512 version if either: - # a. we have AVX512 supported in minimum instruction set - # baseline - # b. it's not minimum instruction set, but supported by - # compiler - # - # in former case, just add avx512 C file to files list - # in latter case, compile c file to static lib, using correct - # compiler flags, and then have the .o file from static lib - # linked into main lib. - - # check if all required flags already enabled (variant a). - acl_avx512_flags = ['__AVX512F__', '__AVX512VL__', - '__AVX512CD__', '__AVX512BW__'] - - acl_avx512_on = true - foreach f:acl_avx512_flags - - if cc.get_define(f, args: machine_args) == '' - acl_avx512_on = false - endif - endforeach - - if acl_avx512_on == true - - sources += files('acl_run_avx512.c') - cflags += '-DCC_AVX512_SUPPORT' - - elif cc_has_avx512 - avx512_tmplib = static_library('avx512_tmp', - 'acl_run_avx512.c', - dependencies: static_rte_eal, - c_args: cflags + cc_avx512_flags) - objs += avx512_tmplib.extract_objects( - 'acl_run_avx512.c') - cflags += '-DCC_AVX512_SUPPORT' - endif + sources_avx2 += files('acl_run_avx2.c') + # AVX512 is only supported on 64-bit builds + if dpdk_conf.has('RTE_ARCH_X86_64') + sources_avx512 += files('acl_run_avx512.c') endif - elif dpdk_conf.has('RTE_ARCH_ARM') cflags += '-flax-vector-conversions' sources += files('acl_run_neon.c') -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v3 07/11] acl: use common AVX build handling 2025-03-18 17:35 ` [PATCH v3 07/11] acl: use common AVX build handling Bruce Richardson @ 2025-03-19 10:16 ` David Marchand 2025-03-19 10:26 ` Bruce Richardson 0 siblings, 1 reply; 48+ messages in thread From: David Marchand @ 2025-03-19 10:16 UTC (permalink / raw) To: Bruce Richardson; +Cc: dev, Konstantin Ananyev On Tue, Mar 18, 2025 at 6:35 PM Bruce Richardson <bruce.richardson@intel.com> wrote: > > remove custom logic for building AVX2 and AVX-512 files. > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> > --- > lib/acl/meson.build | 54 ++++----------------------------------------- > 1 file changed, 4 insertions(+), 50 deletions(-) > > diff --git a/lib/acl/meson.build b/lib/acl/meson.build > index a80c172812..87e9f25f8e 100644 > --- a/lib/acl/meson.build > +++ b/lib/acl/meson.build > @@ -15,57 +15,11 @@ headers = files('rte_acl.h', 'rte_acl_osdep.h') > > if dpdk_conf.has('RTE_ARCH_X86') > sources += files('acl_run_sse.c') > - > - avx2_tmplib = static_library('avx2_tmp', > - 'acl_run_avx2.c', > - dependencies: static_rte_eal, > - c_args: [cflags, cc_avx2_flags]) > - objs += avx2_tmplib.extract_objects('acl_run_avx2.c') > - > - # compile AVX512 version if: > - # we are building 64-bit binary AND binutils can generate proper code > - > - if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok > - > - # compile AVX512 version if either: > - # a. we have AVX512 supported in minimum instruction set > - # baseline > - # b. it's not minimum instruction set, but supported by > - # compiler > - # > - # in former case, just add avx512 C file to files list > - # in latter case, compile c file to static lib, using correct > - # compiler flags, and then have the .o file from static lib > - # linked into main lib. > - > - # check if all required flags already enabled (variant a). > - acl_avx512_flags = ['__AVX512F__', '__AVX512VL__', > - '__AVX512CD__', '__AVX512BW__'] Not sure it is an issue.. CD is not part of common cc_avx512_flags. -- David Marchand ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v3 07/11] acl: use common AVX build handling 2025-03-19 10:16 ` David Marchand @ 2025-03-19 10:26 ` Bruce Richardson 2025-03-19 10:40 ` David Marchand 0 siblings, 1 reply; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 10:26 UTC (permalink / raw) To: David Marchand; +Cc: dev, Konstantin Ananyev On Wed, Mar 19, 2025 at 11:16:09AM +0100, David Marchand wrote: > On Tue, Mar 18, 2025 at 6:35 PM Bruce Richardson > <bruce.richardson@intel.com> wrote: > > > > remove custom logic for building AVX2 and AVX-512 files. > > > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> > > --- > > lib/acl/meson.build | 54 ++++----------------------------------------- > > 1 file changed, 4 insertions(+), 50 deletions(-) > > > > diff --git a/lib/acl/meson.build b/lib/acl/meson.build > > index a80c172812..87e9f25f8e 100644 > > --- a/lib/acl/meson.build > > +++ b/lib/acl/meson.build > > @@ -15,57 +15,11 @@ headers = files('rte_acl.h', 'rte_acl_osdep.h') > > > > if dpdk_conf.has('RTE_ARCH_X86') > > sources += files('acl_run_sse.c') > > - > > - avx2_tmplib = static_library('avx2_tmp', > > - 'acl_run_avx2.c', > > - dependencies: static_rte_eal, > > - c_args: [cflags, cc_avx2_flags]) > > - objs += avx2_tmplib.extract_objects('acl_run_avx2.c') > > - > > - # compile AVX512 version if: > > - # we are building 64-bit binary AND binutils can generate proper code > > - > > - if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok > > - > > - # compile AVX512 version if either: > > - # a. we have AVX512 supported in minimum instruction set > > - # baseline > > - # b. it's not minimum instruction set, but supported by > > - # compiler > > - # > > - # in former case, just add avx512 C file to files list > > - # in latter case, compile c file to static lib, using correct > > - # compiler flags, and then have the .o file from static lib > > - # linked into main lib. > > - > > - # check if all required flags already enabled (variant a). > > - acl_avx512_flags = ['__AVX512F__', '__AVX512VL__', > > - '__AVX512CD__', '__AVX512BW__'] > > Not sure it is an issue.. CD is not part of common cc_avx512_flags. > It is since bce754b5d942 ("config/x86: add more flags in common AVX512 flags set") See: https://github.com/DPDK/dpdk/blob/main/config/x86/meson.build#L68 /Bruce ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v3 07/11] acl: use common AVX build handling 2025-03-19 10:26 ` Bruce Richardson @ 2025-03-19 10:40 ` David Marchand 2025-03-19 10:59 ` Bruce Richardson 0 siblings, 1 reply; 48+ messages in thread From: David Marchand @ 2025-03-19 10:40 UTC (permalink / raw) To: Bruce Richardson; +Cc: dev, Konstantin Ananyev On Wed, Mar 19, 2025 at 11:26 AM Bruce Richardson <bruce.richardson@intel.com> wrote: > > On Wed, Mar 19, 2025 at 11:16:09AM +0100, David Marchand wrote: > > On Tue, Mar 18, 2025 at 6:35 PM Bruce Richardson > > <bruce.richardson@intel.com> wrote: > > > > > > remove custom logic for building AVX2 and AVX-512 files. > > > > > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> > > > --- > > > lib/acl/meson.build | 54 ++++----------------------------------------- > > > 1 file changed, 4 insertions(+), 50 deletions(-) > > > > > > diff --git a/lib/acl/meson.build b/lib/acl/meson.build > > > index a80c172812..87e9f25f8e 100644 > > > --- a/lib/acl/meson.build > > > +++ b/lib/acl/meson.build > > > @@ -15,57 +15,11 @@ headers = files('rte_acl.h', 'rte_acl_osdep.h') > > > > > > if dpdk_conf.has('RTE_ARCH_X86') > > > sources += files('acl_run_sse.c') > > > - > > > - avx2_tmplib = static_library('avx2_tmp', > > > - 'acl_run_avx2.c', > > > - dependencies: static_rte_eal, > > > - c_args: [cflags, cc_avx2_flags]) > > > - objs += avx2_tmplib.extract_objects('acl_run_avx2.c') > > > - > > > - # compile AVX512 version if: > > > - # we are building 64-bit binary AND binutils can generate proper code > > > - > > > - if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok > > > - > > > - # compile AVX512 version if either: > > > - # a. we have AVX512 supported in minimum instruction set > > > - # baseline > > > - # b. it's not minimum instruction set, but supported by > > > - # compiler > > > - # > > > - # in former case, just add avx512 C file to files list > > > - # in latter case, compile c file to static lib, using correct > > > - # compiler flags, and then have the .o file from static lib > > > - # linked into main lib. > > > - > > > - # check if all required flags already enabled (variant a). > > > - acl_avx512_flags = ['__AVX512F__', '__AVX512VL__', > > > - '__AVX512CD__', '__AVX512BW__'] > > > > Not sure it is an issue.. CD is not part of common cc_avx512_flags. > > > It is since bce754b5d942 ("config/x86: add more flags in common AVX512 flags set") > See: https://github.com/DPDK/dpdk/blob/main/config/x86/meson.build#L68 Err.. I meant the target_has_avx512 variable. But looking again, it seems we can remove this variable entirely after the series. -- David Marchand ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v3 07/11] acl: use common AVX build handling 2025-03-19 10:40 ` David Marchand @ 2025-03-19 10:59 ` Bruce Richardson 0 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 10:59 UTC (permalink / raw) To: David Marchand; +Cc: dev, Konstantin Ananyev On Wed, Mar 19, 2025 at 11:40:19AM +0100, David Marchand wrote: > On Wed, Mar 19, 2025 at 11:26 AM Bruce Richardson > <bruce.richardson@intel.com> wrote: > > > > On Wed, Mar 19, 2025 at 11:16:09AM +0100, David Marchand wrote: > > > On Tue, Mar 18, 2025 at 6:35 PM Bruce Richardson > > > <bruce.richardson@intel.com> wrote: > > > > > > > > remove custom logic for building AVX2 and AVX-512 files. > > > > > > > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- > > > > lib/acl/meson.build | 54 > > > > ++++----------------------------------------- 1 file changed, 4 > > > > insertions(+), 50 deletions(-) > > > > > > > > diff --git a/lib/acl/meson.build b/lib/acl/meson.build index > > > > a80c172812..87e9f25f8e 100644 --- a/lib/acl/meson.build +++ > > > > b/lib/acl/meson.build @@ -15,57 +15,11 @@ headers = > > > > files('rte_acl.h', 'rte_acl_osdep.h') > > > > > > > > if dpdk_conf.has('RTE_ARCH_X86') sources += files('acl_run_sse.c') > > > > - - avx2_tmplib = static_library('avx2_tmp', - > > > > 'acl_run_avx2.c', - dependencies: static_rte_eal, - > > > > c_args: [cflags, cc_avx2_flags]) - objs += > > > > avx2_tmplib.extract_objects('acl_run_avx2.c') - - # compile > > > > AVX512 version if: - # we are building 64-bit binary AND > > > > binutils can generate proper code - - if > > > > dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok - - # > > > > compile AVX512 version if either: - # a. we have AVX512 > > > > supported in minimum instruction set - # baseline - > > > > # b. it's not minimum instruction set, but supported by - # > > > > compiler - # - # in former case, just add avx512 C > > > > file to files list - # in latter case, compile c file to > > > > static lib, using correct - # compiler flags, and then have > > > > the .o file from static lib - # linked into main lib. - - > > > > # check if all required flags already enabled (variant a). - > > > > acl_avx512_flags = ['__AVX512F__', '__AVX512VL__', - > > > > '__AVX512CD__', '__AVX512BW__'] > > > > > > Not sure it is an issue.. CD is not part of common cc_avx512_flags. > > > > > It is since bce754b5d942 ("config/x86: add more flags in common AVX512 > > flags set") See: > > https://github.com/DPDK/dpdk/blob/main/config/x86/meson.build#L68 > > Err.. I meant the target_has_avx512 variable. But looking again, it > seems we can remove this variable entirely after the series. > Yes, though I'm now thinking that we may actually want to use it. Since we have the avx handling "centralised" it might be worthwhile looking again at how we might generate the most efficient code in all cases. In some cases, using the AVX512 flag explicitly, along with march=skylake-avx512 flag, may produce worse code than if we just used e.g. the "march=native" flag. While this code was spread across a dozen files, and newer instruction sets beyond AVX512 were not that many/common, keeping checks short and to a minimum makes sense, but now it's centralised in only 2 files and new CPU generations add more capabilities, an extra check or two doesn't seem so bad. /Bruce ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 08/11] fib: use common AVX build handling 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson ` (6 preceding siblings ...) 2025-03-18 17:35 ` [PATCH v3 07/11] acl: use common AVX build handling Bruce Richardson @ 2025-03-18 17:35 ` Bruce Richardson 2025-03-18 17:35 ` [PATCH v3 09/11] net: simplify build-time logic for x86 Bruce Richardson ` (3 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:35 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Vladimir Medvedkin Remove custom logic for building AVX2 and AVX-512 files. Within the C code this requires some renaming of build macros to use the standard defines. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/fib/dir24_8.c | 6 +++--- lib/fib/meson.build | 18 +----------------- lib/fib/trie.c | 6 +++--- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/lib/fib/dir24_8.c b/lib/fib/dir24_8.c index c48d962d41..2ba7e93511 100644 --- a/lib/fib/dir24_8.c +++ b/lib/fib/dir24_8.c @@ -16,11 +16,11 @@ #include "dir24_8.h" #include "fib_log.h" -#ifdef CC_DIR24_8_AVX512_SUPPORT +#ifdef CC_AVX512_SUPPORT #include "dir24_8_avx512.h" -#endif /* CC_DIR24_8_AVX512_SUPPORT */ +#endif /* CC_AVX512_SUPPORT */ #define DIR24_8_NAMESIZE 64 @@ -63,7 +63,7 @@ get_scalar_fn_inlined(enum rte_fib_dir24_8_nh_sz nh_sz, bool be_addr) static inline rte_fib_lookup_fn_t get_vector_fn(enum rte_fib_dir24_8_nh_sz nh_sz, bool be_addr) { -#ifdef CC_DIR24_8_AVX512_SUPPORT +#ifdef CC_AVX512_SUPPORT if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) <= 0 || rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512DQ) <= 0 || rte_vect_get_max_simd_bitwidth() < RTE_VECT_SIMD_512) diff --git a/lib/fib/meson.build b/lib/fib/meson.build index 0c19cc8201..55d9ddcee9 100644 --- a/lib/fib/meson.build +++ b/lib/fib/meson.build @@ -15,21 +15,5 @@ deps += ['rcu'] deps += ['net'] if dpdk_conf.has('RTE_ARCH_X86_64') - if target_has_avx512 - cflags += ['-DCC_DIR24_8_AVX512_SUPPORT', '-DCC_TRIE_AVX512_SUPPORT'] - sources += files('dir24_8_avx512.c', 'trie_avx512.c') - - elif cc_has_avx512 - cflags += ['-DCC_DIR24_8_AVX512_SUPPORT', '-DCC_TRIE_AVX512_SUPPORT'] - dir24_8_avx512_tmp = static_library('dir24_8_avx512_tmp', - 'dir24_8_avx512.c', - dependencies: [static_rte_eal, static_rte_rcu], - c_args: cflags + cc_avx512_flags) - objs += dir24_8_avx512_tmp.extract_objects('dir24_8_avx512.c') - trie_avx512_tmp = static_library('trie_avx512_tmp', - 'trie_avx512.c', - dependencies: [static_rte_eal, static_rte_rcu, static_rte_net], - c_args: cflags + cc_avx512_flags) - objs += trie_avx512_tmp.extract_objects('trie_avx512.c') - endif + sources_avx512 = files('dir24_8_avx512.c', 'trie_avx512.c') endif diff --git a/lib/fib/trie.c b/lib/fib/trie.c index 4893f6c636..6c20057ac5 100644 --- a/lib/fib/trie.c +++ b/lib/fib/trie.c @@ -14,11 +14,11 @@ #include <rte_fib6.h> #include "trie.h" -#ifdef CC_TRIE_AVX512_SUPPORT +#ifdef CC_AVX512_SUPPORT #include "trie_avx512.h" -#endif /* CC_TRIE_AVX512_SUPPORT */ +#endif /* CC_AVX512_SUPPORT */ #define TRIE_NAMESIZE 64 @@ -45,7 +45,7 @@ get_scalar_fn(enum rte_fib_trie_nh_sz nh_sz) static inline rte_fib6_lookup_fn_t get_vector_fn(enum rte_fib_trie_nh_sz nh_sz) { -#ifdef CC_TRIE_AVX512_SUPPORT +#ifdef CC_AVX512_SUPPORT if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) <= 0 || rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512DQ) <= 0 || rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) <= 0 || -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 09/11] net: simplify build-time logic for x86 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson ` (7 preceding siblings ...) 2025-03-18 17:35 ` [PATCH v3 08/11] fib: " Bruce Richardson @ 2025-03-18 17:35 ` Bruce Richardson 2025-03-19 10:24 ` David Marchand 2025-03-18 17:35 ` [PATCH v3 10/11] net: use common AVX512 build code Bruce Richardson ` (2 subsequent siblings) 11 siblings, 1 reply; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:35 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Jasvinder Singh All DPDK-supported versions of clang and gcc have the "-mpclmul" and "-maes" flags, so we never need to check for those. This allows the SSE code path to be unconditionally built on x86. For the AVX512 code path, simplify it by only checking for the build-time support, and always doing a separate build with AVX512 support when that compiler support is present. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/net/meson.build | 53 +++++-------------------------------------- lib/net/rte_net_crc.c | 8 +++---- 2 files changed, 10 insertions(+), 51 deletions(-) diff --git a/lib/net/meson.build b/lib/net/meson.build index c9b34afc98..4bbbad3f42 100644 --- a/lib/net/meson.build +++ b/lib/net/meson.build @@ -42,57 +42,16 @@ deps += ['mbuf'] use_function_versioning = true if dpdk_conf.has('RTE_ARCH_X86_64') - net_crc_sse42_cpu_support = (cc.get_define('__PCLMUL__', args: machine_args) != '') - net_crc_avx512_cpu_support = ( - target_has_avx512 and - cc.get_define('__VPCLMULQDQ__', args: machine_args) != '' - ) - - net_crc_sse42_cc_support = (cc.has_argument('-mpclmul') and cc.has_argument('-maes')) - net_crc_avx512_cc_support = (cc.has_argument('-mvpclmulqdq') and cc_has_avx512) - - build_static_net_crc_sse42_lib = 0 - build_static_net_crc_avx512_lib = 0 - - if net_crc_sse42_cpu_support == true - sources += files('net_crc_sse.c') - cflags += ['-DCC_X86_64_SSE42_PCLMULQDQ_SUPPORT'] - if net_crc_avx512_cpu_support == true - sources += files('net_crc_avx512.c') - cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] - elif net_crc_avx512_cc_support == true - build_static_net_crc_avx512_lib = 1 - net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq'] - cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] - endif - elif net_crc_sse42_cc_support == true - build_static_net_crc_sse42_lib = 1 - net_crc_sse42_lib_cflags = ['-mpclmul', '-maes'] - cflags += ['-DCC_X86_64_SSE42_PCLMULQDQ_SUPPORT'] - if net_crc_avx512_cc_support == true - build_static_net_crc_avx512_lib = 1 - net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq', '-mpclmul'] - cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] - endif - endif - - if build_static_net_crc_sse42_lib == 1 - net_crc_sse42_lib = static_library( - 'net_crc_sse42_lib', - 'net_crc_sse.c', - dependencies: static_rte_eal, - c_args: [cflags, - net_crc_sse42_lib_cflags]) - objs += net_crc_sse42_lib.extract_objects('net_crc_sse.c') - endif - - if build_static_net_crc_avx512_lib == 1 + sources += files('net_crc_sse.c') + cflags += ['-mpclmul', '-maes'] + if cc.has_argument('-mvpclmulqdq') and cc_has_avx512 + net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq'] + cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] net_crc_avx512_lib = static_library( 'net_crc_avx512_lib', 'net_crc_avx512.c', dependencies: static_rte_eal, - c_args: [cflags, - net_crc_avx512_lib_cflags]) + c_args: [cflags, net_crc_avx512_lib_cflags]) objs += net_crc_avx512_lib.extract_objects('net_crc_avx512.c') endif diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c index 2fb3eec231..c9773d6300 100644 --- a/lib/net/rte_net_crc.c +++ b/lib/net/rte_net_crc.c @@ -66,7 +66,7 @@ static const rte_net_crc_handler handlers_avx512[] = { [RTE_NET_CRC32_ETH] = rte_crc32_eth_avx512_handler, }; #endif -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT +#ifdef RTE_ARCH_X86_64 static const rte_net_crc_handler handlers_sse42[] = { [RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_sse42_handler, [RTE_NET_CRC32_ETH] = rte_crc32_eth_sse42_handler, @@ -211,7 +211,7 @@ avx512_vpclmulqdq_init(void) static const rte_net_crc_handler * sse42_pclmulqdq_get_handlers(void) { -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT +#ifdef RTE_ARCH_X86_64 if (SSE42_PCLMULQDQ_CPU_SUPPORTED && max_simd_bitwidth >= RTE_VECT_SIMD_128) return handlers_sse42; @@ -223,7 +223,7 @@ sse42_pclmulqdq_get_handlers(void) static void sse42_pclmulqdq_init(void) { -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT +#ifdef RTE_ARCH_x86_64 if (SSE42_PCLMULQDQ_CPU_SUPPORTED) rte_net_crc_sse42_init(); #endif @@ -316,7 +316,7 @@ handlers_init(enum rte_net_crc_alg alg) #endif /* fall-through */ case RTE_NET_CRC_SSE42: -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT +#ifdef RTE_ARCH_X86_64 if (SSE42_PCLMULQDQ_CPU_SUPPORTED) { handlers_dpdk26[alg].f[RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_sse42_handler; -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v3 09/11] net: simplify build-time logic for x86 2025-03-18 17:35 ` [PATCH v3 09/11] net: simplify build-time logic for x86 Bruce Richardson @ 2025-03-19 10:24 ` David Marchand 0 siblings, 0 replies; 48+ messages in thread From: David Marchand @ 2025-03-19 10:24 UTC (permalink / raw) To: Bruce Richardson; +Cc: dev, Jasvinder Singh On Tue, Mar 18, 2025 at 6:36 PM Bruce Richardson <bruce.richardson@intel.com> wrote: > > All DPDK-supported versions of clang and gcc have the "-mpclmul" and > "-maes" flags, so we never need to check for those. This allows the SSE > code path to be unconditionally built on x86. > > For the AVX512 code path, simplify it by only checking for the > build-time support, and always doing a separate build with AVX512 > support when that compiler support is present. > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> > --- > lib/net/meson.build | 53 +++++-------------------------------------- > lib/net/rte_net_crc.c | 8 +++---- > 2 files changed, 10 insertions(+), 51 deletions(-) > > diff --git a/lib/net/meson.build b/lib/net/meson.build > index c9b34afc98..4bbbad3f42 100644 > --- a/lib/net/meson.build > +++ b/lib/net/meson.build > @@ -42,57 +42,16 @@ deps += ['mbuf'] > use_function_versioning = true > > if dpdk_conf.has('RTE_ARCH_X86_64') > - net_crc_sse42_cpu_support = (cc.get_define('__PCLMUL__', args: machine_args) != '') > - net_crc_avx512_cpu_support = ( > - target_has_avx512 and > - cc.get_define('__VPCLMULQDQ__', args: machine_args) != '' > - ) > - > - net_crc_sse42_cc_support = (cc.has_argument('-mpclmul') and cc.has_argument('-maes')) > - net_crc_avx512_cc_support = (cc.has_argument('-mvpclmulqdq') and cc_has_avx512) > - > - build_static_net_crc_sse42_lib = 0 > - build_static_net_crc_avx512_lib = 0 > - > - if net_crc_sse42_cpu_support == true > - sources += files('net_crc_sse.c') > - cflags += ['-DCC_X86_64_SSE42_PCLMULQDQ_SUPPORT'] > - if net_crc_avx512_cpu_support == true > - sources += files('net_crc_avx512.c') > - cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] > - elif net_crc_avx512_cc_support == true > - build_static_net_crc_avx512_lib = 1 > - net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq'] > - cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] > - endif > - elif net_crc_sse42_cc_support == true > - build_static_net_crc_sse42_lib = 1 > - net_crc_sse42_lib_cflags = ['-mpclmul', '-maes'] > - cflags += ['-DCC_X86_64_SSE42_PCLMULQDQ_SUPPORT'] > - if net_crc_avx512_cc_support == true > - build_static_net_crc_avx512_lib = 1 > - net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq', '-mpclmul'] > - cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] > - endif > - endif > - > - if build_static_net_crc_sse42_lib == 1 > - net_crc_sse42_lib = static_library( > - 'net_crc_sse42_lib', > - 'net_crc_sse.c', > - dependencies: static_rte_eal, > - c_args: [cflags, > - net_crc_sse42_lib_cflags]) > - objs += net_crc_sse42_lib.extract_objects('net_crc_sse.c') > - endif > - > - if build_static_net_crc_avx512_lib == 1 > + sources += files('net_crc_sse.c') > + cflags += ['-mpclmul', '-maes'] > + if cc.has_argument('-mvpclmulqdq') and cc_has_avx512 > + net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq'] Nit: we don't need this intermediate variable. But well, it gets removed in next patch. > + cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] > net_crc_avx512_lib = static_library( > 'net_crc_avx512_lib', > 'net_crc_avx512.c', > dependencies: static_rte_eal, > - c_args: [cflags, > - net_crc_avx512_lib_cflags]) > + c_args: [cflags, net_crc_avx512_lib_cflags]) > objs += net_crc_avx512_lib.extract_objects('net_crc_avx512.c') > endif > > diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c > index 2fb3eec231..c9773d6300 100644 > --- a/lib/net/rte_net_crc.c > +++ b/lib/net/rte_net_crc.c > @@ -66,7 +66,7 @@ static const rte_net_crc_handler handlers_avx512[] = { > [RTE_NET_CRC32_ETH] = rte_crc32_eth_avx512_handler, > }; > #endif > -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT > +#ifdef RTE_ARCH_X86_64 > static const rte_net_crc_handler handlers_sse42[] = { > [RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_sse42_handler, > [RTE_NET_CRC32_ETH] = rte_crc32_eth_sse42_handler, > @@ -211,7 +211,7 @@ avx512_vpclmulqdq_init(void) > static const rte_net_crc_handler * > sse42_pclmulqdq_get_handlers(void) > { > -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT > +#ifdef RTE_ARCH_X86_64 > if (SSE42_PCLMULQDQ_CPU_SUPPORTED && > max_simd_bitwidth >= RTE_VECT_SIMD_128) > return handlers_sse42; > @@ -223,7 +223,7 @@ sse42_pclmulqdq_get_handlers(void) > static void > sse42_pclmulqdq_init(void) > { > -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT > +#ifdef RTE_ARCH_x86_64 > if (SSE42_PCLMULQDQ_CPU_SUPPORTED) > rte_net_crc_sse42_init(); > #endif > @@ -316,7 +316,7 @@ handlers_init(enum rte_net_crc_alg alg) > #endif > /* fall-through */ > case RTE_NET_CRC_SSE42: > -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT > +#ifdef RTE_ARCH_X86_64 > if (SSE42_PCLMULQDQ_CPU_SUPPORTED) { > handlers_dpdk26[alg].f[RTE_NET_CRC16_CCITT] = > rte_crc16_ccitt_sse42_handler; > -- > 2.43.0 > -- David Marchand ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 10/11] net: use common AVX512 build code 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson ` (8 preceding siblings ...) 2025-03-18 17:35 ` [PATCH v3 09/11] net: simplify build-time logic for x86 Bruce Richardson @ 2025-03-18 17:35 ` Bruce Richardson 2025-03-18 17:35 ` [PATCH v3 11/11] member: use common AVX512 build support Bruce Richardson 2025-03-19 10:27 ` [PATCH v3 00/11] remove component-specific logic for AVX builds David Marchand 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:35 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Jasvinder Singh Use the common support for AVX512 code present in lib/meson.build, rather than hard-coding it. The only complication is an extra check for the "-mvpclmulqdq" command-line flag before adding the AVX512 sources. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/net/meson.build | 13 ++++--------- lib/net/rte_net_crc.c | 8 ++++---- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/net/meson.build b/lib/net/meson.build index 4bbbad3f42..7a6c419f40 100644 --- a/lib/net/meson.build +++ b/lib/net/meson.build @@ -44,15 +44,10 @@ use_function_versioning = true if dpdk_conf.has('RTE_ARCH_X86_64') sources += files('net_crc_sse.c') cflags += ['-mpclmul', '-maes'] - if cc.has_argument('-mvpclmulqdq') and cc_has_avx512 - net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq'] - cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] - net_crc_avx512_lib = static_library( - 'net_crc_avx512_lib', - 'net_crc_avx512.c', - dependencies: static_rte_eal, - c_args: [cflags, net_crc_avx512_lib_cflags]) - objs += net_crc_avx512_lib.extract_objects('net_crc_avx512.c') + # only build AVX-512 support if we also have PCLMULQDQ support + if cc.has_argument('-mvpclmulqdq') + sources_avx512 += files('net_crc_avx512.c') + cflags_avx512 += ['-mvpclmulqdq'] endif elif (dpdk_conf.has('RTE_ARCH_ARM64') and diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c index c9773d6300..24ec267fc8 100644 --- a/lib/net/rte_net_crc.c +++ b/lib/net/rte_net_crc.c @@ -60,7 +60,7 @@ static const rte_net_crc_handler handlers_scalar[] = { [RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_handler, [RTE_NET_CRC32_ETH] = rte_crc32_eth_handler, }; -#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT +#ifdef CC_AVX512_SUPPORT static const rte_net_crc_handler handlers_avx512[] = { [RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_avx512_handler, [RTE_NET_CRC32_ETH] = rte_crc32_eth_avx512_handler, @@ -185,7 +185,7 @@ rte_crc32_eth_handler(const uint8_t *data, uint32_t data_len) static const rte_net_crc_handler * avx512_vpclmulqdq_get_handlers(void) { -#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT +#ifdef CC_AVX512_SUPPORT if (AVX512_VPCLMULQDQ_CPU_SUPPORTED && max_simd_bitwidth >= RTE_VECT_SIMD_512) return handlers_avx512; @@ -197,7 +197,7 @@ avx512_vpclmulqdq_get_handlers(void) static void avx512_vpclmulqdq_init(void) { -#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT +#ifdef CC_AVX512_SUPPORT if (AVX512_VPCLMULQDQ_CPU_SUPPORTED) rte_net_crc_avx512_init(); #endif @@ -305,7 +305,7 @@ handlers_init(enum rte_net_crc_alg alg) switch (alg) { case RTE_NET_CRC_AVX512: -#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT +#ifdef CC_AVX512_SUPPORT if (AVX512_VPCLMULQDQ_CPU_SUPPORTED) { handlers_dpdk26[alg].f[RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_avx512_handler; -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v3 11/11] member: use common AVX512 build support 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson ` (9 preceding siblings ...) 2025-03-18 17:35 ` [PATCH v3 10/11] net: use common AVX512 build code Bruce Richardson @ 2025-03-18 17:35 ` Bruce Richardson 2025-03-19 10:27 ` [PATCH v3 00/11] remove component-specific logic for AVX builds David Marchand 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-18 17:35 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Yipeng Wang, Sameh Gobriel Use the support for building AVX512 code present in lib/meson.build rather than reimplementing it in the library meson.build file. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/member/meson.build | 46 +++++++----------------------------------- 1 file changed, 7 insertions(+), 39 deletions(-) diff --git a/lib/member/meson.build b/lib/member/meson.build index 4341b424df..07f9afaed9 100644 --- a/lib/member/meson.build +++ b/lib/member/meson.build @@ -20,44 +20,12 @@ sources = files( deps += ['hash', 'ring'] -# compile AVX512 version if: -if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok - # compile AVX512 version if either: - # a. we have AVX512 supported in minimum instruction set - # baseline - # b. it's not minimum instruction set, but supported by - # compiler - # - # in former case, just add avx512 C file to files list - # in latter case, compile c file to static lib, using correct - # compiler flags, and then have the .o file from static lib - # linked into main lib. - - member_avx512_args = cc_avx512_flags - if not is_ms_compiler - member_avx512_args += '-mavx512ifma' - endif - - # check if all required flags already enabled - sketch_avx512_flags = ['__AVX512F__', '__AVX512DQ__', '__AVX512IFMA__'] - - sketch_avx512_on = true - foreach f:sketch_avx512_flags - if cc.get_define(f, args: machine_args) == '' - sketch_avx512_on = false - endif - endforeach - - if sketch_avx512_on == true - cflags += ['-DCC_AVX512_SUPPORT'] - sources += files('rte_member_sketch_avx512.c') - elif cc.has_multi_arguments(member_avx512_args) - sketch_avx512_tmp = static_library('sketch_avx512_tmp', - 'rte_member_sketch_avx512.c', - include_directories: includes, - dependencies: [static_rte_eal, static_rte_hash], - c_args: cflags + member_avx512_args) - objs += sketch_avx512_tmp.extract_objects('rte_member_sketch_avx512.c') - cflags += ['-DCC_AVX512_SUPPORT'] +# compile AVX512 version if we have avx512 on MSVC or the 'ifma' flag on GCC/Clang +if dpdk_conf.has('RTE_ARCH_X86_64') + if is_ms_compiler + sources_avx512 += files('rte_member_sketch_avx512.c') + elif cc.has_argument('-mavx512ifma') + sources_avx512 += files('rte_member_sketch_avx512.c') + cflags_avx512 += '-mavx512ifma' endif endif -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v3 00/11] remove component-specific logic for AVX builds 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson ` (10 preceding siblings ...) 2025-03-18 17:35 ` [PATCH v3 11/11] member: use common AVX512 build support Bruce Richardson @ 2025-03-19 10:27 ` David Marchand 11 siblings, 0 replies; 48+ messages in thread From: David Marchand @ 2025-03-19 10:27 UTC (permalink / raw) To: Bruce Richardson; +Cc: dev On Tue, Mar 18, 2025 at 6:35 PM Bruce Richardson <bruce.richardson@intel.com> wrote: > > A number of libs and drivers had special optimized AVX2 and AVX512 code > paths for performance reasons, and these tended to have copy-pasted > logic to build those files. Centralise that logic in the main > drivers/ and lib/ meson.build files to avoid duplication. > > v3: add patch for event/dlb2 AVX512 handling. > add common code for libraries as well as drivers. > v2: add patch 4 to remove use of unnecessary CC_AVX2_SUPPORT flag > > > Bruce Richardson (11): > build: add generalized AVX handling for drivers > net/intel: use common AVX build code > drivers/net: build use common AVX handling > drivers/net: remove AVX2 build-time define > event/dlb2: build using common AVX handling > build: add generalized AVX handling for libs > acl: use common AVX build handling > fib: use common AVX build handling > net: simplify build-time logic for x86 > net: use common AVX512 build code > member: use common AVX512 build support > > drivers/event/dlb2/dlb2_sse.c | 4 ++ > drivers/event/dlb2/meson.build | 16 +------- > drivers/meson.build | 30 ++++++++++++++ > drivers/net/bnxt/bnxt_ethdev.c | 2 - > drivers/net/bnxt/meson.build | 10 +---- > drivers/net/enic/meson.build | 10 +---- > drivers/net/intel/i40e/meson.build | 26 +----------- > drivers/net/intel/iavf/meson.build | 25 +----------- > drivers/net/intel/ice/meson.build | 25 +----------- > drivers/net/intel/idpf/meson.build | 25 +----------- > drivers/net/nfp/meson.build | 10 +---- > drivers/net/octeon_ep/meson.build | 13 +----- > drivers/net/octeon_ep/otx_ep_ethdev.c | 4 -- > drivers/net/virtio/meson.build | 9 +---- > lib/acl/meson.build | 54 ++----------------------- > lib/fib/dir24_8.c | 6 +-- > lib/fib/meson.build | 18 +-------- > lib/fib/trie.c | 6 +-- > lib/member/meson.build | 46 ++++----------------- > lib/meson.build | 34 +++++++++++++++- > lib/net/meson.build | 58 +++------------------------ > lib/net/rte_net_crc.c | 16 ++++---- > 22 files changed, 114 insertions(+), 333 deletions(-) I just have some nits (and we need a rebase), otherwise this is a nice cleanup. Thanks Bruce. -- David Marchand ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 00/11] remove component-specific logic for AVX builds 2025-03-14 17:23 [PATCH 0/3] remove driver-specific logic for AVX builds Bruce Richardson ` (4 preceding siblings ...) 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 01/11] drivers: add generalized AVX build handling Bruce Richardson ` (11 more replies) 5 siblings, 12 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson A number of libs and drivers had special optimized AVX2 and AVX512 code paths for performance reasons, and these tended to have copy-pasted logic to build those files. Centralise that logic in the main drivers/ and lib/ meson.build files to avoid duplication. v4: rebase on latest main branch minor fixes following feedback limit use of -march=skylake-avx512 to when we don't already have a -march flag supporting AVX512. v3: add patch for event/dlb2 AVX512 handling. add common code for libraries as well as drivers. v2: add patch 4 to remove use of unnecessary CC_AVX2_SUPPORT flag Bruce Richardson (11): drivers: add generalized AVX build handling net/intel: use common AVX build code drivers/net: build use common AVX handling drivers/net: remove AVX2 build-time define event/dlb2: build using common AVX handling lib: add generalized AVX build handling acl: use common AVX build handling fib: use common AVX build handling net: simplify build-time logic for x86 net: use common AVX512 build code member: use common AVX512 build support drivers/event/dlb2/dlb2_sse.c | 4 ++ drivers/event/dlb2/meson.build | 16 +------- drivers/meson.build | 30 ++++++++++++++ drivers/net/bnxt/bnxt_ethdev.c | 2 - drivers/net/bnxt/meson.build | 10 +---- drivers/net/enic/meson.build | 10 +---- drivers/net/intel/i40e/meson.build | 26 +----------- drivers/net/intel/iavf/meson.build | 25 +----------- drivers/net/intel/ice/meson.build | 25 +----------- drivers/net/intel/idpf/meson.build | 25 +----------- drivers/net/nfp/meson.build | 10 +---- drivers/net/octeon_ep/meson.build | 13 +----- drivers/net/octeon_ep/otx_ep_ethdev.c | 4 -- drivers/net/virtio/meson.build | 9 +---- lib/acl/meson.build | 54 ++----------------------- lib/fib/dir24_8.c | 6 +-- lib/fib/meson.build | 18 +-------- lib/fib/trie.c | 6 +-- lib/member/meson.build | 46 ++++----------------- lib/meson.build | 34 +++++++++++++++- lib/net/meson.build | 58 +++------------------------ lib/net/rte_net_crc.c | 16 ++++---- 22 files changed, 114 insertions(+), 333 deletions(-) -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 01/11] drivers: add generalized AVX build handling 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 02/11] net/intel: use common AVX build code Bruce Richardson ` (10 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson Add support to the top-level driver build file for AVX2 and AVX512 specific sources. This should simplify driver builds by avoiding the need to constantly reimplement the same build logic Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/meson.build | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/meson.build b/drivers/meson.build index 05391a575d..c15319dc24 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -126,6 +126,8 @@ foreach subpath:subdirs name = drv annotate_locks = true sources = [] + sources_avx2 = [] + sources_avx512 = [] headers = [] driver_sdk_headers = [] # public headers included by drivers objs = [] @@ -235,6 +237,34 @@ foreach subpath:subdirs dpdk_includes += include_directories(drv_path) endif + # handle avx2 and avx512 source files + if arch_subdir == 'x86' + if sources_avx2.length() > 0 + avx2_lib = static_library(lib_name + '_avx2_lib', + sources_avx2, + dependencies: static_deps, + include_directories: includes, + c_args: [cflags, cc_avx2_flags]) + objs += avx2_lib.extract_objects(sources_avx2) + endif + if sources_avx512.length() > 0 and cc_has_avx512 + cflags += '-DCC_AVX512_SUPPORT' + avx512_args = [cflags, cc_avx512_flags] + if not target_has_avx512 and cc.has_argument('-march=skylake-avx512') + avx512_args += '-march=skylake-avx512' + if cc.has_argument('-Wno-overriding-option') + avx512_args += '-Wno-overriding-option' + endif + endif + avx512_lib = static_library(lib_name + '_avx512_lib', + sources_avx512, + dependencies: static_deps, + include_directories: includes, + c_args: avx512_args) + objs += avx512_lib.extract_objects(sources_avx512) + endif + endif + # generate pmdinfo sources by building a temporary # lib and then running pmdinfogen on the contents of # that lib. The final lib reuses the object files and -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 02/11] net/intel: use common AVX build code 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 01/11] drivers: add generalized AVX build handling Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 03/11] drivers/net: build use common AVX handling Bruce Richardson ` (9 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev Cc: david.marchand, Bruce Richardson, Ian Stokes, Vladimir Medvedkin, Anatoly Burakov, Jingjing Wu, Praveen Shetty Remove driver-specific build instructions for the AVX2 and AVX-512 code, and rely instead on the generic driver build file. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/net/intel/i40e/meson.build | 26 ++------------------------ drivers/net/intel/iavf/meson.build | 25 ++----------------------- drivers/net/intel/ice/meson.build | 25 ++----------------------- drivers/net/intel/idpf/meson.build | 25 ++----------------------- 4 files changed, 8 insertions(+), 93 deletions(-) diff --git a/drivers/net/intel/i40e/meson.build b/drivers/net/intel/i40e/meson.build index 15993393fb..dae61222cf 100644 --- a/drivers/net/intel/i40e/meson.build +++ b/drivers/net/intel/i40e/meson.build @@ -40,31 +40,9 @@ includes += include_directories('base') if arch_subdir == 'x86' sources += files('i40e_rxtx_vec_sse.c') + sources_avx2 += files('i40e_rxtx_vec_avx2.c') + sources_avx512 += files('i40e_rxtx_vec_avx512.c') - i40e_avx2_lib = static_library('i40e_avx2_lib', - 'i40e_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += i40e_avx2_lib.extract_objects('i40e_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - i40e_avx512_lib = static_library('i40e_avx512_lib', - 'i40e_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev, - static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: avx512_args) - objs += i40e_avx512_lib.extract_objects('i40e_rxtx_vec_avx512.c') - endif elif arch_subdir == 'ppc' sources += files('i40e_rxtx_vec_altivec.c') elif arch_subdir == 'arm' diff --git a/drivers/net/intel/iavf/meson.build b/drivers/net/intel/iavf/meson.build index 833a63e6c8..1ca500c43c 100644 --- a/drivers/net/intel/iavf/meson.build +++ b/drivers/net/intel/iavf/meson.build @@ -28,30 +28,9 @@ includes += include_directories('base') if arch_subdir == 'x86' sources += files('iavf_rxtx_vec_sse.c') + sources_avx2 += files('iavf_rxtx_vec_avx2.c') + sources_avx512 += files('iavf_rxtx_vec_avx512.c') - iavf_avx2_lib = static_library('iavf_avx2_lib', - 'iavf_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += iavf_avx2_lib.extract_objects('iavf_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - iavf_avx512_lib = static_library('iavf_avx512_lib', - 'iavf_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev], - include_directories: includes, - c_args: avx512_args) - objs += iavf_avx512_lib.extract_objects('iavf_rxtx_vec_avx512.c') - endif elif arch_subdir == 'arm' sources += files('iavf_rxtx_vec_neon.c') endif diff --git a/drivers/net/intel/ice/meson.build b/drivers/net/intel/ice/meson.build index 4d8f71cd4a..fa6c505450 100644 --- a/drivers/net/intel/ice/meson.build +++ b/drivers/net/intel/ice/meson.build @@ -34,30 +34,9 @@ endif if arch_subdir == 'x86' sources += files('ice_rxtx_vec_sse.c') + sources_avx2 += files('ice_rxtx_vec_avx2.c') + sources_avx512 += files('ice_rxtx_vec_avx512.c') - ice_avx2_lib = static_library('ice_avx2_lib', - 'ice_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += ice_avx2_lib.extract_objects('ice_rxtx_vec_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - ice_avx512_lib = static_library('ice_avx512_lib', - 'ice_rxtx_vec_avx512.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: avx512_args) - objs += ice_avx512_lib.extract_objects('ice_rxtx_vec_avx512.c') - endif endif sources += files( diff --git a/drivers/net/intel/idpf/meson.build b/drivers/net/intel/idpf/meson.build index 4b272d02b1..f579ffae46 100644 --- a/drivers/net/intel/idpf/meson.build +++ b/drivers/net/intel/idpf/meson.build @@ -19,29 +19,8 @@ sources = files( ) if arch_subdir == 'x86' and dpdk_conf.get('RTE_IOVA_IN_MBUF') == 1 - idpf_avx2_lib = static_library('idpf_avx2_lib', - 'idpf_common_rxtx_avx2.c', - dependencies: [static_rte_ethdev, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += idpf_avx2_lib.extract_objects('idpf_common_rxtx_avx2.c') - - if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] - avx512_args = cflags + cc_avx512_flags - if cc.has_argument('-march=skylake-avx512') - avx512_args += '-march=skylake-avx512' - if cc.has_argument('-Wno-overriding-option') - avx512_args += '-Wno-overriding-option' - endif - endif - idpf_common_avx512_lib = static_library('idpf_common_avx512_lib', - 'idpf_common_rxtx_avx512.c', - dependencies: static_rte_mbuf, - include_directories: includes, - c_args: avx512_args) - objs += idpf_common_avx512_lib.extract_objects('idpf_common_rxtx_avx512.c') - endif + sources_avx2 += files('idpf_common_rxtx_avx2.c') + sources_avx512 += files('idpf_common_rxtx_avx512.c') endif subdir('base') -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 03/11] drivers/net: build use common AVX handling 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 01/11] drivers: add generalized AVX build handling Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 02/11] net/intel: use common AVX build code Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 04/11] drivers/net: remove AVX2 build-time define Bruce Richardson ` (8 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev Cc: david.marchand, Bruce Richardson, Ajit Khaparde, Somnath Kotur, John Daley, Hyong Youb Kim, Chaoyong He, Vamsi Attunuru, Maxime Coquelin, Chenbo Xia Remove from remaining net drivers the special-case code to handle AVX2 or AVX512 specific files. These can be built instead using drivers/meson.build. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/net/bnxt/meson.build | 10 +--------- drivers/net/enic/meson.build | 10 +--------- drivers/net/nfp/meson.build | 10 +--------- drivers/net/octeon_ep/meson.build | 14 ++------------ drivers/net/virtio/meson.build | 9 +-------- 5 files changed, 6 insertions(+), 47 deletions(-) diff --git a/drivers/net/bnxt/meson.build b/drivers/net/bnxt/meson.build index fd82d0c409..dcca7df916 100644 --- a/drivers/net/bnxt/meson.build +++ b/drivers/net/bnxt/meson.build @@ -58,15 +58,7 @@ subdir('hcapi/cfa_v3') if arch_subdir == 'x86' sources += files('bnxt_rxtx_vec_sse.c') - # build AVX2 code with instruction set explicitly enabled for runtime selection - bnxt_avx2_lib = static_library('bnxt_avx2_lib', - 'bnxt_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, - static_rte_bus_pci, - static_rte_kvargs, static_rte_hash], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += bnxt_avx2_lib.extract_objects('bnxt_rxtx_vec_avx2.c') + sources_avx2 = files('bnxt_rxtx_vec_avx2.c') elif arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64') sources += files('bnxt_rxtx_vec_neon.c') endif diff --git a/drivers/net/enic/meson.build b/drivers/net/enic/meson.build index cfe5ec170a..2b3052fae8 100644 --- a/drivers/net/enic/meson.build +++ b/drivers/net/enic/meson.build @@ -29,17 +29,9 @@ sources = files( deps += ['hash'] includes += include_directories('base') -# Build the avx2 handler for 64-bit X86 targets, even though 'machine' -# may not. This is to support users who build for the min supported machine -# and need to run the binary on newer CPUs too. if dpdk_conf.has('RTE_ARCH_X86_64') cflags += '-DENIC_RXTX_VEC' - enic_avx2_lib = static_library('enic_avx2_lib', - 'enic_rxtx_vec_avx2.c', - dependencies: [static_rte_ethdev, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += enic_avx2_lib.extract_objects('enic_rxtx_vec_avx2.c') + sources_avx2 = files('enic_rxtx_vec_avx2.c') endif annotate_locks = false diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build index 0a12b7dce7..a98b584042 100644 --- a/drivers/net/nfp/meson.build +++ b/drivers/net/nfp/meson.build @@ -52,19 +52,11 @@ cflags += no_wvla_cflag if arch_subdir == 'x86' includes += include_directories('../../common/nfp') - avx2_sources = files( + sources_avx2 = files( 'nfdk/nfp_nfdk_vec_avx2_dp.c', 'nfp_rxtx_vec_avx2.c', ) - nfp_avx2_lib = static_library('nfp_avx2_lib', - avx2_sources, - dependencies: [static_rte_ethdev, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags] - ) - - objs += nfp_avx2_lib.extract_all_objects(recursive: true) else sources += files( 'nfp_rxtx_vec_stub.c', diff --git a/drivers/net/octeon_ep/meson.build b/drivers/net/octeon_ep/meson.build index 1b34db3edc..9bf4627894 100644 --- a/drivers/net/octeon_ep/meson.build +++ b/drivers/net/octeon_ep/meson.build @@ -15,18 +15,8 @@ sources = files( if arch_subdir == 'x86' sources += files('cnxk_ep_rx_sse.c') - if cc.get_define('__AVX2__', args: machine_args) != '' - cflags += ['-DCC_AVX2_SUPPORT'] - sources += files('cnxk_ep_rx_avx.c') - elif cc.has_multi_arguments(cc_avx2_flags) - cflags += ['-DCC_AVX2_SUPPORT'] - otx_ep_avx2_lib = static_library('otx_ep_avx2_lib', - 'cnxk_ep_rx_avx.c', - dependencies: [static_rte_ethdev, static_rte_pci, static_rte_bus_pci], - include_directories: includes, - c_args: [cflags, cc_avx2_flags]) - objs += otx_ep_avx2_lib.extract_objects('cnxk_ep_rx_avx.c') - endif + cflags += ['-DCC_AVX2_SUPPORT'] + sources_avx2 = files('cnxk_ep_rx_avx.c') endif if arch_subdir == 'arm' diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build index c1c4a85bea..01bfb3c47d 100644 --- a/drivers/net/virtio/meson.build +++ b/drivers/net/virtio/meson.build @@ -27,15 +27,8 @@ cflags += no_wvla_cflag if arch_subdir == 'x86' if cc_has_avx512 - cflags += ['-DCC_AVX512_SUPPORT'] cflags += ['-DVIRTIO_RXTX_PACKED_VEC'] - virtio_avx512_lib = static_library('virtio_avx512_lib', - 'virtio_rxtx_packed.c', - dependencies: [static_rte_ethdev, - static_rte_kvargs, static_rte_bus_pci], - include_directories: includes, - c_args: cflags + cc_avx512_flags) - objs += virtio_avx512_lib.extract_objects('virtio_rxtx_packed.c') + sources_avx512 = files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 04/11] drivers/net: remove AVX2 build-time define 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson ` (2 preceding siblings ...) 2025-03-19 17:29 ` [PATCH v4 03/11] drivers/net: build use common AVX handling Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 05/11] event/dlb2: build using common AVX handling Bruce Richardson ` (7 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev Cc: david.marchand, Bruce Richardson, Ajit Khaparde, Somnath Kotur, Vamsi Attunuru Since all supported compilers can generate AVX2 code, we will always enable the build of the AVX2 files on x86. This means that CC_AVX2_SUPPORT is always true on x86, so it can be removed and a regular "#ifdef RTE_ARCH_x86" used in its place. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com> --- drivers/net/bnxt/bnxt_ethdev.c | 2 -- drivers/net/octeon_ep/meson.build | 1 - drivers/net/octeon_ep/otx_ep_ethdev.c | 4 ---- 3 files changed, 7 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index a0e3cd8bbe..2f37f5aa10 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -3258,8 +3258,6 @@ static const struct { #if defined(RTE_ARCH_X86) {bnxt_crx_pkts_vec, "Vector SSE"}, {bnxt_recv_pkts_vec, "Vector SSE"}, -#endif -#if defined(RTE_ARCH_X86) && defined(CC_AVX2_SUPPORT) {bnxt_crx_pkts_vec_avx2, "Vector AVX2"}, {bnxt_recv_pkts_vec_avx2, "Vector AVX2"}, #endif diff --git a/drivers/net/octeon_ep/meson.build b/drivers/net/octeon_ep/meson.build index 9bf4627894..a4a7663d1d 100644 --- a/drivers/net/octeon_ep/meson.build +++ b/drivers/net/octeon_ep/meson.build @@ -15,7 +15,6 @@ sources = files( if arch_subdir == 'x86' sources += files('cnxk_ep_rx_sse.c') - cflags += ['-DCC_AVX2_SUPPORT'] sources_avx2 = files('cnxk_ep_rx_avx.c') endif diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c index 8b14734b0c..10f2f8a2e0 100644 --- a/drivers/net/octeon_ep/otx_ep_ethdev.c +++ b/drivers/net/octeon_ep/otx_ep_ethdev.c @@ -91,11 +91,9 @@ otx_ep_set_rx_func(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts; #ifdef RTE_ARCH_X86 eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_sse; -#ifdef CC_AVX2_SUPPORT if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256 && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1) eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_avx; -#endif #elif defined(RTE_ARCH_ARM64) eth_dev->rx_pkt_burst = &cnxk_ep_recv_pkts_neon; #endif @@ -105,11 +103,9 @@ otx_ep_set_rx_func(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts; #ifdef RTE_ARCH_X86 eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_sse; -#ifdef CC_AVX2_SUPPORT if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256 && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1) eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_avx; -#endif #elif defined(RTE_ARCH_ARM64) eth_dev->rx_pkt_burst = &cn9k_ep_recv_pkts_neon; #endif -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 05/11] event/dlb2: build using common AVX handling 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson ` (3 preceding siblings ...) 2025-03-19 17:29 ` [PATCH v4 04/11] drivers/net: remove AVX2 build-time define Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 06/11] lib: add generalized AVX build handling Bruce Richardson ` (6 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Konstantin Ananyev, Pravin Pathak remove special-case handling for AVX512, and rely on mechanisms in the drivers meson.build file. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- drivers/event/dlb2/dlb2_sse.c | 4 ++++ drivers/event/dlb2/meson.build | 16 ++-------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/event/dlb2/dlb2_sse.c b/drivers/event/dlb2/dlb2_sse.c index f2e1f9fb7e..06474d61dd 100644 --- a/drivers/event/dlb2/dlb2_sse.c +++ b/drivers/event/dlb2/dlb2_sse.c @@ -5,6 +5,8 @@ #include <stdint.h> #include <stdbool.h> +#ifndef CC_AVX512_SUPPORT + #include "dlb2_priv.h" #include "dlb2_iface.h" #include "dlb2_inline_fns.h" @@ -226,3 +228,5 @@ dlb2_event_build_hcws(struct dlb2_port *qm_port, break; } } + +#endif /* no CC_AVX512_SUPPORT */ diff --git a/drivers/event/dlb2/meson.build b/drivers/event/dlb2/meson.build index c024edb311..13d0fa544e 100644 --- a/drivers/event/dlb2/meson.build +++ b/drivers/event/dlb2/meson.build @@ -20,22 +20,10 @@ sources = files( 'pf/base/dlb2_resource.c', 'rte_pmd_dlb2.c', 'dlb2_selftest.c', + 'dlb2_sse.c', ) -if target_has_avx512 - cflags += '-DCC_AVX512_SUPPORT' - sources += files('dlb2_avx512.c') - -elif cc_has_avx512 - cflags += '-DCC_AVX512_SUPPORT' - avx512_tmplib = static_library('avx512_tmp', - 'dlb2_avx512.c', - dependencies: [static_rte_eal, static_rte_eventdev], - c_args: cflags + cc_avx512_flags) - objs += avx512_tmplib.extract_objects('dlb2_avx512.c') -else - sources += files('dlb2_sse.c') -endif +sources_avx512 += files('dlb2_avx512.c') headers = files('rte_pmd_dlb2.h') -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 06/11] lib: add generalized AVX build handling 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson ` (4 preceding siblings ...) 2025-03-19 17:29 ` [PATCH v4 05/11] event/dlb2: build using common AVX handling Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 07/11] acl: use common " Bruce Richardson ` (5 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson Add support to the top-level lib build file for AVX2 and AVX512 specific sources. This should simplify library builds by avoiding the need to constantly reimplement the same build logic Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/meson.build | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/meson.build b/lib/meson.build index ce92cb5537..e2605e7d68 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -122,6 +122,9 @@ foreach l:libraries use_function_versioning = false annotate_locks = true sources = [] + sources_avx2 = [] + sources_avx512 = [] + cflags_avx512 = [] # extra cflags for the avx512 code, e.g. extra avx512 feature flags headers = [] indirect_headers = [] # public headers not directly included by apps driver_sdk_headers = [] # public headers included by drivers @@ -242,7 +245,36 @@ foreach l:libraries cflags += '-Wthread-safety' endif - # first build static lib + # handle avx2 and avx512 source files + if arch_subdir == 'x86' + if sources_avx2.length() > 0 + avx2_lib = static_library(libname + '_avx2_lib', + sources_avx2, + dependencies: static_deps, + include_directories: includes, + c_args: [cflags, cc_avx2_flags]) + objs += avx2_lib.extract_objects(sources_avx2) + endif + if sources_avx512.length() > 0 and cc_has_avx512 + cflags += '-DCC_AVX512_SUPPORT' + avx512_args = [cflags, cflags_avx512, cc_avx512_flags] + if not target_has_avx512 and cc.has_argument('-march=skylake-avx512') + avx512_args += '-march=skylake-avx512' + if cc.has_argument('-Wno-overriding-option') + avx512_args += '-Wno-overriding-option' + endif + endif + avx512_lib = static_library(libname + '_avx512_lib', + sources_avx512, + dependencies: static_deps, + include_directories: includes, + c_args: avx512_args) + objs += avx512_lib.extract_objects(sources_avx512) + endif + endif + + + # build static lib static_lib = static_library(libname, sources, objects: objs, -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 07/11] acl: use common AVX build handling 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson ` (5 preceding siblings ...) 2025-03-19 17:29 ` [PATCH v4 06/11] lib: add generalized AVX build handling Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 08/11] fib: " Bruce Richardson ` (4 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Konstantin Ananyev remove custom logic for building AVX2 and AVX-512 files. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/acl/meson.build | 54 ++++----------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/lib/acl/meson.build b/lib/acl/meson.build index a80c172812..87e9f25f8e 100644 --- a/lib/acl/meson.build +++ b/lib/acl/meson.build @@ -15,57 +15,11 @@ headers = files('rte_acl.h', 'rte_acl_osdep.h') if dpdk_conf.has('RTE_ARCH_X86') sources += files('acl_run_sse.c') - - avx2_tmplib = static_library('avx2_tmp', - 'acl_run_avx2.c', - dependencies: static_rte_eal, - c_args: [cflags, cc_avx2_flags]) - objs += avx2_tmplib.extract_objects('acl_run_avx2.c') - - # compile AVX512 version if: - # we are building 64-bit binary AND binutils can generate proper code - - if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok - - # compile AVX512 version if either: - # a. we have AVX512 supported in minimum instruction set - # baseline - # b. it's not minimum instruction set, but supported by - # compiler - # - # in former case, just add avx512 C file to files list - # in latter case, compile c file to static lib, using correct - # compiler flags, and then have the .o file from static lib - # linked into main lib. - - # check if all required flags already enabled (variant a). - acl_avx512_flags = ['__AVX512F__', '__AVX512VL__', - '__AVX512CD__', '__AVX512BW__'] - - acl_avx512_on = true - foreach f:acl_avx512_flags - - if cc.get_define(f, args: machine_args) == '' - acl_avx512_on = false - endif - endforeach - - if acl_avx512_on == true - - sources += files('acl_run_avx512.c') - cflags += '-DCC_AVX512_SUPPORT' - - elif cc_has_avx512 - avx512_tmplib = static_library('avx512_tmp', - 'acl_run_avx512.c', - dependencies: static_rte_eal, - c_args: cflags + cc_avx512_flags) - objs += avx512_tmplib.extract_objects( - 'acl_run_avx512.c') - cflags += '-DCC_AVX512_SUPPORT' - endif + sources_avx2 += files('acl_run_avx2.c') + # AVX512 is only supported on 64-bit builds + if dpdk_conf.has('RTE_ARCH_X86_64') + sources_avx512 += files('acl_run_avx512.c') endif - elif dpdk_conf.has('RTE_ARCH_ARM') cflags += '-flax-vector-conversions' sources += files('acl_run_neon.c') -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 08/11] fib: use common AVX build handling 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson ` (6 preceding siblings ...) 2025-03-19 17:29 ` [PATCH v4 07/11] acl: use common " Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 09/11] net: simplify build-time logic for x86 Bruce Richardson ` (3 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Vladimir Medvedkin Remove custom logic for building AVX2 and AVX-512 files. Within the C code this requires some renaming of build macros to use the standard defines. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/fib/dir24_8.c | 6 +++--- lib/fib/meson.build | 18 +----------------- lib/fib/trie.c | 6 +++--- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/lib/fib/dir24_8.c b/lib/fib/dir24_8.c index c48d962d41..2ba7e93511 100644 --- a/lib/fib/dir24_8.c +++ b/lib/fib/dir24_8.c @@ -16,11 +16,11 @@ #include "dir24_8.h" #include "fib_log.h" -#ifdef CC_DIR24_8_AVX512_SUPPORT +#ifdef CC_AVX512_SUPPORT #include "dir24_8_avx512.h" -#endif /* CC_DIR24_8_AVX512_SUPPORT */ +#endif /* CC_AVX512_SUPPORT */ #define DIR24_8_NAMESIZE 64 @@ -63,7 +63,7 @@ get_scalar_fn_inlined(enum rte_fib_dir24_8_nh_sz nh_sz, bool be_addr) static inline rte_fib_lookup_fn_t get_vector_fn(enum rte_fib_dir24_8_nh_sz nh_sz, bool be_addr) { -#ifdef CC_DIR24_8_AVX512_SUPPORT +#ifdef CC_AVX512_SUPPORT if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) <= 0 || rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512DQ) <= 0 || rte_vect_get_max_simd_bitwidth() < RTE_VECT_SIMD_512) diff --git a/lib/fib/meson.build b/lib/fib/meson.build index 0c19cc8201..55d9ddcee9 100644 --- a/lib/fib/meson.build +++ b/lib/fib/meson.build @@ -15,21 +15,5 @@ deps += ['rcu'] deps += ['net'] if dpdk_conf.has('RTE_ARCH_X86_64') - if target_has_avx512 - cflags += ['-DCC_DIR24_8_AVX512_SUPPORT', '-DCC_TRIE_AVX512_SUPPORT'] - sources += files('dir24_8_avx512.c', 'trie_avx512.c') - - elif cc_has_avx512 - cflags += ['-DCC_DIR24_8_AVX512_SUPPORT', '-DCC_TRIE_AVX512_SUPPORT'] - dir24_8_avx512_tmp = static_library('dir24_8_avx512_tmp', - 'dir24_8_avx512.c', - dependencies: [static_rte_eal, static_rte_rcu], - c_args: cflags + cc_avx512_flags) - objs += dir24_8_avx512_tmp.extract_objects('dir24_8_avx512.c') - trie_avx512_tmp = static_library('trie_avx512_tmp', - 'trie_avx512.c', - dependencies: [static_rte_eal, static_rte_rcu, static_rte_net], - c_args: cflags + cc_avx512_flags) - objs += trie_avx512_tmp.extract_objects('trie_avx512.c') - endif + sources_avx512 = files('dir24_8_avx512.c', 'trie_avx512.c') endif diff --git a/lib/fib/trie.c b/lib/fib/trie.c index 4893f6c636..6c20057ac5 100644 --- a/lib/fib/trie.c +++ b/lib/fib/trie.c @@ -14,11 +14,11 @@ #include <rte_fib6.h> #include "trie.h" -#ifdef CC_TRIE_AVX512_SUPPORT +#ifdef CC_AVX512_SUPPORT #include "trie_avx512.h" -#endif /* CC_TRIE_AVX512_SUPPORT */ +#endif /* CC_AVX512_SUPPORT */ #define TRIE_NAMESIZE 64 @@ -45,7 +45,7 @@ get_scalar_fn(enum rte_fib_trie_nh_sz nh_sz) static inline rte_fib6_lookup_fn_t get_vector_fn(enum rte_fib_trie_nh_sz nh_sz) { -#ifdef CC_TRIE_AVX512_SUPPORT +#ifdef CC_AVX512_SUPPORT if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) <= 0 || rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512DQ) <= 0 || rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) <= 0 || -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 09/11] net: simplify build-time logic for x86 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson ` (7 preceding siblings ...) 2025-03-19 17:29 ` [PATCH v4 08/11] fib: " Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 10/11] net: use common AVX512 build code Bruce Richardson ` (2 subsequent siblings) 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Jasvinder Singh All DPDK-supported versions of clang and gcc have the "-mpclmul" and "-maes" flags, so we never need to check for those. This allows the SSE code path to be unconditionally built on x86. For the AVX512 code path, simplify it by only checking for the build-time support, and always doing a separate build with AVX512 support when that compiler support is present. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/net/meson.build | 52 +++++-------------------------------------- lib/net/rte_net_crc.c | 8 +++---- 2 files changed, 9 insertions(+), 51 deletions(-) diff --git a/lib/net/meson.build b/lib/net/meson.build index c9b34afc98..cd49b4d758 100644 --- a/lib/net/meson.build +++ b/lib/net/meson.build @@ -42,57 +42,15 @@ deps += ['mbuf'] use_function_versioning = true if dpdk_conf.has('RTE_ARCH_X86_64') - net_crc_sse42_cpu_support = (cc.get_define('__PCLMUL__', args: machine_args) != '') - net_crc_avx512_cpu_support = ( - target_has_avx512 and - cc.get_define('__VPCLMULQDQ__', args: machine_args) != '' - ) - - net_crc_sse42_cc_support = (cc.has_argument('-mpclmul') and cc.has_argument('-maes')) - net_crc_avx512_cc_support = (cc.has_argument('-mvpclmulqdq') and cc_has_avx512) - - build_static_net_crc_sse42_lib = 0 - build_static_net_crc_avx512_lib = 0 - - if net_crc_sse42_cpu_support == true - sources += files('net_crc_sse.c') - cflags += ['-DCC_X86_64_SSE42_PCLMULQDQ_SUPPORT'] - if net_crc_avx512_cpu_support == true - sources += files('net_crc_avx512.c') - cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] - elif net_crc_avx512_cc_support == true - build_static_net_crc_avx512_lib = 1 - net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq'] - cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] - endif - elif net_crc_sse42_cc_support == true - build_static_net_crc_sse42_lib = 1 - net_crc_sse42_lib_cflags = ['-mpclmul', '-maes'] - cflags += ['-DCC_X86_64_SSE42_PCLMULQDQ_SUPPORT'] - if net_crc_avx512_cc_support == true - build_static_net_crc_avx512_lib = 1 - net_crc_avx512_lib_cflags = cc_avx512_flags + ['-mvpclmulqdq', '-mpclmul'] - cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] - endif - endif - - if build_static_net_crc_sse42_lib == 1 - net_crc_sse42_lib = static_library( - 'net_crc_sse42_lib', - 'net_crc_sse.c', - dependencies: static_rte_eal, - c_args: [cflags, - net_crc_sse42_lib_cflags]) - objs += net_crc_sse42_lib.extract_objects('net_crc_sse.c') - endif - - if build_static_net_crc_avx512_lib == 1 + sources += files('net_crc_sse.c') + cflags += ['-mpclmul', '-maes'] + if cc.has_argument('-mvpclmulqdq') and cc_has_avx512 + cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] net_crc_avx512_lib = static_library( 'net_crc_avx512_lib', 'net_crc_avx512.c', dependencies: static_rte_eal, - c_args: [cflags, - net_crc_avx512_lib_cflags]) + c_args: [cflags, cc_avx512_flags, '-mvpclmulqdq']) objs += net_crc_avx512_lib.extract_objects('net_crc_avx512.c') endif diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c index 2fb3eec231..c9773d6300 100644 --- a/lib/net/rte_net_crc.c +++ b/lib/net/rte_net_crc.c @@ -66,7 +66,7 @@ static const rte_net_crc_handler handlers_avx512[] = { [RTE_NET_CRC32_ETH] = rte_crc32_eth_avx512_handler, }; #endif -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT +#ifdef RTE_ARCH_X86_64 static const rte_net_crc_handler handlers_sse42[] = { [RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_sse42_handler, [RTE_NET_CRC32_ETH] = rte_crc32_eth_sse42_handler, @@ -211,7 +211,7 @@ avx512_vpclmulqdq_init(void) static const rte_net_crc_handler * sse42_pclmulqdq_get_handlers(void) { -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT +#ifdef RTE_ARCH_X86_64 if (SSE42_PCLMULQDQ_CPU_SUPPORTED && max_simd_bitwidth >= RTE_VECT_SIMD_128) return handlers_sse42; @@ -223,7 +223,7 @@ sse42_pclmulqdq_get_handlers(void) static void sse42_pclmulqdq_init(void) { -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT +#ifdef RTE_ARCH_x86_64 if (SSE42_PCLMULQDQ_CPU_SUPPORTED) rte_net_crc_sse42_init(); #endif @@ -316,7 +316,7 @@ handlers_init(enum rte_net_crc_alg alg) #endif /* fall-through */ case RTE_NET_CRC_SSE42: -#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT +#ifdef RTE_ARCH_X86_64 if (SSE42_PCLMULQDQ_CPU_SUPPORTED) { handlers_dpdk26[alg].f[RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_sse42_handler; -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 10/11] net: use common AVX512 build code 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson ` (8 preceding siblings ...) 2025-03-19 17:29 ` [PATCH v4 09/11] net: simplify build-time logic for x86 Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 11/11] member: use common AVX512 build support Bruce Richardson 2025-03-19 18:08 ` [PATCH v4 00/11] remove component-specific logic for AVX builds Bruce Richardson 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Jasvinder Singh Use the common support for AVX512 code present in lib/meson.build, rather than hard-coding it. The only complication is an extra check for the "-mvpclmulqdq" command-line flag before adding the AVX512 sources. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/net/meson.build | 12 ++++-------- lib/net/rte_net_crc.c | 8 ++++---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/net/meson.build b/lib/net/meson.build index cd49b4d758..7a6c419f40 100644 --- a/lib/net/meson.build +++ b/lib/net/meson.build @@ -44,14 +44,10 @@ use_function_versioning = true if dpdk_conf.has('RTE_ARCH_X86_64') sources += files('net_crc_sse.c') cflags += ['-mpclmul', '-maes'] - if cc.has_argument('-mvpclmulqdq') and cc_has_avx512 - cflags += ['-DCC_X86_64_AVX512_VPCLMULQDQ_SUPPORT'] - net_crc_avx512_lib = static_library( - 'net_crc_avx512_lib', - 'net_crc_avx512.c', - dependencies: static_rte_eal, - c_args: [cflags, cc_avx512_flags, '-mvpclmulqdq']) - objs += net_crc_avx512_lib.extract_objects('net_crc_avx512.c') + # only build AVX-512 support if we also have PCLMULQDQ support + if cc.has_argument('-mvpclmulqdq') + sources_avx512 += files('net_crc_avx512.c') + cflags_avx512 += ['-mvpclmulqdq'] endif elif (dpdk_conf.has('RTE_ARCH_ARM64') and diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c index c9773d6300..24ec267fc8 100644 --- a/lib/net/rte_net_crc.c +++ b/lib/net/rte_net_crc.c @@ -60,7 +60,7 @@ static const rte_net_crc_handler handlers_scalar[] = { [RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_handler, [RTE_NET_CRC32_ETH] = rte_crc32_eth_handler, }; -#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT +#ifdef CC_AVX512_SUPPORT static const rte_net_crc_handler handlers_avx512[] = { [RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_avx512_handler, [RTE_NET_CRC32_ETH] = rte_crc32_eth_avx512_handler, @@ -185,7 +185,7 @@ rte_crc32_eth_handler(const uint8_t *data, uint32_t data_len) static const rte_net_crc_handler * avx512_vpclmulqdq_get_handlers(void) { -#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT +#ifdef CC_AVX512_SUPPORT if (AVX512_VPCLMULQDQ_CPU_SUPPORTED && max_simd_bitwidth >= RTE_VECT_SIMD_512) return handlers_avx512; @@ -197,7 +197,7 @@ avx512_vpclmulqdq_get_handlers(void) static void avx512_vpclmulqdq_init(void) { -#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT +#ifdef CC_AVX512_SUPPORT if (AVX512_VPCLMULQDQ_CPU_SUPPORTED) rte_net_crc_avx512_init(); #endif @@ -305,7 +305,7 @@ handlers_init(enum rte_net_crc_alg alg) switch (alg) { case RTE_NET_CRC_AVX512: -#ifdef CC_X86_64_AVX512_VPCLMULQDQ_SUPPORT +#ifdef CC_AVX512_SUPPORT if (AVX512_VPCLMULQDQ_CPU_SUPPORTED) { handlers_dpdk26[alg].f[RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_avx512_handler; -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH v4 11/11] member: use common AVX512 build support 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson ` (9 preceding siblings ...) 2025-03-19 17:29 ` [PATCH v4 10/11] net: use common AVX512 build code Bruce Richardson @ 2025-03-19 17:29 ` Bruce Richardson 2025-03-19 18:08 ` [PATCH v4 00/11] remove component-specific logic for AVX builds Bruce Richardson 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 17:29 UTC (permalink / raw) To: dev; +Cc: david.marchand, Bruce Richardson, Yipeng Wang, Sameh Gobriel Use the support for building AVX512 code present in lib/meson.build rather than reimplementing it in the library meson.build file. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/member/meson.build | 46 +++++++----------------------------------- 1 file changed, 7 insertions(+), 39 deletions(-) diff --git a/lib/member/meson.build b/lib/member/meson.build index 4341b424df..07f9afaed9 100644 --- a/lib/member/meson.build +++ b/lib/member/meson.build @@ -20,44 +20,12 @@ sources = files( deps += ['hash', 'ring'] -# compile AVX512 version if: -if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok - # compile AVX512 version if either: - # a. we have AVX512 supported in minimum instruction set - # baseline - # b. it's not minimum instruction set, but supported by - # compiler - # - # in former case, just add avx512 C file to files list - # in latter case, compile c file to static lib, using correct - # compiler flags, and then have the .o file from static lib - # linked into main lib. - - member_avx512_args = cc_avx512_flags - if not is_ms_compiler - member_avx512_args += '-mavx512ifma' - endif - - # check if all required flags already enabled - sketch_avx512_flags = ['__AVX512F__', '__AVX512DQ__', '__AVX512IFMA__'] - - sketch_avx512_on = true - foreach f:sketch_avx512_flags - if cc.get_define(f, args: machine_args) == '' - sketch_avx512_on = false - endif - endforeach - - if sketch_avx512_on == true - cflags += ['-DCC_AVX512_SUPPORT'] - sources += files('rte_member_sketch_avx512.c') - elif cc.has_multi_arguments(member_avx512_args) - sketch_avx512_tmp = static_library('sketch_avx512_tmp', - 'rte_member_sketch_avx512.c', - include_directories: includes, - dependencies: [static_rte_eal, static_rte_hash], - c_args: cflags + member_avx512_args) - objs += sketch_avx512_tmp.extract_objects('rte_member_sketch_avx512.c') - cflags += ['-DCC_AVX512_SUPPORT'] +# compile AVX512 version if we have avx512 on MSVC or the 'ifma' flag on GCC/Clang +if dpdk_conf.has('RTE_ARCH_X86_64') + if is_ms_compiler + sources_avx512 += files('rte_member_sketch_avx512.c') + elif cc.has_argument('-mavx512ifma') + sources_avx512 += files('rte_member_sketch_avx512.c') + cflags_avx512 += '-mavx512ifma' endif endif -- 2.43.0 ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH v4 00/11] remove component-specific logic for AVX builds 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson ` (10 preceding siblings ...) 2025-03-19 17:29 ` [PATCH v4 11/11] member: use common AVX512 build support Bruce Richardson @ 2025-03-19 18:08 ` Bruce Richardson 11 siblings, 0 replies; 48+ messages in thread From: Bruce Richardson @ 2025-03-19 18:08 UTC (permalink / raw) To: dev; +Cc: david.marchand On Wed, Mar 19, 2025 at 05:29:30PM +0000, Bruce Richardson wrote: > A number of libs and drivers had special optimized AVX2 and AVX512 code > paths for performance reasons, and these tended to have copy-pasted > logic to build those files. Centralise that logic in the main > drivers/ and lib/ meson.build files to avoid duplication. > > v4: rebase on latest main branch > minor fixes following feedback > limit use of -march=skylake-avx512 to when we don't already have a > -march flag supporting AVX512. > v3: add patch for event/dlb2 AVX512 handling. > add common code for libraries as well as drivers. > v2: add patch 4 to remove use of unnecessary CC_AVX2_SUPPORT flag > A related follow-up to this patchset. Checking with "godbolt.org", it appears that both clang 3.6[1] and gcc 5[2] (the minimum called out compiler versions in our docs[1]) support the set of AVX-512 compiler flags we use. Therefore, it seems we can simplify our code further by removing the "cc_has_avx512" variable. /Bruce PS: I'd also note that these minimum versions look to be ~10-year old versions of compilers. I would expect end users to actually be using more modern releases that these. Maybe we should look to update our compiler minimum versions.... [1] https://godbolt.org/z/Ys9K6axMf [2] https://godbolt.org/z/v6WP7d6Pf [3] https://doc.dpdk.org/guides/linux_gsg/sys_reqs.html#compilation-of-the-dpdk ^ permalink raw reply [flat|nested] 48+ messages in thread
end of thread, other threads:[~2025-03-19 18:09 UTC | newest] Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-03-14 17:23 [PATCH 0/3] remove driver-specific logic for AVX builds Bruce Richardson 2025-03-14 17:23 ` [PATCH 1/3] build: add generalized AVX handling for drivers Bruce Richardson 2025-03-14 17:23 ` [PATCH 2/3] net/intel: use common AVX build code Bruce Richardson 2025-03-14 17:23 ` [PATCH 3/3] drivers/net: build use common AVX handling Bruce Richardson 2025-03-14 17:31 ` David Marchand 2025-03-14 17:37 ` Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 1/4] build: add generalized AVX handling for drivers Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 2/4] net/intel: use common AVX build code Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 3/4] drivers/net: build use common AVX handling Bruce Richardson 2025-03-14 17:44 ` [PATCH v2 4/4] drivers/net: remove AVX2 build-time define Bruce Richardson 2025-03-17 9:47 ` David Marchand 2025-03-17 9:50 ` [PATCH v2 0/4] remove driver-specific logic for AVX builds David Marchand 2025-03-18 11:51 ` Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 00/11] remove component-specific " Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 01/11] build: add generalized AVX handling for drivers Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 02/11] net/intel: use common AVX build code Bruce Richardson 2025-03-19 10:11 ` David Marchand 2025-03-19 11:17 ` Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 03/11] drivers/net: build use common AVX handling Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 04/11] drivers/net: remove AVX2 build-time define Bruce Richardson 2025-03-18 17:42 ` Ajit Khaparde 2025-03-18 17:34 ` [PATCH v3 05/11] event/dlb2: build using common AVX handling Bruce Richardson 2025-03-18 17:34 ` [PATCH v3 06/11] build: add generalized AVX handling for libs Bruce Richardson 2025-03-18 17:35 ` [PATCH v3 07/11] acl: use common AVX build handling Bruce Richardson 2025-03-19 10:16 ` David Marchand 2025-03-19 10:26 ` Bruce Richardson 2025-03-19 10:40 ` David Marchand 2025-03-19 10:59 ` Bruce Richardson 2025-03-18 17:35 ` [PATCH v3 08/11] fib: " Bruce Richardson 2025-03-18 17:35 ` [PATCH v3 09/11] net: simplify build-time logic for x86 Bruce Richardson 2025-03-19 10:24 ` David Marchand 2025-03-18 17:35 ` [PATCH v3 10/11] net: use common AVX512 build code Bruce Richardson 2025-03-18 17:35 ` [PATCH v3 11/11] member: use common AVX512 build support Bruce Richardson 2025-03-19 10:27 ` [PATCH v3 00/11] remove component-specific logic for AVX builds David Marchand 2025-03-19 17:29 ` [PATCH v4 " Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 01/11] drivers: add generalized AVX build handling Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 02/11] net/intel: use common AVX build code Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 03/11] drivers/net: build use common AVX handling Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 04/11] drivers/net: remove AVX2 build-time define Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 05/11] event/dlb2: build using common AVX handling Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 06/11] lib: add generalized AVX build handling Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 07/11] acl: use common " Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 08/11] fib: " Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 09/11] net: simplify build-time logic for x86 Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 10/11] net: use common AVX512 build code Bruce Richardson 2025-03-19 17:29 ` [PATCH v4 11/11] member: use common AVX512 build support Bruce Richardson 2025-03-19 18:08 ` [PATCH v4 00/11] remove component-specific logic for AVX builds Bruce Richardson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).