add max SIMD bitwidth to EAL
cover add max SIMD bitwidth to EAL
A number of components in DPDK have optional AVX-512 or other vector code paths which can be selected at runtime. Rather than having each component provide its own mechanism to select a code path, this patchset adds support for a single setting to control what code paths are used. This can be used to enable some non-default code paths e.g. ones using AVX-512, but also to limit the code paths to certain vector widths, or to scalar code only, which is useful for testing.
The max SIMD bitwidth setting can be set by the app itself through use of the available API, or can be overriden by a commandline argument passed by the user.
Ciara Power (12):
eal: add max SIMD bitwidth
eal: add default SIMD bitwidth values
net/i40e: add checks for max SIMD bitwidth
net/axgbe: add checks for max SIMD bitwidth
net/bnxt: add checks for max SIMD bitwidth
net/enic: add checks for max SIMD bitwidth
net/fm10k: add checks for max SIMD bitwidth
net/iavf: add checks for max SIMD bitwidth
net/ice: add checks for max SIMD bitwidth
net/ixgbe: add checks for max SIMD bitwidth
net/mlx5: add checks for max SIMD bitwidth
net/virtio: add checks for max SIMD bitwidth
drivers/net/axgbe/axgbe_rxtx.c | 3 +- drivers/net/bnxt/bnxt_ethdev.c | 6 ++- drivers/net/enic/enic_rxtx_vec_avx2.c | 3 +- drivers/net/fm10k/fm10k_ethdev.c | 11 ++-- drivers/net/i40e/i40e_rxtx.c | 19 ++++--- drivers/net/iavf/iavf_rxtx.c | 16 +++--- drivers/net/ice/ice_rxtx.c | 20 ++++--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 ++- drivers/net/mlx5/mlx5_ethdev.c | 3 +- drivers/net/virtio/virtio_ethdev.c | 12 +++-- lib/librte_eal/arm/include/rte_vect.h | 2 + lib/librte_eal/common/eal_common_options.c | 63 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/generic/rte_vect.h | 2 + lib/librte_eal/include/rte_eal.h | 31 +++++++++++ lib/librte_eal/ppc/include/rte_vect.h | 2 + lib/librte_eal/rte_eal_version.map | 4 ++ lib/librte_eal/x86/include/rte_vect.h | 2 + 19 files changed, 184 insertions(+), 32 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/12 eal: add max SIMD bitwidth
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
--- lib/librte_eal/common/eal_common_options.c | 60 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 31 +++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 105 insertions(+)
lib/librte_eal/common/eal_common_options.c +60 -0
@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };
@@ -1309,6 +1310,32 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) +{ +char *end; +uint16_t bitwidth; +int ret; +struct internal_config *internal_conf = +eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ; + + errno =0 ; + bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if ((errno !=0 ) || end ==NULL || (*end !='\0' )) +return -1 ; + + ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; + internal_conf->max_simd_bitwidth.locked = locked; +return 0 ; +} +static int eal_parse_base_virtaddr (const char *arg) {
@@ -1707,6 +1734,13 @@ eal_parse_common_option(int opt, const char *optarg,case OPT_NO_TELEMETRY_NUM : conf->no_telemetry =1 ;break ; +case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) { +RTE_LOG (ERR ,EAL ,"invalid parameter for --" +OPT_FORCE_MAX_SIMD_BITWIDTH "\n" ); +return -1 ; + } +break ;/* don't know what to do, leave this to caller */ default :
@@ -1903,6 +1937,31 @@ eal_check_common_options(struct internal_config *internal_cfg)return 0 ; } +uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +} + +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) +{ +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { +RTE_LOG (NOTICE ,EAL ,"Cannot set max SIMD bitwidth - user runtime override enabled" ); +return -EPERM ; + } +if (bitwidth <RTE_NO_SIMD || !rte_is_power_of_2 (bitwidth)) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +} +void eal_common_usage (void ) {
@@ -1981,6 +2040,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --" OPT_TELEMETRY " Enable telemetry support (on by default)\n" " --" OPT_NO_TELEMETRY " Disable telemetry support\n" +" --" OPT_FORCE_MAX_SIMD_BITWIDTH " Force the max SIMD bitwidth\n" "\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n"
lib/librte_eal/common/eal_internal_cfg.h +8 -0
@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ +}; +/** * internal configuration */
@@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth; };void eal_reset_internal_config (struct internal_config *internal_cfg);
lib/librte_eal/common/eal_options.h +2 -0
@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };
lib/librte_eal/include/rte_eal.h +31 -0
@@ -43,6 +43,13 @@ enum rte_proc_type_t { RTE_PROC_INVALID }; +enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 +}; +/** * Get the process type in a multi-process setup *
@@ -51,6 +58,30 @@ enum rte_proc_type_t {*/ enum rte_proc_type_t rte_eal_process_type (void ); +/** +* Get the supported SIMD bitwidth. +* +* @return +* uint16_t bitwidth. +*/ +__rte_experimental +uint16_t rte_get_max_simd_bitwidth(void); + +/** +* Set the supported SIMD bitwidth. +* +* @param bitwidth +* uint16_t bitwidth. +* @return +* 0 on success. +* @return +* -EINVAL on invalid bitwidth parameter. +* @return +* -EPERM if bitwidth is locked. +*/ +__rte_experimental +int rte_set_max_simd_bitwidth(uint16_t bitwidth); +/** * Request iopl privilege for all RPL. *
lib/librte_eal/rte_eal_version.map +4 -0
@@ -403,6 +403,10 @@ EXPERIMENTAL { rte_mp_disable; rte_thread_register; rte_thread_unregister; + + # added in 20.11 + rte_get_max_simd_bitwidth; + rte_set_max_simd_bitwidth; }; INTERNAL {
Signature · 1 line
2.17.1
PATCH 2/12 eal: add default SIMD bitwidth values
In reply to Ciara PowerEach arch has a define for the default SIMD bitwidth value, this is used on EAL init to set the config max SIMD bitwidth.
--- lib/librte_eal/arm/include/rte_vect.h | 2 ++ lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/include/generic/rte_vect.h | 2 ++ lib/librte_eal/ppc/include/rte_vect.h | 2 ++ lib/librte_eal/x86/include/rte_vect.h | 2 ++ 5 files changed, 11 insertions(+)
lib/librte_eal/arm/include/rte_vect.h +2 -0
@@ -14,6 +14,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +typedef int32x4_t xmm_t ;#define XMM_SIZE (sizeof(xmm_t))
lib/librte_eal/common/eal_common_options.c +3 -0
@@ -35,6 +35,7 @@#ifndef RTE_EXEC_ENV_WINDOWS #include <rte_telemetry.h> #endif +#include <rte_vect.h> #include "eal_internal_cfg.h" #include "eal_options.h"
@@ -344,6 +345,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg) internal_cfg->user_mbuf_pool_ops_name =NULL ;CPU_ZERO (&internal_cfg->ctrl_cpuset); internal_cfg->init_complete =0 ; + internal_cfg->max_simd_bitwidth.bitwidth =RTE_DEFAULT_SIMD_BITWIDTH ; + internal_cfg->max_simd_bitwidth.locked =0 ; } static int
lib/librte_eal/include/generic/rte_vect.h +2 -0
@@ -14,6 +14,8 @@#include <stdint.h> +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +/* Unsigned vector types */ /**
lib/librte_eal/ppc/include/rte_vect.h +2 -0
@@ -15,6 +15,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 + typedef vector signed int xmm_t;#define XMM_SIZE (sizeof(xmm_t))
lib/librte_eal/x86/include/rte_vect.h +2 -0
@@ -35,6 +35,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +typedef __m128i xmm_t ;#define XMM_SIZE (sizeof(xmm_t))
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 20.11 02/12] eal: add default SIMD bitwidth values
Quoted 2 lines · Ciara Power
Each arch has a define for the default SIMD bitwidth value, this is used on EAL init to set the config max SIMD bitwidth.
What's the intended use case?
Quoted 41 lines
Cc Ruifeng Wang <[email protected]>Cc Jerin Jacob <[email protected]>Cc Honnappa Nagarahalli <[email protected]>Cc David Christensen <[email protected]>Signed-off-by Ciara Power <[email protected]>--- lib/librte_eal/arm/include/rte_vect.h | 2 ++ lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/include/generic/rte_vect.h | 2 ++ lib/librte_eal/ppc/include/rte_vect.h | 2 ++ lib/librte_eal/x86/include/rte_vect.h | 2 ++ 5 files changed, 11 insertions(+)lib/librte_eal/arm/include/rte_vect.h +2
-0@@ -14,6 +14,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +typedef int32x4_t xmm_t ;#define XMM_SIZE (sizeof(xmm_t))lib/librte_eal/common/eal_common_options.c +1
-0@@ -35,6 +35,7 @@#ifndef RTE_EXEC_ENV_WINDOWS #include <rte_telemetry.h> #endif +#include <rte_vect.h> #include "eal_internal_cfg.h" #include "eal_options.h"
lib/librte_eal/common/eal_common_options.c eal_reset_internal_config(struct internal_config *internal_cfg) · line 350
Quoted 6 lines
lib/librte_eal/common/eal_common_options.c +2
-0@@ -344,6 +345,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg) internal_cfg->user_mbuf_pool_ops_name =NULL ;CPU_ZERO (&internal_cfg->ctrl_cpuset); internal_cfg->init_complete =0 ; + internal_cfg->max_simd_bitwidth.bitwidth =RTE_DEFAULT_SIMD_BITWIDTH ; + internal_cfg->max_simd_bitwidth.locked =0 ; }
Build error on HEAD:
../lib/librte_eal/common/eal_common_options.c: In function ‘eal_reset_internal_config’:../lib/librte_eal/common/eal_common_options.c:347:14: error: ‘struct internal_config’ has no member named ‘max_simd_bitwidth’
internal_cfg->max_simd_bitwidth.bitwidth = RTE_DEFAULT_SIMD_BITWIDTH;
^~
../lib/librte_eal/common/eal_common_options.c:348:14: error: ‘struct internal_config’ has no member named ‘max_simd_bitwidth’
internal_cfg->max_simd_bitwidth.locked = 0;
^~Dave
Re: [dpdk-dev] [PATCH 20.11 02/12] eal: add default SIMD bitwidth values
Quoted 58 lines · David Christensen
Quoted 2 lines · Ciara Power
Each arch has a define for the default SIMD bitwidth value, this is used on EAL init to set the config max SIMD bitwidth.
What's the intended use case?
Quoted 41 lines
Cc Ruifeng Wang <[email protected]>Cc Jerin Jacob <[email protected]>Cc Honnappa Nagarahalli <[email protected]>Cc David Christensen <[email protected]>Signed-off-by Ciara Power <[email protected]>---
lib/librte_eal/arm/include/rte_vect.h | 2 ++lib/librte_eal/common/eal_common_options.c| 3 +++ lib/librte_eal/include/generic/rte_vect.h | 2 ++ lib/librte_eal/ppc/include/rte_vect.h | 2 ++ lib/librte_eal/x86/include/rte_vect.h | 2 ++5 files changed, 11 insertions(+)lib/librte_eal/arm/include/rte_vect.h +2
-0@@ -14,6 +14,8 @@ extern "C" { #endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 + typedef int32x4_t xmm_t; #define XMM_SIZE (sizeof(xmm_t))lib/librte_eal/common/eal_common_options.c +1
-0@@ -35,6 +35,7 @@ #ifndef RTE_EXEC_ENV_WINDOWS #include <rte_telemetry.h> #endif +#include <rte_vect.h> #include "eal_internal_cfg.h" #include "eal_options.h"lib/librte_eal/common/eal_common_options.c eal_reset_internal_config(struct internal_config · line 352
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +2
-0@@ -344,6 +345,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg) internal_cfg->user_mbuf_pool_ops_name = NULL; CPU_ZERO(&internal_cfg->ctrl_cpuset); internal_cfg->init_complete = 0; + internal_cfg->max_simd_bitwidth.bitwidth =RTE_DEFAULT_SIMD_BITWIDTH ; + internal_cfg->max_simd_bitwidth.locked = 0; }Build error on HEAD:
Quoted 7 lines
../lib/librte_eal/common/eal_common_options.c: In function ‘eal_reset_internal_config’:../lib/librte_eal/common/eal_common_options.c:347:14: error: ‘struct internal_config’ has no member named ‘max_simd_bitwidth’
internal_cfg->max_simd_bitwidth.bitwidth=RTE_DEFAULT_SIMD_BITWIDTH;
^~../lib/librte_eal/common/eal_common_options.c:348:14: error: ‘struct internal_config’ has no member named ‘max_simd_bitwidth’
internal_cfg->max_simd_bitwidth.locked= 0;
^~
Sorry, jumped the gun when testing the patch, missed the preceeding patch.
Dave
Re: [dpdk-dev] [PATCH 20.11 02/12] eal: add default SIMD bitwidth values
In reply to David ChristensenHi David,
Quoted 9 lines
-----Original Message-----
From: David Christensen <[email protected]>
Sent: Friday 7 August 2020 17:32
To: Power, Ciara <[email protected]>; [email protected]
Cc: Richardson, Bruce <[email protected]>; Ruifeng Wang <[email protected]>; Jerin Jacob <[email protected]>; Honnappa Nagarahalli <[email protected]>
Subject: Re: [PATCH 20.11 02/12] eal: add default SIMD bitwidth values
Quoted 5 lines
Quoted 2 lines · Ciara Power
Each arch has a define for the default SIMD bitwidth value, this is used on EAL init to set the config max SIMD bitwidth.
What's the intended use case?
- For x86, it allows other apps such as OVS and VPP which already make use of AVX-512 to indicate that they are happy for DPDK to use AVX-512 too.
- It allows the end-user to override those settings if so desired.
- For all architectures, it allows an easy way to disable vector code or limit vector length if so desired, which can be useful for testing.
<snip>
Thanks,
Ciara
Re: [dpdk-dev] [PATCH 20.11 02/12] eal: add default SIMD bitwidth values
In reply to Ciara PowerQuoted 34 lines
-----Original Message-----
From: Ciara Power <[email protected]>
Sent: Friday, August 7, 2020 11:59 PM
To: [email protected]
Cc: [email protected]; Ciara Power <[email protected]>; Ruifeng Wang <[email protected]>; [email protected]; Honnappa Nagarahalli <[email protected]>; David Christensen <[email protected]>
Subject: [PATCH 20.11 02/12] eal: add default SIMD bitwidth valuesEach arch has a define for the default SIMD bitwidth value, this is used on EAL init to set the config max SIMD bitwidth.
Cc Ruifeng Wang <[email protected]>Cc Jerin Jacob <[email protected]>Cc Honnappa Nagarahalli <[email protected]>Cc David Christensen <[email protected]>Signed-off-by Ciara Power <[email protected]>--- lib/librte_eal/arm/include/rte_vect.h | 2 ++ lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/include/generic/rte_vect.h | 2 ++ lib/librte_eal/ppc/include/rte_vect.h | 2 ++ lib/librte_eal/x86/include/rte_vect.h | 2 ++ 5 files changed, 11 insertions(+)lib/librte_eal/arm/include/rte_vect.h +0
-0
lib/librte_eal/arm/include/rte_vect.h line 17
Quoted 4 lines
lib/librte_eal/arm/include/rte_vect.h +1
-0@@ -14,6 +14,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256
I think for arm platform we should set it to '128'. It is the bit width of NEON registers.
Quoted 72 lines
lib/librte_eal/arm/include/rte_vect.h +1
-0+typedef int32x4_t xmm_t ;#define XMM_SIZE (sizeof(xmm_t))lib/librte_eal/common/eal_common_options.c +3
-0@@ -35,6 +35,7 @@#ifndef RTE_EXEC_ENV_WINDOWS #include <rte_telemetry.h> #endif +#include <rte_vect.h> #include "eal_internal_cfg.h" #include "eal_options.h" @@ -344,6 +345,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg) internal_cfg->user_mbuf_pool_ops_name =NULL ;CPU_ZERO (&internal_cfg->ctrl_cpuset); internal_cfg->init_complete =0 ; + internal_cfg->max_simd_bitwidth.bitwidth =RTE_DEFAULT_SIMD_BITWIDTH ; + internal_cfg->max_simd_bitwidth.locked =0 ; }static int
lib/librte_eal/include/generic/rte_vect.h +2
-0@@ -14,6 +14,8 @@#include <stdint.h> +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +/* Unsigned vector types */ /** lib/librte_eal/ppc/include/rte_vect.h +2
-0@@ -15,6 +15,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 + typedef vector signed int xmm_t;#define XMM_SIZE (sizeof(xmm_t))lib/librte_eal/x86/include/rte_vect.h +2
-1@@ -35,6 +35,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +typedef __m128i xmm_t ;#define XMM_SIZE (sizeof(xmm_t)) --2.17.1
PATCH 3/12 net/i40e: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_rxtx.c +13 -6
@@ -3098,7 +3098,8 @@ static eth_rx_burst_t i40e_get_latest_rx_vec(bool scatter) {#if defined(RTE_ARCH_X86 ) && defined(CC_AVX2_SUPPORT ) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;#endif
@@ -3115,7 +3116,8 @@ i40e_get_recommend_rx_vec(bool scatter)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;#endif
@@ -3154,7 +3156,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev) } } -if (ad->rx_vec_allowed) { +if (ad->rx_vec_allowed &&rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {/* Vec Rx path */ PMD_INIT_LOG (DEBUG ,"Vector Rx path will be used on port=%d." , dev->data->port_id);
@@ -3268,7 +3271,8 @@ static eth_tx_burst_ti40e_get_latest_tx_vec (void) {#if defined(RTE_ARCH_X86 ) && defined(CC_AVX2_SUPPORT ) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;
@@ -3283,7 +3287,8 @@ i40e_get_recommend_tx_vec(void)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;
@@ -3311,7 +3316,9 @@ i40e_set_tx_function(struct rte_eth_dev *dev) }if (ad->tx_simple_allowed) { -if (ad->tx_vec_allowed) { +if (ad->tx_vec_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Vector tx finally be used." );if (ad->use_latest_vec) dev->tx_pkt_burst =
Signature · 1 line
2.17.1
PATCH 4/12 net/axgbe: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/axgbe/axgbe_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/axgbe/axgbe_rxtx.c +2 -1
@@ -553,7 +553,8 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,if (!pdata->tx_queues) pdata->tx_queues = dev->data->tx_queues; -if (txq->vector_disable) +if (txq->vector_disable ||rte_get_max_simd_bitwidth () + <RTE_MAX_128_SIMD ) dev->tx_pkt_burst = &axgbe_xmit_pkts; else#ifdef RTE_ARCH_X86
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 20.11 04/12] net/axgbe: add checks for max SIMD bitwidth
[AMD Official Use Only - Internal Distribution Only]
++selwin
Please check.
Get Outlook for Android<https://aka.ms/ghei36>
________________________________
From: Ciara Power <[email protected]>
Sent: Friday, August 7, 2020 9:28:51 PM
To: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>; Ciara Power <[email protected]>; Somalapuram, Amaranath <[email protected]>
Subject: [PATCH 20.11 04/12] net/axgbe: add checks for max SIMD bitwidth
[CAUTION: External Email]
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/axgbe/axgbe_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/axgbe/axgbe_rxtx.c +2 -1
@@ -553,7 +553,8 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,if (!pdata->tx_queues) pdata->tx_queues = dev->data->tx_queues; -if (txq->vector_disable) +if (txq->vector_disable ||rte_get_max_simd_bitwidth () + <RTE_MAX_128_SIMD ) dev->tx_pkt_burst = &axgbe_xmit_pkts; else#ifdef RTE_ARCH_X86
--
2.17.1
PATCH 5/12 net/bnxt: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/bnxt/bnxt_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +4 -2
@@ -1100,7 +1100,8 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev) DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_RSS_HASH | DEV_RX_OFFLOAD_VLAN_FILTER)) && - !BNXT_TRUFLOW_EN(bp)) { + !BNXT_TRUFLOW_EN(bp) && rte_get_max_simd_bitwidth() + >= RTE_MAX_128_SIMD) {PMD_DRV_LOG (INFO ,"Using vector mode receive for port %d\n" , eth_dev->data->port_id); bp->flags |=BNXT_FLAG_RX_VECTOR_PKT_MODE ;
@@ -1132,7 +1133,8 @@ bnxt_transmit_function(__rte_unused struct rte_eth_dev *eth_dev)*/ if (!eth_dev->data->scattered_rx && !eth_dev->data->dev_conf.txmode.offloads && - !BNXT_TRUFLOW_EN (bp)) { + !BNXT_TRUFLOW_EN (bp) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) {PMD_DRV_LOG (INFO ,"Using vector mode transmit for port %d\n" , eth_dev->data->port_id);return bnxt_xmit_pkts_vec;
Signature · 1 line
2.17.1
PATCH 6/12 net/enic: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/enic/enic_rxtx_vec_avx2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/enic/enic_rxtx_vec_avx2.c +2 -1
@@ -821,7 +821,8 @@ enic_use_vector_rx_handler(struct rte_eth_dev *eth_dev) fconf = ð_dev->data->dev_conf.fdir_conf;if (fconf->mode !=RTE_FDIR_MODE_NONE )return false; -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) { +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) {ENICPMD_LOG (DEBUG ," use the non-scatter avx2 Rx handler" ); eth_dev->rx_pkt_burst = &enic_noscatter_vec_recv_pkts; enic->use_noscatter_vec_rx_handler =1 ;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 20.11 06/12] net/enic: add checks for max SIMD bitwidth
Quoted 40 lines
-----Original Message-----
From: Ciara Power <[email protected]>
Sent: Saturday, August 8, 2020 12:59 AM
To: [email protected]
Cc: [email protected]; Ciara Power <[email protected]>; John Daley (johndale) <[email protected]>; Hyong Youb Kim (hyonkim) <[email protected]>
Subject: [PATCH 20.11 06/12] net/enic: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc John Daley <[email protected]>Cc Hyong Youb Kim <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/enic/enic_rxtx_vec_avx2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/enic/enic_rxtx_vec_avx2.c +2
-1@@ -821,7 +821,8 @@ enic_use_vector_rx_handler(struct rte_eth_dev *eth_dev) fconf = ð_dev->data->dev_conf.fdir_conf;if (fconf->mode !=RTE_FDIR_MODE_NONE )return false; -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) { +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) { ENICPMD_LOG(DEBUG, " use the non-scatter avx2 Rxhandler");
drivers/net/enic/enic_rxtx_vec_avx2.c +0
-1eth_dev->rx_pkt_burst = &enic_noscatter_vec_recv_pkts; enic->use_noscatter_vec_rx_handler =1 ; --
Quoted 1 line
2.17.1
Thanks..
-Hyong
PATCH 7/12 net/fm10k: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/fm10k/fm10k_ethdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/fm10k/fm10k_ethdev.c +8 -3
@@ -2937,7 +2937,9 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {/* primary process has set the ftag flag and offloads */ txq = dev->data->tx_queues[0 ]; -if (fm10k_tx_vec_condition_check (txq)) { +if (fm10k_tx_vec_condition_check (txq) || +rte_get_max_simd_bitwidth () + <RTE_MAX_128_SIMD ) { dev->tx_pkt_burst = fm10k_xmit_pkts; dev->tx_pkt_prepare = fm10k_prep_pkts;PMD_INIT_LOG (DEBUG ,"Use regular Tx func" );
@@ -2956,7 +2958,8 @@ fm10k_set_tx_function(struct rte_eth_dev *dev) txq = dev->data->tx_queues[i]; txq->tx_ftag_en = tx_ftag_en;/* Check if Vector Tx is satisfied */ -if (fm10k_tx_vec_condition_check (txq)) +if (fm10k_tx_vec_condition_check (txq) || +rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) use_sse =0 ; }
@@ -2990,7 +2993,9 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)* conditions to be met. */ if (!fm10k_rx_vec_condition_check (dev) && - dev_info->rx_vec_allowed && !rx_ftag_en) { + dev_info->rx_vec_allowed && !rx_ftag_en && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {if (dev->data->scattered_rx) dev->rx_pkt_burst = fm10k_recv_scattered_pkts_vec;else
Signature · 1 line
2.17.1
PATCH 8/12 net/iavf: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/iavf/iavf_rxtx.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/net/iavf/iavf_rxtx.c +10 -6
@@ -2105,14 +2105,16 @@ iavf_set_rx_function(struct rte_eth_dev *dev)int i;bool use_avx2 = false; -if (!iavf_rx_vec_dev_check (dev)) { +if (!iavf_rx_vec_dev_check (dev) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) {for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; (void )iavf_rxq_vec_setup (rxq); } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) use_avx2 = true;if (dev->data->scattered_rx) {
@@ -2178,7 +2180,8 @@ iavf_set_tx_function(struct rte_eth_dev *dev)int i;bool use_avx2 = false; -if (!iavf_tx_vec_dev_check (dev)) { +if (!iavf_tx_vec_dev_check (dev) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) {for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];if (!txq)
@@ -2186,8 +2189,9 @@ iavf_set_tx_function(struct rte_eth_dev *dev)iavf_txq_vec_setup (txq); } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) use_avx2 = true; PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).",
Signature · 1 line
2.17.1
PATCH 9/12 net/ice: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/ice/ice_rxtx.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/net/ice/ice_rxtx.c +14 -6
@@ -2889,7 +2889,9 @@ ice_set_rx_function(struct rte_eth_dev *dev)bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed) { +if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) { ad->rx_vec_allowed = true;for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i];
@@ -2899,8 +2901,10 @@ ice_set_rx_function(struct rte_eth_dev *dev) } } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_256_SIMD ) use_avx2 = true; }else {
@@ -3067,7 +3071,9 @@ ice_set_tx_function(struct rte_eth_dev *dev)bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_tx_vec_dev_check (dev)) { +if (!ice_tx_vec_dev_check (dev) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) { ad->tx_vec_allowed = true;for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];
@@ -3077,8 +3083,10 @@ ice_set_tx_function(struct rte_eth_dev *dev) } } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_256_SIMD ) use_avx2 = true; }else {
Signature · 1 line
2.17.1
PATCH 10/12 net/ixgbe: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx.c +5 -2
@@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) dev->tx_pkt_prepare =NULL ;if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type () !=RTE_PROC_PRIMARY || -ixgbe_txq_vec_setup (txq) ==0 )) { +ixgbe_txq_vec_setup (txq) ==0 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Vector tx enabled." ); dev->tx_pkt_burst = ixgbe_xmit_pkts_vec; }else
@@ -4743,7 +4745,8 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev)* conditions to be met and Rx Bulk Allocation should be allowed. */ if (ixgbe_rx_vec_dev_conf_condition_check (dev) || - !adapter->rx_bulk_alloc_allowed) { + !adapter->rx_bulk_alloc_allowed || +rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Port[%d] doesn't meet Vector Rx " "preconditions" , dev->data->port_id);
Signature · 1 line
2.17.1
PATCH 11/12 net/mlx5: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/mlx5/mlx5_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_ethdev.c +2 -1
@@ -479,7 +479,8 @@ mlx5_select_rx_function(struct rte_eth_dev *dev)eth_rx_burst_t rx_pkt_burst = mlx5_rx_burst;MLX5_ASSERT (dev !=NULL ); -if (mlx5_check_vec_rx_support (dev) >0 ) { +if (mlx5_check_vec_rx_support (dev) >0 && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) { rx_pkt_burst = mlx5_rx_burst_vec;DRV_LOG (DEBUG ,"port %u selected Rx vectorized function" , dev->data->port_id);
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 20.11 11/12] net/mlx5: add checks for max SIMD bitwidth
Quoted 36 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Ciara Power
Sent: Friday, August 7, 2020 11:59
To: [email protected]
Cc: [email protected]; Ciara Power <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Viacheslav Ovsiienko <[email protected]>
Subject: [dpdk-dev] [PATCH 20.11 11/12] net/mlx5: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Matan Azrad <[email protected]>Cc Shahaf Shuler <[email protected]>Cc Viacheslav Ovsiienko <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/mlx5/mlx5_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/mlx5/mlx5_ethdev.c +2
-1@@ -479,7 +479,8 @@ mlx5_select_rx_function(struct rte_eth_dev *dev)eth_rx_burst_t rx_pkt_burst = mlx5_rx_burst;MLX5_ASSERT (dev !=NULL ); -if (mlx5_check_vec_rx_support (dev) >0 ) { +if (mlx5_check_vec_rx_support (dev) >0 && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) { rx_pkt_burst = mlx5_rx_burst_vec; DRV_LOG(DEBUG, "port %u selected Rx vectorized function",
Quoted 3 lines
dev->data->port_id);
--
2.17.1
Hi Ciara, what do you think about moving this condition inside the mlx5_check_vec_rx_support() function?
PATCH 12/12 net/virtio: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/virtio/virtio_ethdev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/virtio/virtio_ethdev.c +8 -4
@@ -1517,9 +1517,11 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)if (vtpci_packed_queue (hw)) {PMD_INIT_LOG (INFO ,"virtio: using packed ring %s Tx path on port %u" , - hw->use_vec_tx ?"vectorized" :"standard" , + (hw->use_vec_tx &&rte_get_max_simd_bitwidth () + >RTE_MAX_256_SIMD ) ?"vectorized" :"standard" , eth_dev->data->port_id); -if (hw->use_vec_tx) +if (hw->use_vec_tx &&rte_get_max_simd_bitwidth () + >RTE_MAX_256_SIMD ) eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed_vec;else eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed;
@@ -1536,7 +1538,8 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) }if (vtpci_packed_queue (hw)) { -if (hw->use_vec_rx) { +if (hw->use_vec_rx &&rte_get_max_simd_bitwidth () + >RTE_MAX_256_SIMD ) {PMD_INIT_LOG (INFO ,"virtio: using packed ring vectorized Rx path on port %u" , eth_dev->data->port_id);
@@ -1555,7 +1558,8 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &virtio_recv_pkts_packed; } }else { -if (hw->use_vec_rx) { +if (hw->use_vec_rx &&rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (INFO ,"virtio: using vectorized Rx path on port %u" , eth_dev->data->port_id); eth_dev->rx_pkt_burst = virtio_recv_pkts_vec;
Signature · 1 line
2.17.1
Quoted 38 lines · On Fri, 7 Aug 2020 16:58:47 +0100 Ciara Power <[email protected]> wrote:
A number of components in DPDK have optional AVX-512 or other vector code paths which can be selected at runtime. Rather than having each component provide its own mechanism to select a code path, this patchset adds support for a single setting to control what code paths are used. This can be used to enable some non-default code paths e.g. ones using AVX-512, but also to limit the code paths to certain vector widths, or to scalar code only, which is useful for testing.
The max SIMD bitwidth setting can be set by the app itself through use of the available API, or can be overriden by a commandline argument passed by the user.
Ciara Power (12):
eal: add max SIMD bitwidth
eal: add default SIMD bitwidth values
net/i40e: add checks for max SIMD bitwidth
net/axgbe: add checks for max SIMD bitwidth
net/bnxt: add checks for max SIMD bitwidth
net/enic: add checks for max SIMD bitwidth
net/fm10k: add checks for max SIMD bitwidth
net/iavf: add checks for max SIMD bitwidth
net/ice: add checks for max SIMD bitwidth
net/ixgbe: add checks for max SIMD bitwidth
net/mlx5: add checks for max SIMD bitwidth
net/virtio: add checks for max SIMD bitwidthdrivers/net/axgbe/axgbe_rxtx.c | 3 +- drivers/net/bnxt/bnxt_ethdev.c | 6 ++- drivers/net/enic/enic_rxtx_vec_avx2.c | 3 +- drivers/net/fm10k/fm10k_ethdev.c | 11 ++-- drivers/net/i40e/i40e_rxtx.c | 19 ++++--- drivers/net/iavf/iavf_rxtx.c | 16 +++--- drivers/net/ice/ice_rxtx.c | 20 ++++--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 ++- drivers/net/mlx5/mlx5_ethdev.c | 3 +- drivers/net/virtio/virtio_ethdev.c | 12 +++-- lib/librte_eal/arm/include/rte_vect.h | 2 + lib/librte_eal/common/eal_common_options.c | 63 ++++++++++++++++++++++
Quoted 9 lines
lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/generic/rte_vect.h | 2 + lib/librte_eal/include/rte_eal.h | 31 +++++++++++ lib/librte_eal/ppc/include/rte_vect.h | 2 + lib/librte_eal/rte_eal_version.map | 4 ++ lib/librte_eal/x86/include/rte_vect.h | 2 + 19 files changed, 184 insertions(+), 32 deletions(-)
This looks useful, could you add some documentation on rationale and how you expect application to set it.
Hi Stephen,
To give an overview of the rationale behind the patchset:
- It allows other apps such as OVS and VPP which already make use of AVX-512 to indicate that they are happy for DPDK to use AVX-512 too.
- It allows the end-user to override those settings if so desired.
- It allows an easy way for the user to test with different vector paths by limiting bitwidths.
I can add some documentation for this in a v2, thanks for the suggestion.
- Ciara
Quoted 62 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Friday 7 August 2020 17:19
To: Power, Ciara <[email protected]>
Cc: [email protected]; Richardson, Bruce <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 20.11 00/12] add max SIMD bitwidth to EALQuoted 4 lines · On Fri, 7 Aug 2020 16:58:47 +0100 Ciara Power <[email protected]> wrote:
A number of components in DPDK have optional AVX-512 or other vector code paths which can be selected at runtime. Rather than having each component provide its own mechanism to select a code path, this patchset adds support for a single setting to control what code paths are
used.
Quoted 22 lines
This can be used to enable some non-default code paths e.g. ones using AVX-512, but also to limit the code paths to certain vector widths, or to scalar code only, which is useful for testing.
The max SIMD bitwidth setting can be set by the app itself through use of the available API, or can be overriden by a commandline argument passed by the user.
Ciara Power (12):
eal: add max SIMD bitwidth
eal: add default SIMD bitwidth values
net/i40e: add checks for max SIMD bitwidth
net/axgbe: add checks for max SIMD bitwidth
net/bnxt: add checks for max SIMD bitwidth
net/enic: add checks for max SIMD bitwidth
net/fm10k: add checks for max SIMD bitwidth
net/iavf: add checks for max SIMD bitwidth
net/ice: add checks for max SIMD bitwidth
net/ixgbe: add checks for max SIMD bitwidth
net/mlx5: add checks for max SIMD bitwidth
net/virtio: add checks for max SIMD bitwidthQuoted 12 lines
drivers/net/axgbe/axgbe_rxtx.c | 3 +- drivers/net/bnxt/bnxt_ethdev.c | 6 ++- drivers/net/enic/enic_rxtx_vec_avx2.c | 3 +- drivers/net/fm10k/fm10k_ethdev.c | 11 ++-- drivers/net/i40e/i40e_rxtx.c | 19 ++++--- drivers/net/iavf/iavf_rxtx.c | 16 +++--- drivers/net/ice/ice_rxtx.c | 20 ++++--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 ++- drivers/net/mlx5/mlx5_ethdev.c | 3 +- drivers/net/virtio/virtio_ethdev.c | 12 +++-- lib/librte_eal/arm/include/rte_vect.h | 2 + lib/librte_eal/common/eal_common_options.c | 63++++++++++++++++++++++
Quoted 9 lines
lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/generic/rte_vect.h | 2 + lib/librte_eal/include/rte_eal.h | 31 +++++++++++ lib/librte_eal/ppc/include/rte_vect.h | 2 + lib/librte_eal/rte_eal_version.map | 4 ++ lib/librte_eal/x86/include/rte_vect.h | 2 + 19 files changed, 184 insertions(+), 32 deletions(-)This looks useful, could you add some documentation on rationale and how you expect application to set it.
Hi Ciara,
I have not reviewed other patches in this series yet. Few questions inline.
Quoted 11 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Ciara Power
Sent: Friday, August 7, 2020 10:59 AM
To: [email protected]
Cc: [email protected]; Ciara Power <[email protected]>
Subject: [dpdk-dev] [PATCH 20.11 00/12] add max SIMD bitwidth to EALA number of components in DPDK have optional AVX-512 or other vector code paths which can be selected at runtime. Rather than having each component provide its own mechanism to select a code path, this patchset adds support for a single setting to control what code paths are used.
Do you mean that all the components will have to use AVX-512?
IMO, different libraries might behave differently to the use of different vector sizes. Are we taking away the ability to use different vector sizes for different components.
Quoted 7 lines
This can be used to enable some non-default code paths e.g. ones using AVX- 512, but also to limit the code paths to certain vector widths, or to scalar code only, which is useful for testing.
The max SIMD bitwidth setting can be set by the app itself through use of the available API, or can be overriden by a commandline argument passed by the user.
Arm platforms support SVE (scalable vector extensions) feature. With this feature, the code is agnostic to the vector size. i.e. same code can run on various vector sizes. There is no code yet in DPDK with this feature. But, it will be added in the near future. It would be good to handle this now so that we do not have issues in the future..
Quoted 39 lines
Ciara Power (12):
eal: add max SIMD bitwidth
eal: add default SIMD bitwidth values
net/i40e: add checks for max SIMD bitwidth
net/axgbe: add checks for max SIMD bitwidth
net/bnxt: add checks for max SIMD bitwidth
net/enic: add checks for max SIMD bitwidth
net/fm10k: add checks for max SIMD bitwidth
net/iavf: add checks for max SIMD bitwidth
net/ice: add checks for max SIMD bitwidth
net/ixgbe: add checks for max SIMD bitwidth
net/mlx5: add checks for max SIMD bitwidth
net/virtio: add checks for max SIMD bitwidthdrivers/net/axgbe/axgbe_rxtx.c | 3 +- drivers/net/bnxt/bnxt_ethdev.c | 6 ++- drivers/net/enic/enic_rxtx_vec_avx2.c | 3 +- drivers/net/fm10k/fm10k_ethdev.c | 11 ++-- drivers/net/i40e/i40e_rxtx.c | 19 ++++--- drivers/net/iavf/iavf_rxtx.c | 16 +++--- drivers/net/ice/ice_rxtx.c | 20 ++++--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 ++- drivers/net/mlx5/mlx5_ethdev.c | 3 +- drivers/net/virtio/virtio_ethdev.c | 12 +++-- lib/librte_eal/arm/include/rte_vect.h | 2 + lib/librte_eal/common/eal_common_options.c | 63 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/generic/rte_vect.h | 2 + lib/librte_eal/include/rte_eal.h | 31 +++++++++++ lib/librte_eal/ppc/include/rte_vect.h | 2 + lib/librte_eal/rte_eal_version.map | 4 ++ lib/librte_eal/x86/include/rte_vect.h | 2 + 19 files changed, 184 insertions(+), 32 deletions(-)--
2.17.1
Hi Honnappa,
Quoted 24 lines
-----Original Message-----
From: Honnappa Nagarahalli <[email protected]>
Sent: Tuesday 11 August 2020 06:37
To: Power, Ciara <[email protected]>; [email protected]
Cc: Richardson, Bruce <[email protected]>; nd <[email protected]>; Honnappa Nagarahalli <[email protected]>; nd <[email protected]>
Subject: RE: [dpdk-dev] [PATCH 20.11 00/12] add max SIMD bitwidth to EALHi Ciara,
I have not reviewed other patches in this series yet. Few questions
inline.Quoted 11 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Ciara Power
Sent: Friday, August 7, 2020 10:59 AM
To: [email protected]
Cc: [email protected]; Ciara Power <[email protected]>
Subject: [dpdk-dev] [PATCH 20.11 00/12] add max SIMD bitwidth to EALA number of components in DPDK have optional AVX-512 or other vector code paths which can be selected at runtime. Rather than having each component provide its own mechanism to select a code path, this patchset adds support for a single setting to control what code paths are
Quoted 6 lines
used.
Do you mean that all the components will have to use AVX-512?
IMO, different libraries might behave differently to the use of different vector sizes. Are we taking away the ability to use different vector sizes for different components.
No, this setting is a max bitwidth which can be set by apps using the EAL API based on what is best for the usage in their apps, or by the user with an EAL flag, but each library is still free to choose it's own best path, subject to it not being longer than the specified max.
For example, if the max bitwidth is set to 512, a library can still choose to use a 256-bit path over a 512 one if its advantageous.
Quoted 4 lines
Quoted 4 lines
This can be used to enable some non-default code paths e.g. ones using AVX- 512, but also to limit the code paths to certain vector widths, or to scalar code only, which is useful for testing.
Quoted 8 lines
Quoted 3 lines
The max SIMD bitwidth setting can be set by the app itself through use of the available API, or can be overriden by a commandline argument passed by the user.
Arm platforms support SVE (scalable vector extensions) feature. With this feature, the code is agnostic to the vector size. i.e. same code can run on various vector sizes. There is no code yet in DPDK with this feature. But, it will be added in the near future. It would be good to handle this now so that we do not have issues in the future..
Do you have any suggestions how this could be handled?
<snip>
Thanks,
Ciara
v2 cover add max SIMD bitwidth to EAL
In reply to Ciara Powerv2:
- Added some documentation.
- Modified default max bitwidth for Arm.
- Moved mlx5 condition check into existing check vec support function.
- Added max SIMD bitwidth checks to some libraries.
A number of components in DPDK have optional AVX-512 or other vector code paths which can be selected at runtime. Rather than having each component provide its own mechanism to select a code path, this patchset adds support for a single setting to control what code paths are used. This can be used to enable some non-default code paths e.g. ones using AVX-512, but also to limit the code paths to certain vector widths, or to scalar code only, which is useful for testing.
The max SIMD bitwidth setting can be set by the app itself through use of the available API, or can be overriden by a commandline argument passed by the user.
Ciara Power (17):
eal: add max SIMD bitwidth
eal: add default SIMD bitwidth values
doc: add detail on using max SIMD bitwidth
net/i40e: add checks for max SIMD bitwidth
net/axgbe: add checks for max SIMD bitwidth
net/bnxt: add checks for max SIMD bitwidth
net/enic: add checks for max SIMD bitwidth
net/fm10k: add checks for max SIMD bitwidth
net/iavf: add checks for max SIMD bitwidth
net/ice: add checks for max SIMD bitwidth
net/ixgbe: add checks for max SIMD bitwidth
net/mlx5: add checks for max SIMD bitwidth
net/virtio: add checks for max SIMD bitwidth
distributor: add checks for max SIMD bitwidth
member: add checks for max SIMD bitwidth
efd: add checks for max SIMD bitwidth
net: add checks for max SIMD bitwidth
doc/guides/howto/avx512.rst | 36 +++++++++++ doc/guides/linux_gsg/eal_args.include.rst | 12 ++++ .../prog_guide/env_abstraction_layer.rst | 31 +++++++++ drivers/net/axgbe/axgbe_rxtx.c | 3 +- drivers/net/bnxt/bnxt_ethdev.c | 6 +- drivers/net/enic/enic_rxtx_vec_avx2.c | 3 +- drivers/net/fm10k/fm10k_ethdev.c | 11 +++- drivers/net/i40e/i40e_rxtx.c | 19 ++++-- drivers/net/iavf/iavf_rxtx.c | 16 +++-- drivers/net/ice/ice_rxtx.c | 20 ++++-- drivers/net/ixgbe/ixgbe_rxtx.c | 7 ++- drivers/net/mlx5/mlx5_rxtx_vec.c | 2 + drivers/net/virtio/virtio_ethdev.c | 12 ++-- lib/librte_distributor/rte_distributor.c | 3 +- lib/librte_eal/arm/include/rte_vect.h | 2 + lib/librte_eal/common/eal_common_options.c | 63 +++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/generic/rte_vect.h | 2 + lib/librte_eal/include/rte_eal.h | 32 ++++++++++ lib/librte_eal/ppc/include/rte_vect.h | 2 + lib/librte_eal/rte_eal_version.map | 4 ++ lib/librte_eal/x86/include/rte_vect.h | 2 + lib/librte_efd/rte_efd.c | 7 ++- lib/librte_member/rte_member_ht.c | 3 +- lib/librte_net/rte_net_crc.c | 8 +++ 26 files changed, 281 insertions(+), 35 deletions(-) create mode 100644 doc/guides/howto/avx512.rst
Signature · 1 line
2.17.1
PATCH v2 1/17 eal: add max SIMD bitwidth
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
---
v2: Added to Doxygen comment for API.
--- lib/librte_eal/common/eal_common_options.c | 60 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 32 ++++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 106 insertions(+)
lib/librte_eal/common/eal_common_options.c +60 -0
@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };
@@ -1309,6 +1310,32 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) +{ +char *end; +uint16_t bitwidth; +int ret; +struct internal_config *internal_conf = +eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ; + + errno =0 ; + bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if ((errno !=0 ) || end ==NULL || (*end !='\0' )) +return -1 ; + + ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; + internal_conf->max_simd_bitwidth.locked = locked; +return 0 ; +} +static int eal_parse_base_virtaddr (const char *arg) {
@@ -1707,6 +1734,13 @@ eal_parse_common_option(int opt, const char *optarg,case OPT_NO_TELEMETRY_NUM : conf->no_telemetry =1 ;break ; +case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) { +RTE_LOG (ERR ,EAL ,"invalid parameter for --" +OPT_FORCE_MAX_SIMD_BITWIDTH "\n" ); +return -1 ; + } +break ;/* don't know what to do, leave this to caller */ default :
@@ -1903,6 +1937,31 @@ eal_check_common_options(struct internal_config *internal_cfg)return 0 ; } +uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +} + +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) +{ +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { +RTE_LOG (NOTICE ,EAL ,"Cannot set max SIMD bitwidth - user runtime override enabled" ); +return -EPERM ; + } +if (bitwidth <RTE_NO_SIMD || !rte_is_power_of_2 (bitwidth)) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +} +void eal_common_usage (void ) {
@@ -1981,6 +2040,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --" OPT_TELEMETRY " Enable telemetry support (on by default)\n" " --" OPT_NO_TELEMETRY " Disable telemetry support\n" +" --" OPT_FORCE_MAX_SIMD_BITWIDTH " Force the max SIMD bitwidth\n" "\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n"
lib/librte_eal/common/eal_internal_cfg.h +8 -0
@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ +}; +/** * internal configuration */
@@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth; };void eal_reset_internal_config (struct internal_config *internal_cfg);
lib/librte_eal/common/eal_options.h +2 -0
@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };
lib/librte_eal/include/rte_eal.h +32 -0
@@ -43,6 +43,13 @@ enum rte_proc_type_t { RTE_PROC_INVALID }; +enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 +}; +/** * Get the process type in a multi-process setup *
@@ -51,6 +58,31 @@ enum rte_proc_type_t {*/ enum rte_proc_type_t rte_eal_process_type (void ); +/** +* Get the supported SIMD bitwidth. +* +* @return +* uint16_t bitwidth. +*/ +__rte_experimental +uint16_t rte_get_max_simd_bitwidth(void); + +/** +* Set the supported SIMD bitwidth. +* This API should only be called once at initialization, before EAL init. +* +* @param bitwidth +* uint16_t bitwidth. +* @return +* 0 on success. +* @return +* -EINVAL on invalid bitwidth parameter. +* @return +* -EPERM if bitwidth is locked. +*/ +__rte_experimental +int rte_set_max_simd_bitwidth(uint16_t bitwidth); +/** * Request iopl privilege for all RPL. *
lib/librte_eal/rte_eal_version.map +4 -0
@@ -403,6 +403,10 @@ EXPERIMENTAL { rte_mp_disable; rte_thread_register; rte_thread_unregister; + + # added in 20.11 + rte_get_max_simd_bitwidth; + rte_set_max_simd_bitwidth; }; INTERNAL {
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 01/17] eal: add max SIMD bitwidth
<snip>
Quoted 168 lines
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd- bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v2: Added to Doxygen comment for API.--- lib/librte_eal/common/eal_common_options.c | 60 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 32 ++++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 106 insertions(+)lib/librte_eal/common/eal_common_options.c +31
-0@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS ,0 ,NULL , OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };@@ -1309,6 +1310,32 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) { +char *end; +uint16_t bitwidth; +int ret; +struct internal_config *internal_conf = +eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ; + + errno =0 ; + bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if ((errno !=0 ) || end ==NULL || (*end !='\0' )) +return -1 ; + + ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; + internal_conf->max_simd_bitwidth.locked = locked; +return 0 ; +} +static int eal_parse_base_virtaddr(const char *arg) { @@ -1707,6 +1734,13 @@ eal_parse_common_option(int opt, const char *optarg, case OPT_NO_TELEMETRY_NUM: conf->no_telemetry = 1;break ; +case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) { +RTE_LOG (ERR ,EAL ,"invalid parameter for --" + OPT_FORCE_MAX_SIMD_BITWIDTH"\n");
lib/librte_eal/common/eal_common_options.c +27
-0+return -1 ; + } +break ;/* don't know what to do, leave this to caller */ default :@@ -1903,6 +1937,31 @@ eal_check_common_options(struct internal_config *internal_cfg)return 0 ; } +uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +} + +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) { +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { + RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - user runtime override enabled"); + return -EPERM; + } +if (bitwidth <RTE_NO_SIMD || !rte_is_power_of_2 (bitwidth)) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +} +void eal_common_usage (void ) {@@ -1981,6 +2040,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --"OPT_TELEMETRY" Enable telemetry support (on bydefault)\n"
lib/librte_eal/common/eal_common_options.c +1
-0" --" OPT_NO_TELEMETRY " Disable telemetry support\n" + " --"OPT_FORCE_MAX_SIMD_BITWIDTH" Force the max SIMDbitwidth\n"
lib/librte_eal/common/eal_common_options.c +0
-0"\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" lib/librte_eal/common/eal_internal_cfg.h +7
-0@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ }; +/** * internal configuration */ @@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth; }; void eal_reset_internal_config(struct internal_config *internal_cfg); diff --git
a/lib/librte_eal/common/eal_options.hb/lib/librte_eal/common/eal_options.h
index89769d48b4..ef33979664100644lib/librte_eal/common/eal_options.h +2
-0@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };lib/librte_eal/include/rte_eal.h +0
-0
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 46
Quoted 4 lines
lib/librte_eal/include/rte_eal.h +1
-0@@ -43,6 +43,13 @@ enum rte_proc_type_t {RTE_PROC_INVALID }; +enum rte_max_simd_t {
We could add a RTE_MAX_SIMD = 0. Arm platforms can use this to choose SVE.
Quoted 59 lines
lib/librte_eal/include/rte_eal.h +31
-0+RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , + RTE_MAX_512_SIMD = 512 +}; +/** * Get the process type in a multi-process setup * @@ -51,6 +58,31 @@ enum rte_proc_type_t {*/ enum rte_proc_type_t rte_eal_process_type (void ); +/** +* Get the supported SIMD bitwidth. +* +* @return +* uint16_t bitwidth. +*/ +__rte_experimental +uint16_t rte_get_max_simd_bitwidth(void); + +/** +* Set the supported SIMD bitwidth. +* This API should only be called once at initialization, before EAL init. +* +* @param bitwidth +* uint16_t bitwidth. +* @return +* 0 on success. +* @return +* -EINVAL on invalid bitwidth parameter. +* @return +* -EPERM if bitwidth is locked. +*/ +__rte_experimental +int rte_set_max_simd_bitwidth(uint16_t bitwidth); +/** * Request iopl privilege for all RPL. * lib/librte_eal/rte_eal_version.map +4
-1@@ -403,6 +403,10 @@ EXPERIMENTAL { rte_mp_disable; rte_thread_register; rte_thread_unregister; + + # added in 20.11 + rte_get_max_simd_bitwidth; + rte_set_max_simd_bitwidth; }; INTERNAL { --2.17.1
Re: [dpdk-dev] [PATCH v2 01/17] eal: add max SIMD bitwidth
Quoted 10 lines · Honnappa Nagarahalli
<snip>
lib/librte_eal/include/rte_eal.h +0
-0Quoted 7 lines
index
ddcf6a2e7a..8148f650f2100644lib/librte_eal/include/rte_eal.h +0
-0@@ -43,6 +43,13 @@ enum rte_proc_type_t { RTE_PROC_INVALID };
Quoted 3 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 46
Quoted 1 line
lib/librte_eal/include/rte_eal.h +1
-0+enum rte_max_simd_t {We could add a
RTE_MAX_SIMD= 0. Arm platforms can use this to choose SVE.
Is zero the best value for this? Would setting it to MAX_INT or some other big number be better, in terms of comparisons operations, or does that just not apply at all with SVE?
Quoted 6 lines
Quoted 6 lines
lib/librte_eal/include/rte_eal.h +6
-0+RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , + RTE_MAX_512_SIMD = 512 +}; +
Re: [dpdk-dev] [PATCH v2 01/17] eal: add max SIMD bitwidth
<snip>
Quoted 9 lines
Quoted 9 lines
lib/librte_eal/include/rte_eal.h +0
-0Quoted 7 lines
index
ddcf6a2e7a..8148f650f2100644lib/librte_eal/include/rte_eal.h +0
-0@@ -43,6 +43,13 @@ enum rte_proc_type_t { RTE_PROC_INVALID };
Quoted 8 lines
Quoted 2 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 46
Quoted 1 line
lib/librte_eal/include/rte_eal.h +1
-0+enum rte_max_simd_t {We could add a
RTE_MAX_SIMD= 0. Arm platforms can use this to chooseSVE.
Quoted 1 line
Is zero the best value for this? Would setting it to
MAX_INTor some other big number be better, in terms of comparisons operations, or does that just not apply at all with SVE?
I suggested zero as the bitwidth can be specified from the command line. It would be much easier to input zero vs other number.
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
lib/librte_eal/include/rte_eal.h +6
-0+RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , + RTE_MAX_512_SIMD = 512 +}; +
Re: [dpdk-dev] [PATCH v2 01/17] eal: add max SIMD bitwidth
Quoted 13 lines · Honnappa Nagarahalli
<snip>
Quoted 11 lines
Quoted 11 lines
lib/librte_eal/include/rte_eal.h +0
-0lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 46
Quoted 8 lines
index
ddcf6a2e7a..8148f650f2100644lib/librte_eal/include/rte_eal.h +1
-0@@ -43,6 +43,13 @@ enum rte_proc_type_t {RTE_PROC_INVALID }; +enum rte_max_simd_t {We could add a
RTE_MAX_SIMD= 0. Arm platforms can use this to choose
Quoted 7 lines
Quoted 6 lines
SVE.
Quoted 1 line
Is zero the best value for this? Would setting it to
MAX_INTor some other big number be better, in terms of comparisons operations, or does that just not apply at all with SVE?I suggested zero as the bitwidth can be specified from the command line. It would be much easier to input zero vs other number.
Right, but it doesn't end up being that intuitive as interface 0 is enabled, 64 is not, 128 is enabled etc ....
Suggest we use a max 16bit integer as 0xFFFF?
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
lib/librte_eal/include/rte_eal.h +6
-0+RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , + RTE_MAX_512_SIMD = 512 +}; +
Re: [dpdk-dev] [PATCH v2 01/17] eal: add max SIMD bitwidth
Quoted 22 lines · Ray
Quoted 19 lines · Honnappa Nagarahalli
<snip>
Quoted 17 lines
Quoted 11 lines
lib/librte_eal/include/rte_eal.h +0
-0lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 46
Quoted 8 lines
index
ddcf6a2e7a..8148f650f2100644lib/librte_eal/include/rte_eal.h +1
-0@@ -43,6 +43,13 @@ enum rte_proc_type_t {RTE_PROC_INVALID }; +enum rte_max_simd_t {We could add a
RTE_MAX_SIMD= 0. Arm platforms can use this to chooseSVE.
Quoted 1 line
Is zero the best value for this? Would setting it to
MAX_INTor some other big number be better, in terms of comparisons operations, or does that just not apply at all with SVE?
Quoted 7 lines
Quoted 1 line
I suggested zero as the bitwidth can be specified from the command line. It would be much easier to input zero vs other number.
Right, but it doesn't end up being that intuitive as interface 0 is enabled, 64 is not, 128 is enabled etc ....
Suggest we use a max 16bit integer as
0xFFFF?
I can actually see 0 on command-line as being "unlimited", but for the APIs and internally, I think that it should be converted to a MAX_INT value so that the comparisons don't need to special-case zero. I agree with Honnappa, that a -1 or maxint value is awkward on commandline, but internally it's just an enum, so we can set it to whatever the most practical value is.
Re: [dpdk-dev] [PATCH v2 01/17] eal: add max SIMD bitwidth
In reply to Kinsella, Ray<snip>
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Review
Quoted 3 lines
(quoted diff) +0
-0
b/lib/librte_eal/include/rte_eal.hQuoted 10 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 46
Quoted 8 lines
index
ddcf6a2e7a..8148f650f2100644lib/librte_eal/include/rte_eal.h +1
-0@@ -43,6 +43,13 @@ enum rte_proc_type_t {RTE_PROC_INVALID }; +enum rte_max_simd_t {We could add a
RTE_MAX_SIMD= 0. Arm platforms can use this to chooseSVE.
Quoted 1 line
Is zero the best value for this? Would setting it to
MAX_INTor some other big number be better, in terms of comparisons operations, or does that just not apply at all with SVE?
Quoted 7 lines
Quoted 1 line
I suggested zero as the bitwidth can be specified from the command line. It
would be much easier to input zero vs other number.
Right, but it doesn't end up being that intuitive as interface 0 is enabled, 64 is not, 128 is enabled etc ....
Suggest we use a max 16bit integer as
0xFFFF?
I think there are 2 things here:
1) What is the internal representation (for ex: the value of the enum)? Here assigning 0xFFFF should be fine.
2) The input value at the command line. Is it possible to say that, if the user does not provide anything, then we set the option as 0xFFFF? This would mean that SVE would be used by default on Arm platforms (which is ok for me).
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
lib/librte_eal/include/rte_eal.h +6
-0+RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , + RTE_MAX_512_SIMD = 512 +}; +
Re: [dpdk-dev] [PATCH v2 01/17] eal: add max SIMD bitwidth
Quoted 25 lines · Honnappa Nagarahalli
<snip>
Quoted 23 lines
Quoted 14 lines
Quoted 14 lines
Review
Quoted 3 lines
(quoted diff) +0
-0
b/lib/librte_eal/include/rte_eal.hQuoted 10 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 46
Quoted 8 lines
index
ddcf6a2e7a..8148f650f2100644lib/librte_eal/include/rte_eal.h +1
-0@@ -43,6 +43,13 @@ enum rte_proc_type_t {RTE_PROC_INVALID }; +enum rte_max_simd_t {We could add a
RTE_MAX_SIMD= 0. Arm platforms can use this to chooseQuoted 7 lines
Quoted 6 lines
SVE.
Quoted 1 line
Is zero the best value for this? Would setting it to
MAX_INTor some other big number be better, in terms of comparisons operations, or does that just not apply at all with SVE?I suggested zero as the bitwidth can be specified from the command line. It
would be much easier to input zero vs other number.
Quoted 8 lines
Quoted 4 lines
Right, but it doesn't end up being that intuitive as interface 0 is enabled, 64 is not, 128 is enabled etc ....
Suggest we use a max 16bit integer as
0xFFFF?I think there are 2 things here:
1) What is the internal representation (for ex: the value of the enum)? Here assigning0xFFFFshould be fine.
2) The input value at the command line. Is it possible to say that, if the user does not provide anything, then we set the option as0xFFFF? This would mean that SVE would be used by default on Arm platforms (which is ok for me).
Make sense. That all is perfectly doable because the initial default value is set per architecture.
Re: [dpdk-dev] [PATCH v2 01/17] eal: add max SIMD bitwidth
In reply to Ciara PowerQuoted 37 lines
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v2: Added to Doxygen comment for API.--- lib/librte_eal/common/eal_common_options.c | 60 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 32 ++++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 106 insertions(+)lib/librte_eal/common/eal_common_options.c +5
-0@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };@@ -1309,6 +1310,32 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) +{ +char *end;
lib/librte_eal/common/eal_common_options.c eal_parse_iova_mode(const char *name) · line 1326
Quoted 10 lines
lib/librte_eal/common/eal_common_options.c +10
-0+uint16_t bitwidth; +int ret; +struct internal_config *internal_conf = +eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ; + + errno =0 ; + bitwidth =strtoul (arg, &end,0 );
As I can see with that assignment you'll loose high bits set (if any). So, --force-max-simd-bitwidth=0xf0080
wouldn't report any error, while it probably should. Probably something like that, as abetter way:
unsigned long t;
...
t = strtoul(arg, &end, 0);
if (t > UINT16_MAX || errno != 0 || end == NULL || *end != '\0')
return -1;
ret = rte_set_max_simd_bitwidth(t);
Quoted 12 lines
lib/librte_eal/common/eal_common_options.c +12
-0+ +/* check for errors */ +if ((errno !=0 ) || end ==NULL || (*end !='\0' )) +return -1 ; + + ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; + internal_conf->max_simd_bitwidth.locked = locked; +return 0 ; +} +
PATCH v2 2/17 eal: add default SIMD bitwidth values
In reply to Ciara PowerEach arch has a define for the default SIMD bitwidth value, this is used on EAL init to set the config max SIMD bitwidth.
---
v2: Changed default bitwidth for Arm to 128.
--- lib/librte_eal/arm/include/rte_vect.h | 2 ++ lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/include/generic/rte_vect.h | 2 ++ lib/librte_eal/ppc/include/rte_vect.h | 2 ++ lib/librte_eal/x86/include/rte_vect.h | 2 ++ 5 files changed, 11 insertions(+)
lib/librte_eal/arm/include/rte_vect.h +2 -0
@@ -14,6 +14,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 128 +typedef int32x4_t xmm_t ;#define XMM_SIZE (sizeof(xmm_t))
lib/librte_eal/common/eal_common_options.c +3 -0
@@ -35,6 +35,7 @@#ifndef RTE_EXEC_ENV_WINDOWS #include <rte_telemetry.h> #endif +#include <rte_vect.h> #include "eal_internal_cfg.h" #include "eal_options.h"
@@ -344,6 +345,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg) internal_cfg->user_mbuf_pool_ops_name =NULL ;CPU_ZERO (&internal_cfg->ctrl_cpuset); internal_cfg->init_complete =0 ; + internal_cfg->max_simd_bitwidth.bitwidth =RTE_DEFAULT_SIMD_BITWIDTH ; + internal_cfg->max_simd_bitwidth.locked =0 ; } static int
lib/librte_eal/include/generic/rte_vect.h +2 -0
@@ -14,6 +14,8 @@#include <stdint.h> +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +/* Unsigned vector types */ /**
lib/librte_eal/ppc/include/rte_vect.h +2 -0
@@ -15,6 +15,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 + typedef vector signed int xmm_t;#define XMM_SIZE (sizeof(xmm_t))
lib/librte_eal/x86/include/rte_vect.h +2 -0
@@ -35,6 +35,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +typedef __m128i xmm_t ;#define XMM_SIZE (sizeof(xmm_t))
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 02/17] eal: add default SIMD bitwidth values
<snip>
Quoted 9 lines
Each arch has a define for the default SIMD bitwidth value, this is used on EAL init to set the config max SIMD bitwidth.
Cc Ruifeng Wang <[email protected]>Cc Jerin Jacob <[email protected]>Cc Honnappa Nagarahalli <[email protected]>Cc David Christensen <[email protected]>
Quoted 4 lines
Signed-off-by Ciara Power <[email protected]>---
v2: Changed default bitwidth for Arm to 128.
Thanks for this change.
Continuing the discussion from V1, for SVE (Scalable Vector Extensions - code is vector width agnostic, allowing the same binary to run on multiple platforms with different vector width), I am thinking we should add a default value which we could use on Arm platforms to identify the choice. I have added some comments in 1/17.
Quoted 90 lines
--- lib/librte_eal/arm/include/rte_vect.h | 2 ++ lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/include/generic/rte_vect.h | 2 ++ lib/librte_eal/ppc/include/rte_vect.h | 2 ++ lib/librte_eal/x86/include/rte_vect.h | 2 ++ 5 files changed, 11 insertions(+)lib/librte_eal/arm/include/rte_vect.h +2
-0@@ -14,6 +14,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 128 +typedef int32x4_t xmm_t ;#define XMM_SIZE (sizeof(xmm_t))lib/librte_eal/common/eal_common_options.c +3
-0@@ -35,6 +35,7 @@#ifndef RTE_EXEC_ENV_WINDOWS #include <rte_telemetry.h> #endif +#include <rte_vect.h> #include "eal_internal_cfg.h" #include "eal_options.h" @@ -344,6 +345,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg) internal_cfg->user_mbuf_pool_ops_name =NULL ;CPU_ZERO (&internal_cfg->ctrl_cpuset); internal_cfg->init_complete =0 ; + internal_cfg->max_simd_bitwidth.bitwidth =RTE_DEFAULT_SIMD_BITWIDTH ; + internal_cfg->max_simd_bitwidth.locked =0 ; }static int
lib/librte_eal/include/generic/rte_vect.h +2
-0@@ -14,6 +14,8 @@#include <stdint.h> +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +/* Unsigned vector types */ /** lib/librte_eal/ppc/include/rte_vect.h +2
-0@@ -15,6 +15,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 + typedef vector signed int xmm_t;#define XMM_SIZE (sizeof(xmm_t))lib/librte_eal/x86/include/rte_vect.h +2
-1@@ -35,6 +35,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +typedef __m128i xmm_t ;#define XMM_SIZE (sizeof(xmm_t)) --2.17.1
PATCH v2 3/17 doc: add detail on using max SIMD bitwidth
In reply to Ciara PowerThis patch adds documentation on the usage of the max SIMD bitwidth EAL setting, and how to use it to enable AVX-512 at runtime.
--- doc/guides/howto/avx512.rst | 36 +++++++++++++++++++ doc/guides/linux_gsg/eal_args.include.rst | 12 +++++++ .../prog_guide/env_abstraction_layer.rst | 31 ++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 doc/guides/howto/avx512.rst
doc/guides/howto/avx512.rst new file +36 -0
@@ -0,0 +1,36 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2020 Intel Corporation. + + +Using AVX-512 with DPDK +======================= + +AVX-512 is not used by default in DPDK, but it can be selected at runtime by apps through the use of EAL API, +and by the user with a commandline argument. DPDK has a setting for max SIMD bitwidth, +which can be modified and will then limit the vector path taken by the code. + + +Using the API in apps +--------------------- + +Apps can request DPDK uses AVX-512 at runtime, if it provides improved application performance. +This can be done by modifying the EAL setting for max SIMD bitwidth to 512, as by default it is 256, +which does not allow for AVX-512. + +.. code-block:: c + + rte_set_max_simd_bitwidth(RTE_MAX_512_SIMD); + +This API should only be called once at initialization, before EAL init. +For more information on the possible enum values to use as a parameter, go to :ref:`max_simd_bitwidth`: + + +Using the command-line argument +--------------------------------------------- + +The user can select to use AVX-512 at runtime, using the following argument to set the max bitwidth:: + + ./app/dpdk-testpmd --force-max-simd-bitwidth=512 + +This will override any further changes to the max SIMD bitwidth in DPDK, +which is useful for testing purposes.
doc/guides/linux_gsg/eal_args.include.rst +12 -0
@@ -210,3 +210,15 @@ Other options * ``--no-telemetry``: Disable telemetry. + +* ``--force-max-simd-bitwidth=<val>``: + + Specify the maximum SIMD bitwidth size to handle. This limits which vector paths, + if any, are taken, as any paths taken must use a bitwidth below the max bitwidth limit. + For example, to allow all SIMD bitwidths up to and including AVX-512:: + + --force-max-simd-bitwidth=512 + + The following example shows limiting the bitwidth to 64-bits to disable all vector code:: + + --force-max-simd-bitwidth=64
doc/guides/prog_guide/env_abstraction_layer.rst +31 -0
@@ -486,6 +486,37 @@ the desired addressing mode when virtual devices that are not directly attached To facilitate forcing the IOVA mode to a specific value the EAL command line option ``--iova-mode`` can be used to select either physical addressing('pa') or virtual addressing('va'). +.. _max_simd_bitwidth: + + +Max SIMD bitwidth +~~~~~~~~~~~~~~~~~ + +The EAL provides a single setting to limit the max SIMD bitwidth used by DPDK, +which is used in determining the vector path, if any, chosen by a component. +The value can be set at runtime by an application using the 'rte_set_max_simd_bitwidth(uint16_t bitwidth)' function, +which should only be called once at initialization, before EAL init. +The value can be overridden by the user using the EAL command-line option '--force-max-sim-bitwidth'. + +When choosing a vector path, along with checking the CPU feature support, +the value of the max SIMD bitwidth must also be checked, and can be retrieved using the 'rte_get_max_simd_bitwidth()' function. +The value should be compared against the enum values for accepted max SIMD bitwidths: + +.. code-block:: c + + enum rte_max_simd_t { + RTE_NO_SIMD = 64, + RTE_MAX_128_SIMD = 128, + RTE_MAX_256_SIMD = 256, + RTE_MAX_512_SIMD = 512 + }; + + if (rte_get_max_simd_bitwidth() >= RTE_MAX_512_SIMD) + /* Take AVX-512 vector path */ + else if (rte_get_max_simd_bitwidth() >= RTE_MAX_256_SIMD) + /* Take AVX2 vector path */ + + Memory Segments and Memory Zones (memzone) ------------------------------------------
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 03/17] doc: add detail on using max SIMD bitwidth
Quoted 21 lines
This patch adds documentation on the usage of the max SIMD bitwidth EAL setting, and how to use it to enable AVX-512 at runtime.
Cc Anatoly Burakov <[email protected]>Cc John McNamara <[email protected]>Cc Marko Kovacevic <[email protected]>Signed-off-by Ciara Power <[email protected]>--- doc/guides/howto/avx512.rst | 36 +++++++++++++++++++ doc/guides/linux_gsg/eal_args.include.rst | 12 +++++++ .../prog_guide/env_abstraction_layer.rst | 31 ++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 doc/guides/howto/avx512.rstdoc/guides/howto/avx512.rst new file +0
-0
doc/guides/howto/avx512.rst line 10
Quoted 10 lines
doc/guides/howto/avx512.rst new file +10
-0@@ -0,0 +1,36 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2020 Intel Corporation. + + +Using AVX-512 with DPDK +======================= + +AVX-512 is not used by default in DPDK, but it can be selected at runtime by apps through the use of EAL API, +and by the user with a commandline argument. DPDK has a setting for max SIMD bitwidth, +which can be modified and will then limit the vector path taken by the code.
It's is a good idea to have such ability,
though just one global variable for all DPDK lib/drivers
seems a bit coarse to me.
Let say we have 2 libs: libA and libB.
Both do have RTE_MAX_512_SIMD specific code-path,
though libA would cause frequency level change, while libB wouldn't. So user (to avoid frequency level change) would have to block 512_SIMD for both libs.
I think it would be much better to follow the strategy we use for log-level:
there is a global simd_width, but each DDPK entity (lib/driver) also has it's own simd_width that overrules a global one (more fine-grained control).
Quoted 4 lines
doc/guides/howto/avx512.rst new file +4
-0+ + +Using the API in apps +---------------------
doc/guides/howto/avx512.rst line 24
Quoted 10 lines
doc/guides/howto/avx512.rst new file +10
-0+ +Apps can request DPDK uses AVX-512 at runtime, if it provides improved application performance. +This can be done by modifying the EAL setting for max SIMD bitwidth to 512, as by default it is 256, +which does not allow for AVX-512. + +.. code-block:: c + + rte_set_max_simd_bitwidth(RTE_MAX_512_SIMD); + +This API should only be called once at initialization, before EAL init.
If the only possible usage scenario for that function is init time before EAL init, then do we really need it at all?
As we have cmd-line flag anyway?
User can achieve similar goal, by just: rte_eal_init(,..."--force-max-simd-bitwidth=..."...);
Quoted 76 lines
doc/guides/howto/avx512.rst new file +12
-0+For more information on the possible enum values to use as a parameter, go to :ref:`max_simd_bitwidth`: + + +Using the command-line argument +--------------------------------------------- + +The user can select to use AVX-512 at runtime, using the following argument to set the max bitwidth:: + + ./app/dpdk-testpmd --force-max-simd-bitwidth=512 + +This will override any further changes to the max SIMD bitwidth in DPDK, +which is useful for testing purposes.doc/guides/linux_gsg/eal_args.include.rst +12
-0@@ -210,3 +210,15 @@ Other options * ``--no-telemetry``: Disable telemetry. + +* ``--force-max-simd-bitwidth=<val>``: + + Specify the maximum SIMD bitwidth size to handle. This limits which vector paths, + if any, are taken, as any paths taken must use a bitwidth below the max bitwidth limit. + For example, to allow all SIMD bitwidths up to and including AVX-512:: + + --force-max-simd-bitwidth=512 + + The following example shows limiting the bitwidth to 64-bits to disable all vector code:: + + --force-max-simd-bitwidth=64doc/guides/prog_guide/env_abstraction_layer.rst +31
-1@@ -486,6 +486,37 @@ the desired addressing mode when virtual devices that are not directly attached To facilitate forcing the IOVA mode to a specific value the EAL command line option ``--iova-mode`` can be used to select either physical addressing('pa') or virtual addressing('va'). +.. _max_simd_bitwidth: + + +Max SIMD bitwidth +~~~~~~~~~~~~~~~~~ + +The EAL provides a single setting to limit the max SIMD bitwidth used by DPDK, +which is used in determining the vector path, if any, chosen by a component. +The value can be set at runtime by an application using the 'rte_set_max_simd_bitwidth(uint16_t bitwidth)' function, +which should only be called once at initialization, before EAL init. +The value can be overridden by the user using the EAL command-line option '--force-max-sim-bitwidth'. + +When choosing a vector path, along with checking the CPU feature support, +the value of the max SIMD bitwidth must also be checked, and can be retrieved using the 'rte_get_max_simd_bitwidth()' function. +The value should be compared against the enum values for accepted max SIMD bitwidths: + +.. code-block:: c + + enum rte_max_simd_t { + RTE_NO_SIMD = 64, + RTE_MAX_128_SIMD = 128, + RTE_MAX_256_SIMD = 256, + RTE_MAX_512_SIMD = 512 + }; + + if (rte_get_max_simd_bitwidth() >= RTE_MAX_512_SIMD) + /* Take AVX-512 vector path */ + else if (rte_get_max_simd_bitwidth() >= RTE_MAX_256_SIMD) + /* Take AVX2 vector path */ + + Memory Segments and Memory Zones (memzone) ------------------------------------------ --2.17.1
Re: [dpdk-dev] [PATCH v2 03/17] doc: add detail on using max SIMD bitwidth
Quoted 35 lines · Konstantin
Quoted 21 lines
This patch adds documentation on the usage of the max SIMD bitwidth EAL setting, and how to use it to enable AVX-512 at runtime.
Cc Anatoly Burakov <[email protected]>Cc John McNamara <[email protected]>Cc Marko Kovacevic <[email protected]>Signed-off-by Ciara Power <[email protected]>--- doc/guides/howto/avx512.rst | 36 +++++++++++++++++++ doc/guides/linux_gsg/eal_args.include.rst | 12 +++++++ .../prog_guide/env_abstraction_layer.rst | 31 ++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 doc/guides/howto/avx512.rstdoc/guides/howto/avx512.rst new file +0
-0doc/guides/howto/avx512.rst line 10
Quoted 10 lines
doc/guides/howto/avx512.rst new file +10
-0@@ -0,0 +1,36 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2020 Intel Corporation. + + +Using AVX-512 with DPDK +======================= + +AVX-512 is not used by default in DPDK, but it can be selected at runtime by apps through the use of EAL API, +and by the user with a commandline argument. DPDK has a setting for max SIMD bitwidth, +which can be modified and will then limit the vector path taken by the code.It's is a good idea to have such ability, though just one global variable for all DPDK lib/drivers seems a bit coarse to me.
Quoted 8 lines
Let say we have 2 libs: libA and libB.
Both do haveRTE_MAX_512_SIMDspecific code-path,
though libA would cause frequency level change, while libB wouldn't. So user (to avoid frequency level change) would have to block 512_SIMD for both libs.
I think it would be much better to follow the strategy we use for log-level:
there is a globalsimd_width, but each DDPK entity (lib/driver) also has it's ownsimd_widththat overrules a global one (more fine-grained control).
That for me is a nightmare scenario. How is the user meant to know what libs could cause him a frequency or not, or is he meant to determine that empirically by trial and error on each platform? This scenario is completely unlike logging in that it's non-obvious to the user, and so needs to be kept as consumable as possible to the app-developer and the user. Unless we find a concrete scenario where having a single switch is causing real user problems, I'd much rather keep things simple. See also answer below, where I point out that the main target of this is developers, who can use this flag to indicate what vector bitwidth their app uses, and then allow DPDK to match that.
Quoted 12 lines
Quoted 12 lines
doc/guides/howto/avx512.rst new file +11
-0+ + +Using the API in apps +--------------------- + +Apps can request DPDK uses AVX-512 at runtime, if it provides improved application performance. +This can be done by modifying the EAL setting for max SIMD bitwidth to 512, as by default it is 256, +which does not allow for AVX-512. + +.. code-block:: c +
Quoted 8 lines
doc/guides/howto/avx512.rst line 24
Quoted 3 lines
doc/guides/howto/avx512.rst new file +3
-0+ rte_set_max_simd_bitwidth(RTE_MAX_512_SIMD); + +This API should only be called once at initialization, before EAL init.If the only possible usage scenario for that function is init time before EAL init, then do we really need it at all?
As we have cmd-line flag anyway?
User can achieve similar goal, by just:rte_eal_init(,..."--force-max-simd-bitwidth=..."...);
Ideally, the user should never know or care about the cmdline flag, it's only for testing. The main criteria for allowing DPDK to use longer instruction sets is whether the application itself will similarly use them, and that's something for the programmer to do. Having the programmer muck about with cmdline arguments is less than ideal, so a proper API is warrented here. The reason for the note about EAL init, is that we don't want libraries to have to check the max bitwidth each time an API is called, so we want to have a way to prevent people changing things at runtime. This therefore seemed simplest.
/Bruce
Re: [dpdk-dev] [PATCH v2 03/17] doc: add detail on using max SIMD bitwidth
Quoted 47 lines · Konstantin
Quoted 35 lines
Quoted 21 lines
This patch adds documentation on the usage of the max SIMD bitwidth EAL setting, and how to use it to enable AVX-512 at runtime.
Cc Anatoly Burakov <[email protected]>Cc John McNamara <[email protected]>Cc Marko Kovacevic <[email protected]>Signed-off-by Ciara Power <[email protected]>--- doc/guides/howto/avx512.rst | 36 +++++++++++++++++++ doc/guides/linux_gsg/eal_args.include.rst | 12 +++++++ .../prog_guide/env_abstraction_layer.rst | 31 ++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 doc/guides/howto/avx512.rstdoc/guides/howto/avx512.rst new file +0
-0doc/guides/howto/avx512.rst line 10
Quoted 10 lines
doc/guides/howto/avx512.rst new file +10
-0@@ -0,0 +1,36 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2020 Intel Corporation. + + +Using AVX-512 with DPDK +======================= + +AVX-512 is not used by default in DPDK, but it can be selected at runtime by apps through the use of EAL API, +and by the user with a commandline argument. DPDK has a setting for max SIMD bitwidth, +which can be modified and will then limit the vector path taken by the code.It's is a good idea to have such ability, though just one global variable for all DPDK lib/drivers seems a bit coarse to me.
Quoted 8 lines
Let say we have 2 libs: libA and libB.
Both do haveRTE_MAX_512_SIMDspecific code-path,
though libA would cause frequency level change, while libB wouldn't. So user (to avoid frequency level change) would have to block 512_SIMD for both libs.
I think it would be much better to follow the strategy we use for log-level:
there is a globalsimd_width, but each DDPK entity (lib/driver) also has it's ownsimd_widththat overrules a global one (more fine-grained control).
Quoted 3 lines
That for me is a nightmare scenario. How is the user meant to know what libs could cause him a frequency or not, or is he meant to determine that empirically by trial and error on each platform?
I suppose yes.
Let say user can try to run the appp with global --force-max-simd-bitwidth=256 and --force-max-simd-bitwidth=512
and check the diffenrence.
If he is happy with performance he get, he can stick with one of global values (256/512). If not he can try further with choosing different max-simd-width for different components.
Quoted 4 lines
This scenario is
completely unlike logging in that it's non-obvious to the user, and so needs to be kept as consumable as possible to the app-developer and the user.
This feature is totally optional, if user feels like he doesn't need to care about it, he can simply ignore it and use default values.
Though for those who do care, one global value seems too restrictive.
Quoted 2 lines
Unless we find a concrete scenario where having a single switch is causing real user problems, I'd much rather keep things simple.
As an example, I run several perf tests with acl avx512 code path and so far didn't see any switches to CORE_POWER.LVL2_TURBO_LICENSE (heavy AVX512 instructions).
I presume there might be other light-weight avx512 codepaths (lpm, etc.). Though for crypto cpu PMDs (aesni-mb, etc.) I think it would cause switch to the LVL2.
Quoted 3 lines
See also answer below, where I point out that the main target of this is developers, who can use this flag to indicate what vector bitwidth their app uses, and then allow DPDK to match that.
But in majority if cases developer doesn't know for sure on what platform his app will run (unless quite rare situation when app is developed for one particular platform). Again for complex/multi-purpose applications (like VPP, DPDK-OVS) developer can't even always predict what modules will be used and which wouldn't.
Again app can be configured in a way that different modules can run on different cores (let say module that does ACL lookup on core X, module that does actual crypto on core Y). All that depends on particular deployment scenarios.
So in many cases only end-user has all information to decide what max-simd width will be optimal.
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
doc/guides/howto/avx512.rst new file +11
-0+ + +Using the API in apps +--------------------- + +Apps can request DPDK uses AVX-512 at runtime, if it provides improved application performance. +This can be done by modifying the EAL setting for max SIMD bitwidth to 512, as by default it is 256, +which does not allow for AVX-512. + +.. code-block:: c +Quoted 8 lines
doc/guides/howto/avx512.rst line 24
Quoted 3 lines
doc/guides/howto/avx512.rst new file +3
-0+ rte_set_max_simd_bitwidth(RTE_MAX_512_SIMD); + +This API should only be called once at initialization, before EAL init.If the only possible usage scenario for that function is init time before EAL init, then do we really need it at all?
As we have cmd-line flag anyway?
User can achieve similar goal, by just:rte_eal_init(,..."--force-max-simd-bitwidth=..."...);
Quoted 4 lines
Ideally, the user should never know or care about the cmdline flag, it's only for testing. The main criteria for allowing DPDK to use longer instruction sets is whether the application itself will similarly use them, and that's something for the programmer to do.
Unfortunately, I don't think programmer also has all information to make such decisions. A lot depends on deployment scenarios, see above.
Quoted 3 lines
Having the programmer muck
about with cmdline arguments is less than ideal, so a proper API is warrented here.
Agree, function call is more convenient for the developer.
Quoted 4 lines
The reason for the note about EAL init, is that we don't want libraries to have to check the max bitwidth each time an API is called, so we want to have a way to prevent people changing things at runtime. This therefore seemed simplest.
I understand that, but for that purpose just cmd-line flag is enough, that's why I asked do we need an API call at all.
It seems a bit strange to me to introduce an API that supposed to be called only *before* eal_init(), but from other side I don't see much harm from it either. So if you and other guys still prefer to keep it - ok by me. Konstantin
PATCH v2 4/17 net/i40e: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_rxtx.c +13 -6
@@ -3098,7 +3098,8 @@ static eth_rx_burst_t i40e_get_latest_rx_vec(bool scatter) {#if defined(RTE_ARCH_X86 ) && defined(CC_AVX2_SUPPORT ) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;#endif
@@ -3115,7 +3116,8 @@ i40e_get_recommend_rx_vec(bool scatter)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;#endif
@@ -3154,7 +3156,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev) } } -if (ad->rx_vec_allowed) { +if (ad->rx_vec_allowed &&rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {/* Vec Rx path */ PMD_INIT_LOG (DEBUG ,"Vector Rx path will be used on port=%d." , dev->data->port_id);
@@ -3268,7 +3271,8 @@ static eth_tx_burst_ti40e_get_latest_tx_vec (void) {#if defined(RTE_ARCH_X86 ) && defined(CC_AVX2_SUPPORT ) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;
@@ -3283,7 +3287,8 @@ i40e_get_recommend_tx_vec(void)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;
@@ -3311,7 +3316,9 @@ i40e_set_tx_function(struct rte_eth_dev *dev) }if (ad->tx_simple_allowed) { -if (ad->tx_vec_allowed) { +if (ad->tx_vec_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Vector tx finally be used." );if (ad->use_latest_vec) dev->tx_pkt_burst =
Signature · 1 line
2.17.1
PATCH v2 5/17 net/axgbe: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/axgbe/axgbe_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/axgbe/axgbe_rxtx.c +2 -1
@@ -553,7 +553,8 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,if (!pdata->tx_queues) pdata->tx_queues = dev->data->tx_queues; -if (txq->vector_disable) +if (txq->vector_disable ||rte_get_max_simd_bitwidth () + <RTE_MAX_128_SIMD ) dev->tx_pkt_burst = &axgbe_xmit_pkts; else#ifdef RTE_ARCH_X86
Signature · 1 line
2.17.1
PATCH v2 6/17 net/bnxt: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/bnxt/bnxt_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +4 -2
@@ -1100,7 +1100,8 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev) DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_RSS_HASH | DEV_RX_OFFLOAD_VLAN_FILTER)) && - !BNXT_TRUFLOW_EN(bp)) { + !BNXT_TRUFLOW_EN(bp) && rte_get_max_simd_bitwidth() + >= RTE_MAX_128_SIMD) {PMD_DRV_LOG (INFO ,"Using vector mode receive for port %d\n" , eth_dev->data->port_id); bp->flags |=BNXT_FLAG_RX_VECTOR_PKT_MODE ;
@@ -1132,7 +1133,8 @@ bnxt_transmit_function(__rte_unused struct rte_eth_dev *eth_dev)*/ if (!eth_dev->data->scattered_rx && !eth_dev->data->dev_conf.txmode.offloads && - !BNXT_TRUFLOW_EN (bp)) { + !BNXT_TRUFLOW_EN (bp) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) {PMD_DRV_LOG (INFO ,"Using vector mode transmit for port %d\n" , eth_dev->data->port_id);return bnxt_xmit_pkts_vec;
Signature · 1 line
2.17.1
PATCH v2 7/17 net/enic: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/enic/enic_rxtx_vec_avx2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/enic/enic_rxtx_vec_avx2.c +2 -1
@@ -821,7 +821,8 @@ enic_use_vector_rx_handler(struct rte_eth_dev *eth_dev) fconf = ð_dev->data->dev_conf.fdir_conf;if (fconf->mode !=RTE_FDIR_MODE_NONE )return false; -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) { +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) {ENICPMD_LOG (DEBUG ," use the non-scatter avx2 Rx handler" ); eth_dev->rx_pkt_burst = &enic_noscatter_vec_recv_pkts; enic->use_noscatter_vec_rx_handler =1 ;
Signature · 1 line
2.17.1
PATCH v2 8/17 net/fm10k: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/fm10k/fm10k_ethdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/fm10k/fm10k_ethdev.c +8 -3
@@ -2937,7 +2937,9 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {/* primary process has set the ftag flag and offloads */ txq = dev->data->tx_queues[0 ]; -if (fm10k_tx_vec_condition_check (txq)) { +if (fm10k_tx_vec_condition_check (txq) || +rte_get_max_simd_bitwidth () + <RTE_MAX_128_SIMD ) { dev->tx_pkt_burst = fm10k_xmit_pkts; dev->tx_pkt_prepare = fm10k_prep_pkts;PMD_INIT_LOG (DEBUG ,"Use regular Tx func" );
@@ -2956,7 +2958,8 @@ fm10k_set_tx_function(struct rte_eth_dev *dev) txq = dev->data->tx_queues[i]; txq->tx_ftag_en = tx_ftag_en;/* Check if Vector Tx is satisfied */ -if (fm10k_tx_vec_condition_check (txq)) +if (fm10k_tx_vec_condition_check (txq) || +rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) use_sse =0 ; }
@@ -2990,7 +2993,9 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)* conditions to be met. */ if (!fm10k_rx_vec_condition_check (dev) && - dev_info->rx_vec_allowed && !rx_ftag_en) { + dev_info->rx_vec_allowed && !rx_ftag_en && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {if (dev->data->scattered_rx) dev->rx_pkt_burst = fm10k_recv_scattered_pkts_vec;else
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 08/17] net/fm10k: add checks for max SIMD bitwidth
Hi Ciara,
BRs,
Xiao
Quoted 59 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Friday, August 28, 2020 12:13 AM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Zhang, Qi Z <[email protected]>; Wang, Xiao W <[email protected]>
Subject: [PATCH v2 08/17] net/fm10k: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Qi Zhang <[email protected]>Cc Xiao Wang <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/fm10k/fm10k_ethdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/net/fm10k/fm10k_ethdev.c +8
-4@@ -2937,7 +2937,9 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {/* primary process has set the ftag flag and offloads */ txq = dev->data->tx_queues[0 ]; -if (fm10k_tx_vec_condition_check (txq)) { +if (fm10k_tx_vec_condition_check (txq) || +rte_get_max_simd_bitwidth () + <RTE_MAX_128_SIMD ) { dev->tx_pkt_burst = fm10k_xmit_pkts; dev->tx_pkt_prepare = fm10k_prep_pkts;PMD_INIT_LOG (DEBUG ,"Use regular Tx func" );@@ -2956,7 +2958,8 @@ fm10k_set_tx_function(struct rte_eth_dev *dev) txq = dev->data->tx_queues[i]; txq->tx_ftag_en = tx_ftag_en;/* Check if Vector Tx is satisfied */ -if (fm10k_tx_vec_condition_check (txq)) +if (fm10k_tx_vec_condition_check (txq) || +rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) use_sse =0 ; }@@ -2990,7 +2993,9 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)* conditions to be met. */ if (!fm10k_rx_vec_condition_check (dev) && - dev_info->rx_vec_allowed && !rx_ftag_en) { + dev_info->rx_vec_allowed && !rx_ftag_en && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {if (dev->data->scattered_rx) dev->rx_pkt_burst = fm10k_recv_scattered_pkts_vec;else --
Quoted 1 line
2.17.1
Thanks~
PATCH v2 9/17 net/iavf: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/iavf/iavf_rxtx.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/net/iavf/iavf_rxtx.c +10 -6
@@ -2105,14 +2105,16 @@ iavf_set_rx_function(struct rte_eth_dev *dev)int i;bool use_avx2 = false; -if (!iavf_rx_vec_dev_check (dev)) { +if (!iavf_rx_vec_dev_check (dev) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) {for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; (void )iavf_rxq_vec_setup (rxq); } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) use_avx2 = true;if (dev->data->scattered_rx) {
@@ -2178,7 +2180,8 @@ iavf_set_tx_function(struct rte_eth_dev *dev)int i;bool use_avx2 = false; -if (!iavf_tx_vec_dev_check (dev)) { +if (!iavf_tx_vec_dev_check (dev) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) {for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];if (!txq)
@@ -2186,8 +2189,9 @@ iavf_set_tx_function(struct rte_eth_dev *dev)iavf_txq_vec_setup (txq); } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) use_avx2 = true; PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).",
Signature · 1 line
2.17.1
PATCH v2 10/17 net/ice: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/ice/ice_rxtx.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/net/ice/ice_rxtx.c +14 -6
@@ -2889,7 +2889,9 @@ ice_set_rx_function(struct rte_eth_dev *dev)bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed) { +if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) { ad->rx_vec_allowed = true;for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i];
@@ -2899,8 +2901,10 @@ ice_set_rx_function(struct rte_eth_dev *dev) } } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_256_SIMD ) use_avx2 = true; }else {
@@ -3067,7 +3071,9 @@ ice_set_tx_function(struct rte_eth_dev *dev)bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_tx_vec_dev_check (dev)) { +if (!ice_tx_vec_dev_check (dev) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) { ad->tx_vec_allowed = true;for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];
@@ -3077,8 +3083,10 @@ ice_set_tx_function(struct rte_eth_dev *dev) } } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_256_SIMD ) use_avx2 = true; }else {
Signature · 1 line
2.17.1
PATCH v2 11/17 net/ixgbe: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx.c +5 -2
@@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) dev->tx_pkt_prepare =NULL ;if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type () !=RTE_PROC_PRIMARY || -ixgbe_txq_vec_setup (txq) ==0 )) { +ixgbe_txq_vec_setup (txq) ==0 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Vector tx enabled." ); dev->tx_pkt_burst = ixgbe_xmit_pkts_vec; }else
@@ -4743,7 +4745,8 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev)* conditions to be met and Rx Bulk Allocation should be allowed. */ if (ixgbe_rx_vec_dev_conf_condition_check (dev) || - !adapter->rx_bulk_alloc_allowed) { + !adapter->rx_bulk_alloc_allowed || +rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Port[%d] doesn't meet Vector Rx " "preconditions" , dev->data->port_id);
Signature · 1 line
2.17.1
PATCH v2 12/17 net/mlx5: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
---
v2: Moved check for max bitwidth into existing check vec
support function.
--- drivers/net/mlx5/mlx5_rxtx_vec.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/mlx5/mlx5_rxtx_vec.c +2 -0
@@ -148,6 +148,8 @@ mlx5_check_vec_rx_support(struct rte_eth_dev *dev)struct mlx5_priv *priv = dev->data->dev_private;uint32_t i; +if (rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) +return -ENOTSUP ;if (!priv->config.rx_vec_en)return -ENOTSUP ;if (mlx5_mprq_enabled (dev))
Signature · 1 line
2.17.1
PATCH v2 13/17 net/virtio: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/virtio/virtio_ethdev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/virtio/virtio_ethdev.c +8 -4
@@ -1517,9 +1517,11 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)if (vtpci_packed_queue (hw)) {PMD_INIT_LOG (INFO ,"virtio: using packed ring %s Tx path on port %u" , - hw->use_vec_tx ?"vectorized" :"standard" , + (hw->use_vec_tx &&rte_get_max_simd_bitwidth () + >RTE_MAX_256_SIMD ) ?"vectorized" :"standard" , eth_dev->data->port_id); -if (hw->use_vec_tx) +if (hw->use_vec_tx &&rte_get_max_simd_bitwidth () + >RTE_MAX_256_SIMD ) eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed_vec;else eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed;
@@ -1536,7 +1538,8 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) }if (vtpci_packed_queue (hw)) { -if (hw->use_vec_rx) { +if (hw->use_vec_rx &&rte_get_max_simd_bitwidth () + >RTE_MAX_256_SIMD ) {PMD_INIT_LOG (INFO ,"virtio: using packed ring vectorized Rx path on port %u" , eth_dev->data->port_id);
@@ -1555,7 +1558,8 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &virtio_recv_pkts_packed; } }else { -if (hw->use_vec_rx) { +if (hw->use_vec_rx &&rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (INFO ,"virtio: using vectorized Rx path on port %u" , eth_dev->data->port_id); eth_dev->rx_pkt_burst = virtio_recv_pkts_vec;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 13/17] net/virtio: add checks for max SIMD bitwidth
Hi Ciara,
Sorry for late response and thanks for working on this! Currently virtio driver puts all vector-related conditions in dev_configure (virtio_dev_configure). Do you think it's ok to put all below code logic to dev_configure?
Thanks!
Chenbo
Quoted 65 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Friday, August 28, 2020 12:13 AM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Maxime Coquelin <[email protected]>; Xia, Chenbo <[email protected]>; Wang, Zhihong <[email protected]>
Subject: [PATCH v2 13/17] net/virtio: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Maxime Coquelin <[email protected]>Cc Chenbo Xia <[email protected]>Cc Zhihong Wang <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/net/virtio/virtio_ethdev.c +6
-3@@ -1517,9 +1517,11 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)if (vtpci_packed_queue (hw)) {PMD_INIT_LOG (INFO ,"virtio: using packed ring %s Tx path on port %u" , - hw->use_vec_tx ?"vectorized" :"standard" , + (hw->use_vec_tx &&rte_get_max_simd_bitwidth () + >RTE_MAX_256_SIMD ) ?"vectorized" :"standard" , eth_dev->data->port_id); -if (hw->use_vec_tx) +if (hw->use_vec_tx &&rte_get_max_simd_bitwidth () + >RTE_MAX_256_SIMD ) eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed_vec;else eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed;@@ -1536,7 +1538,8 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) }if (vtpci_packed_queue (hw)) { -if (hw->use_vec_rx) { +if (hw->use_vec_rx &&rte_get_max_simd_bitwidth () + >RTE_MAX_256_SIMD ) { PMD_INIT_LOG(INFO, "virtio: using packed ring vectorized Rx path on port %u",drivers/net/virtio/virtio_ethdev.c +2
-1eth_dev->data->port_id);@@ -1555,7 +1558,8 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &virtio_recv_pkts_packed; } }else { -if (hw->use_vec_rx) { +if (hw->use_vec_rx &&rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) { PMD_INIT_LOG(INFO, "virtio: using vectorized Rx path on port %u", eth_dev->data->port_id);
eth_dev->rx_pkt_burst=virtio_recv_pkts_vec;
--
2.17.1
PATCH v2 14/17 distributor: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- lib/librte_distributor/rte_distributor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/librte_distributor/rte_distributor.c +2 -1
@@ -636,7 +636,8 @@ rte_distributor_create(const char *name, d->dist_match_fn =RTE_DIST_MATCH_SCALAR ;#if defined(RTE_ARCH_X86 ) - d->dist_match_fn =RTE_DIST_MATCH_VECTOR ; +if (rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) + d->dist_match_fn =RTE_DIST_MATCH_VECTOR ;#endif /*
Signature · 1 line
2.17.1
PATCH v2 15/17 member: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- lib/librte_member/rte_member_ht.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/librte_member/rte_member_ht.c +2 -1
@@ -113,7 +113,8 @@ rte_member_create_ht(struct rte_member_setsum *ss, }#if defined(RTE_ARCH_X86 )if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && -RTE_MEMBER_BUCKET_ENTRIES ==16 ) +RTE_MEMBER_BUCKET_ENTRIES ==16 && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) ss->sig_cmp_fn =RTE_MEMBER_COMPARE_AVX2 ; else#endif
Signature · 1 line
2.17.1
PATCH v2 16/17 efd: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- lib/librte_efd/rte_efd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_efd/rte_efd.c +5 -2
@@ -645,7 +645,9 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,* For less than 4 bits, scalar function performs better * than vectorised version */ -if (RTE_EFD_VALUE_NUM_BITS >3 &&rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (RTE_EFD_VALUE_NUM_BITS >3 + &&rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) + &&rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) table->lookup_fn =EFD_LOOKUP_AVX2 ; else#endif
@@ -655,7 +657,8 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,* than vectorised version */ if (RTE_EFD_VALUE_NUM_BITS >16 && -rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON )) +rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) table->lookup_fn =EFD_LOOKUP_NEON ; else#endif
Signature · 1 line
2.17.1
PATCH v2 17/17 net: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path. This check is done just before the handler is called, it cannot be done when setting the handlers initially as the EAL max simd bitwidth value has not yet been set.
--- lib/librte_net/rte_net_crc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
lib/librte_net/rte_net_crc.c +8 -0
@@ -9,6 +9,7 @@#include <rte_cpuflags.h> #include <rte_common.h> #include <rte_net_crc.h> +#include <rte_eal.h> #if defined(RTE_ARCH_X86_64 ) && defined(RTE_MACHINE_CPUFLAG_PCLMULQDQ )#define X86_64_SSE42_PCLMULQDQ 1
@@ -60,6 +61,8 @@ static rte_net_crc_handler handlers_neon[] = { };#endif +static uint16_t max_simd_bitwidth; +/** * Reflect the bits about the middle *
@@ -175,6 +178,11 @@ rte_net_crc_calc(const void *data,uint32_t ret;rte_net_crc_handler f_handle; +if (max_simd_bitwidth ==0 ) + max_simd_bitwidth =rte_get_max_simd_bitwidth (); +if (max_simd_bitwidth <RTE_MAX_128_SIMD && + handlers != handlers_scalar) +rte_net_crc_set_alg (RTE_NET_CRC_SCALAR ); f_handle = handlers[type]; ret =f_handle (data, data_len);
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v2 17/17] net: add checks for max SIMD bitwidth
Quoted 44 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Thursday, August 27, 2020 5:13 PM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Singh, Jasvinder <[email protected]>; Olivier Matz <[email protected]>
Subject: [PATCH v2 17/17] net: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path. This check is done just before the handler is called, it cannot be done when setting the handlers initially as the EAL max simd bitwidth value has not yet been set.
Cc Jasvinder Singh <[email protected]>Signed-off-by Ciara Power <[email protected]>--- lib/librte_net/rte_net_crc.c | 8 ++++++++ 1 file changed, 8 insertions(+)lib/librte_net/rte_net_crc.c index renamed from lib/librte_net/rte_net_crc.c +0
-0
9fd4794a9d..d3d3206919100644lib/librte_net/rte_net_crc.c +1
-0@@ -9,6 +9,7 @@#include <rte_cpuflags.h> #include <rte_common.h> #include <rte_net_crc.h> +#include <rte_eal.h> #if defined(RTE_ARCH_X86_64 ) && defined(RTE_MACHINE_CPUFLAG_PCLMULQDQ )#define
X86_64_SSE42_PCLMULQDQ1lib/librte_net/rte_net_crc.c +2
-0@@ -60,6 +61,8 @@ static rte_net_crc_handler handlers_neon[] = { };#endif +static uint16_t max_simd_bitwidth; +/** * Reflect the bits about the middle *
lib/librte_net/rte_net_crc.c rte_net_crc_calc(const void *data, · line 185
Quoted 8 lines
lib/librte_net/rte_net_crc.c +5
-0@@ -175,6 +178,11 @@ rte_net_crc_calc(const void *data,uint32_t ret;rte_net_crc_handler f_handle; +if (max_simd_bitwidth ==0 ) + max_simd_bitwidth =rte_get_max_simd_bitwidth (); +if (max_simd_bitwidth <RTE_MAX_128_SIMD && + handlers != handlers_scalar) +rte_net_crc_set_alg (RTE_NET_CRC_SCALAR );
Above change doesn't seem right as rte_net_crc_set_alg () is invoked everytime when crc is computed. It potentially adds branches in runtime. In my opinion, bit width should be checked inside rte_net_crc_set_alg () function which is supposed to be used during initialization stage after eal sets the max simd bit width.
Quoted 5 lines
lib/librte_net/rte_net_crc.c +0
-1f_handle = handlers[type]; ret =f_handle (data, data_len); --2.17.1
v3 cover add max SIMD bitwidth to EAL
In reply to Ciara PowerA number of components in DPDK have optional AVX-512 or other vector code paths which can be selected at runtime. Rather than having each component provide its own mechanism to select a code path, this patchset adds support for a single setting to control what code paths are used. This can be used to enable some non-default code paths e.g. ones using AVX-512, but also to limit the code paths to certain vector widths, or to scalar code only, which is useful for testing.
The max SIMD bitwidth setting can be set by the app itself through use of the available API, or can be overriden by a commandline argument passed by the user.
v3:
- Added patch to add check for LPM lib
- Modified default max bitwidth for Arm to disable max SIMD bitwidth, which will allow for SVE.
- Added "0" as an acceptable value for command-line flag, which internally is used as UINT16_MAX to essentially disable max SIMD bitwidth limits.
- Made suggested changes to net lib patch.
- Rebased onto main.
v2:
- Added some documentation.
- Modified default max bitwidth for Arm.
- Moved mlx5 condition check into existing check vec support function.
- Added max SIMD bitwidth checks to some libraries.
Ciara Power (18):
eal: add max SIMD bitwidth
eal: add default SIMD bitwidth values
doc: add detail on using max SIMD bitwidth
net/i40e: add checks for max SIMD bitwidth
net/axgbe: add checks for max SIMD bitwidth
net/bnxt: add checks for max SIMD bitwidth
net/enic: add checks for max SIMD bitwidth
net/fm10k: add checks for max SIMD bitwidth
net/iavf: add checks for max SIMD bitwidth
net/ice: add checks for max SIMD bitwidth
net/ixgbe: add checks for max SIMD bitwidth
net/mlx5: add checks for max SIMD bitwidth
net/virtio: add checks for max SIMD bitwidth
distributor: add checks for max SIMD bitwidth
member: add checks for max SIMD bitwidth
efd: add checks for max SIMD bitwidth
net: add checks for max SIMD bitwidth
lpm: choose vector path at runtime
doc/guides/howto/avx512.rst | 36 ++++++++++ doc/guides/howto/index.rst | 1 + doc/guides/linux_gsg/eal_args.include.rst | 16 +++++ .../prog_guide/env_abstraction_layer.rst | 32 +++++++++ drivers/net/axgbe/axgbe_rxtx.c | 3 +- drivers/net/bnxt/bnxt_ethdev.c | 6 +- drivers/net/enic/enic_rxtx_vec_avx2.c | 3 +- drivers/net/fm10k/fm10k_ethdev.c | 11 ++- drivers/net/i40e/i40e_rxtx.c | 19 ++++-- drivers/net/iavf/iavf_rxtx.c | 16 +++-- drivers/net/ice/ice_rxtx.c | 20 ++++-- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +- drivers/net/mlx5/mlx5_rxtx_vec.c | 2 + drivers/net/virtio/virtio_ethdev.c | 9 ++- lib/librte_distributor/rte_distributor.c | 3 +- lib/librte_eal/arm/include/rte_vect.h | 2 + lib/librte_eal/common/eal_common_options.c | 67 +++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 33 +++++++++ lib/librte_eal/ppc/include/rte_vect.h | 2 + lib/librte_eal/rte_eal_version.map | 4 ++ lib/librte_eal/x86/include/rte_vect.h | 2 + lib/librte_efd/rte_efd.c | 7 +- lib/librte_lpm/rte_lpm.h | 57 +++++++++++++--- lib/librte_lpm/rte_lpm_altivec.h | 2 +- lib/librte_lpm/rte_lpm_neon.h | 2 +- lib/librte_lpm/rte_lpm_sse.h | 2 +- lib/librte_member/rte_member_ht.c | 3 +- lib/librte_net/rte_net_crc.c | 26 ++++--- lib/librte_net/rte_net_crc.h | 3 +- 31 files changed, 351 insertions(+), 55 deletions(-) create mode 100644 doc/guides/howto/avx512.rst
Signature · 1 line
2.17.1
PATCH v3 1/18 eal: add max SIMD bitwidth
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater than uint16_t.
v2: Added to Doxygen comment for API.
--- lib/librte_eal/common/eal_common_options.c | 64 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 33 +++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 111 insertions(+)
lib/librte_eal/common/eal_common_options.c +64 -0
@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };
@@ -1309,6 +1310,34 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) +{ +char *end; +unsigned long bitwidth; +int ret; +struct internal_config *internal_conf = +eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ; + + errno =0 ; + bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if (bitwidth >UINT16_MAX || errno !=0 || end ==NULL || *end !='\0' ) +return -1 ; + +if (bitwidth ==0 ) + bitwidth =UINT16_MAX ; + ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; + internal_conf->max_simd_bitwidth.locked = locked; +return 0 ; +} +static int eal_parse_base_virtaddr (const char *arg) {
@@ -1707,6 +1736,13 @@ eal_parse_common_option(int opt, const char *optarg,case OPT_NO_TELEMETRY_NUM : conf->no_telemetry =1 ;break ; +case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) { +RTE_LOG (ERR ,EAL ,"invalid parameter for --" +OPT_FORCE_MAX_SIMD_BITWIDTH "\n" ); +return -1 ; + } +break ;/* don't know what to do, leave this to caller */ default :
@@ -1903,6 +1939,33 @@ eal_check_common_options(struct internal_config *internal_cfg)return 0 ; } +uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +} + +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) +{ +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { +RTE_LOG (NOTICE ,EAL ,"Cannot set max SIMD bitwidth - user runtime override enabled" ); +return -EPERM ; + } + +if (bitwidth !=RTE_MAX_SIMD_DISABLE && (bitwidth <RTE_NO_SIMD || + !rte_is_power_of_2 (bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +} +void eal_common_usage (void ) {
@@ -1981,6 +2044,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --" OPT_TELEMETRY " Enable telemetry support (on by default)\n" " --" OPT_NO_TELEMETRY " Disable telemetry support\n" +" --" OPT_FORCE_MAX_SIMD_BITWIDTH " Force the max SIMD bitwidth\n" "\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n"
lib/librte_eal/common/eal_internal_cfg.h +8 -0
@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ +}; +/** * internal configuration */
@@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth; };void eal_reset_internal_config (struct internal_config *internal_cfg);
lib/librte_eal/common/eal_options.h +2 -0
@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };
lib/librte_eal/include/rte_eal.h +33 -0
@@ -43,6 +43,14 @@ enum rte_proc_type_t { RTE_PROC_INVALID }; +enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE =UINT16_MAX , +}; +/** * Get the process type in a multi-process setup *
@@ -51,6 +59,31 @@ enum rte_proc_type_t {*/ enum rte_proc_type_t rte_eal_process_type (void ); +/** +* Get the supported SIMD bitwidth. +* +* @return +* uint16_t bitwidth. +*/ +__rte_experimental +uint16_t rte_get_max_simd_bitwidth(void); + +/** +* Set the supported SIMD bitwidth. +* This API should only be called once at initialization, before EAL init. +* +* @param bitwidth +* uint16_t bitwidth. +* @return +* 0 on success. +* @return +* -EINVAL on invalid bitwidth parameter. +* @return +* -EPERM if bitwidth is locked. +*/ +__rte_experimental +int rte_set_max_simd_bitwidth(uint16_t bitwidth); +/** * Request iopl privilege for all RPL. *
lib/librte_eal/rte_eal_version.map +4 -0
@@ -397,6 +397,10 @@ EXPERIMENTAL { rte_service_lcore_may_be_active; rte_thread_register; rte_thread_unregister; + + # added in 20.11 + rte_get_max_simd_bitwidth; + rte_set_max_simd_bitwidth; }; INTERNAL {
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Hi Ciara
Quoted 2 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Ciara Power
<snip>
lib/librte_eal/common/eal_internal_cfg.h struct hugepage_info { · line 39
Quoted 13 lines
lib/librte_eal/common/eal_internal_cfg.h +4
-0@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ };
[DC] The doxygen comment on 'locked' flag uses '/**<' so should come after the field. Having the comment after the field seems to be the way it's done in this file so I'd move the comment as opposed to removing the '<'
lib/librte_eal/common/eal_internal_cfg.h struct internal_config { · line 95
Quoted 10 lines
lib/librte_eal/common/eal_internal_cfg.h +3
-0+/** * internal configuration */ @@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth;
[DC] Again the doxygen comments seem to come after the struct fields in this file so I'd move the comment for max_simd_bitwidth to after it and add the '<'
Quoted 3 lines
lib/librte_eal/common/eal_internal_cfg.h +0
-0}; void eal_reset_internal_config(struct internal_config *internal_cfg); diff --git
<snip>
Quoted 6 lines
lib/librte_eal/include/rte_eal.h +0
-0
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 52
Quoted 10 lines
lib/librte_eal/include/rte_eal.h +7
-0@@ -43,6 +43,14 @@ enum rte_proc_type_t { RTE_PROC_INVALID }; +enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE =UINT16_MAX , +};
[DC] Add doxygen comments on enum rte_max_simd_t and each of it's values
Quoted 19 lines
lib/librte_eal/include/rte_eal.h +12
-0+/** * Get the process type in a multi-process setup * @@ -51,6 +59,31 @@ enum rte_proc_type_t {*/ enum rte_proc_type_t rte_eal_process_type (void ); +/** +* Get the supported SIMD bitwidth. +* +* @return +* uint16_t bitwidth. +*/ +__rte_experimental +uint16_t rte_get_max_simd_bitwidth(void); + +/** +* Set the supported SIMD bitwidth.
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 82
Quoted 10 lines
lib/librte_eal/include/rte_eal.h +10
-0+* This API should only be called once at initialization, before EAL init. +* +* @param bitwidth +* uint16_t bitwidth. +* @return +* 0 on success. +* @return +* -EINVAL on invalid bitwidth parameter. +* @return +* -EPERM if bitwidth is locked.
[DC] Minor thing.. normally there's just 1 @return tag with all of the return values under it as a bullet list
Quoted 13 lines
lib/librte_eal/include/rte_eal.h +4
-0+*/ +__rte_experimental +int rte_set_max_simd_bitwidth(uint16_t bitwidth); +/** * Request iopl privilege for all RPL. * lib/librte_eal/rte_eal_version.map +0
-0
lib/librte_eal/rte_eal_version.map EXPERIMENTAL { · line 404
Quoted 8 lines
lib/librte_eal/rte_eal_version.map +4
-0@@ -397,6 +397,10 @@ EXPERIMENTAL { rte_service_lcore_may_be_active; rte_thread_register; rte_thread_unregister; + + # added in 20.11 + rte_get_max_simd_bitwidth; + rte_set_max_simd_bitwidth; };
[DC] rte_get_max_simd_bitwidth is called from rte_net_crc (and other libraries) so this symbol possibly needs to be added to librte_eal/rte_eal_exports.def file too.
This is the windows symbol export file, used on windows build.
This has caught us out on the AVX512 CRC patchset https://patchwork.dpdk.org/project/dpdk/list/?series=12596
where a windows build failed in the 'ci/iol-testing' checks in patchwork because rte_net_crc couldn't find the symbol rte_cpu_get_flag_enabled, which also comes
from rte_eal. We have to add this symbol to rte_eal_exports.def to fix this.
The 'ci/iol-testing' check has not run for your patchset so I can't say for certain if the windows build would have failed for you, but I think it would
Quoted 4 lines
lib/librte_eal/rte_eal_version.map +0
-1INTERNAL { --2.17.1
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
In reply to Ciara PowerHi Ciara,
Please find some comments below.
Quoted 84 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.--- lib/librte_eal/common/eal_common_options.c | 64 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 33 +++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 111 insertions(+)lib/librte_eal/common/eal_common_options.c +36
-0@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };@@ -1309,6 +1310,34 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) +{ +char *end; +unsigned long bitwidth; +int ret; +struct internal_config *internal_conf = +eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ; + + errno =0 ; + bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if (bitwidth >UINT16_MAX || errno !=0 || end ==NULL || *end !='\0' ) +return -1 ; + +if (bitwidth ==0 ) + bitwidth =UINT16_MAX ; + ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; + internal_conf->max_simd_bitwidth.locked = locked; +return 0 ; +} +static int eal_parse_base_virtaddr (const char *arg) {@@ -1707,6 +1736,13 @@ eal_parse_common_option(int opt, const char *optarg,case OPT_NO_TELEMETRY_NUM : conf->no_telemetry =1 ;break ; +case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) { +RTE_LOG (ERR ,EAL ,"invalid parameter for --" +OPT_FORCE_MAX_SIMD_BITWIDTH "\n" ); +return -1 ; + } +break ;/* don't know what to do, leave this to caller */ default :
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1948
Quoted 10 lines
lib/librte_eal/common/eal_common_options.c +7
-0@@ -1903,6 +1939,33 @@ eal_check_common_options(struct internal_config *internal_cfg)return 0 ; } +uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +}
Should the return value be enum rte_max_simd_t?
If not, do we really need the enum definition?
Quoted 9 lines
lib/librte_eal/common/eal_common_options.c +9
-0+ +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) +{ +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { +RTE_LOG (NOTICE ,EAL ,"Cannot set max SIMD bitwidth - user runtime override enabled" ); +return -EPERM ;
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1967
Quoted 10 lines
lib/librte_eal/common/eal_common_options.c +10
-0+ } + +if (bitwidth !=RTE_MAX_SIMD_DISABLE && (bitwidth <RTE_NO_SIMD || + !rte_is_power_of_2 (bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +}
Same question, should the parameter be enum rte_max_simd_t?
Quoted 56 lines
lib/librte_eal/common/eal_common_options.c +2
-0+void eal_common_usage (void ) {@@ -1981,6 +2044,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --" OPT_TELEMETRY " Enable telemetry support (on by default)\n" " --" OPT_NO_TELEMETRY " Disable telemetry support\n" +" --" OPT_FORCE_MAX_SIMD_BITWIDTH " Force the max SIMD bitwidth\n" "\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" lib/librte_eal/common/eal_internal_cfg.h +8
-0@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ +}; +/** * internal configuration */ @@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth; };void eal_reset_internal_config (struct internal_config *internal_cfg);lib/librte_eal/common/eal_options.h +2
-0@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };lib/librte_eal/include/rte_eal.h +0
-0
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 52
Quoted 10 lines
lib/librte_eal/include/rte_eal.h +7
-0@@ -43,6 +43,14 @@ enum rte_proc_type_t { RTE_PROC_INVALID }; +enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE =UINT16_MAX , +};
What is the difference between RTE_NO_SIMD and RTE_MAX_SIMD_DISABLE?
The default value in internal_config is 0, so in my understanding rte_get_max_simd_bitwidth() will return 0 if --force-max-simd-bitwidth is not passed. Is it expected?
Maybe I'm missing something, but I don't understand why the value in internal_config is not set to the maximum supported SIMD bitwidth by default, and optionally overriden by the command line argument, or by the API.
Quoted 54 lines
lib/librte_eal/include/rte_eal.h +26
-0+/** * Get the process type in a multi-process setup * @@ -51,6 +59,31 @@ enum rte_proc_type_t {*/ enum rte_proc_type_t rte_eal_process_type (void ); +/** +* Get the supported SIMD bitwidth. +* +* @return +* uint16_t bitwidth. +*/ +__rte_experimental +uint16_t rte_get_max_simd_bitwidth(void); + +/** +* Set the supported SIMD bitwidth. +* This API should only be called once at initialization, before EAL init. +* +* @param bitwidth +* uint16_t bitwidth. +* @return +* 0 on success. +* @return +* -EINVAL on invalid bitwidth parameter. +* @return +* -EPERM if bitwidth is locked. +*/ +__rte_experimental +int rte_set_max_simd_bitwidth(uint16_t bitwidth); +/** * Request iopl privilege for all RPL. * lib/librte_eal/rte_eal_version.map +4
-0@@ -397,6 +397,10 @@ EXPERIMENTAL { rte_service_lcore_may_be_active; rte_thread_register; rte_thread_unregister; + + # added in 20.11 + rte_get_max_simd_bitwidth; + rte_set_max_simd_bitwidth; }; INTERNAL {Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Hi Olivier,
Thanks for reviewing, some comments below.
Quoted 28 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Tuesday 6 October 2020 10:32
To: Power, Ciara <[email protected]>
Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Please find some comments below.
Quoted 15 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.
---
<snip>
Quoted 12 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1948
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +7
-0+uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +}Should the return value be enum
rte_max_simd_t?
If not, do we really need the enum definition?
I kept the return value and param value below as uint16_t to allow for arbitrary values, and will allow it be more flexible for future additions as new enums won't need to be added. For the set function below, this is used when a user passes the EAL command line flag, which passes an integer value rather than an enum one.
The enums are useful when checking the max_simd_bitwidth in drivers/libs, for example using "RTE_MAX_256_SIMD" instead of "256" in the condition checks.
Quoted 23 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg)
Quoted 7 lines
lib/librte_eal/common/eal_common_options.c +7
-0+ +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) { +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { + RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - userruntime override enabled");
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg)
Quoted 4 lines
lib/librte_eal/common/eal_common_options.c +4
-0+return -EPERM ; + } + + if (bitwidth != RTE_MAX_SIMD_DISABLE && (bitwidth <
RTE_NO_SIMD||lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1967
Quoted 7 lines
lib/librte_eal/common/eal_common_options.c +7
-0+ !rte_is_power_of_2(bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +}Same question, should the parameter be enum
rte_max_simd_t?
<snip>
Quoted 10 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 52
Quoted 7 lines
lib/librte_eal/include/rte_eal.h +7
-0+enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE =UINT16_MAX , +};What is the difference between
RTE_NO_SIMDandRTE_MAX_SIMD_DISABLE?
RTE_NO_SIMD has value 64 to limit paths to scalar only. RTE_MAX_SIMD_DISABLE sets the highest value possible,
so essentially disables the limit affecting which vector paths are taken. This disable option was added to allow for ARM SVE which will be later added, Discussed with Honnappa on a previous version: https://patchwork.dpdk.org/patch/76097/
Quoted 9 lines
The default value in
internal_configis 0, so in my understandingrte_get_max_simd_bitwidth()will return 0 if --force-max-simd-bitwidth is not passed. Is it expected?Maybe I'm missing something, but I don't understand why the value in
internal_configis not set to the maximum supported SIMD bitwidth by default, and optionally overriden by the command line argument, or by the API.
The default value for max_simd_bitwidth is set depending on the architecture, 256 for x86/ppc, and UINT16_MAX for ARM. So for example the default on x86 allows for AVX2 and under. The defaults can be seen in patch 2: https://patchwork.dpdk.org/patch/79339/
<snip>
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Quoted 49 lines · Ciara
Hi Olivier,
Thanks for reviewing, some comments below.
Quoted 28 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Tuesday 6 October 2020 10:32
To: Power, Ciara <[email protected]>
Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Please find some comments below.
Quoted 15 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.
---<snip>
Quoted 12 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1948
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +7
-0+uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +}Should the return value be enum
rte_max_simd_t? If not, do we really need the enum definition?
Quoted 7 lines
I kept the return value and param value below as
uint16_tto allow for arbitrary values, and will allow it be more flexible for future additions as new enums won't need to be added. For the set function below, this is used when a user passes the EAL command line flag, which passes an integer value rather than an enum one.
The enums are useful when checking themax_simd_bitwidthindrivers/libs, for example using "RTE_MAX_256_SIMD" instead of "256" in the condition checks.
So basically these enum values are #defines for readability, just in enum form, right?
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Hi Bruce,
Quoted 61 lines
-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Wednesday 7 October 2020 11:52
To: Power, Ciara <[email protected]>
Cc: Olivier Matz <[email protected]>; [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthQuoted 49 lines · Ciara
Hi Olivier,
Thanks for reviewing, some comments below.
Quoted 28 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Tuesday 6 October 2020 10:32
To: Power, Ciara <[email protected]>
Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Please find some comments below.
Quoted 15 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.
---<snip>
Quoted 12 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1948
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +7
-0+uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +}Should the return value be enum
rte_max_simd_t? If not, do we really need the enum definition?Quoted 2 lines
I kept the return value and param value below as
uint16_tto allow for arbitrary values, and will allow it be more flexible for future additions asnew enums won't need to be added.
Quoted 8 lines
Quoted 4 lines
For the set function below, this is used when a user passes the EAL command line flag, which passes an integer value rather than an enum one. The enums are useful when checking the
max_simd_bitwidthindrivers/libs, for example using "RTE_MAX_256_SIMD" instead of "256" inthe condition checks.
Quoted 1 line
So basically these enum values are #defines for readability, just in enum form, right?
Yes, that's exactly right.
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
In reply to Power, CiaraHi Ciara,
Quoted 93 lines · Ciara
Hi Olivier,
Thanks for reviewing, some comments below.
Quoted 28 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Tuesday 6 October 2020 10:32
To: Power, Ciara <[email protected]>
Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Please find some comments below.
Quoted 15 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.
---<snip>
Quoted 12 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1948
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +7
-0+uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +}Should the return value be enum
rte_max_simd_t?
If not, do we really need the enum definition?I kept the return value and param value below as
uint16_tto allow for arbitrary values, and will allow it be more flexible for future additions as new enums won't need to be added. For the set function below, this is used when a user passes the EAL command line flag, which passes an integer value rather than an enum one.
The enums are useful when checking themax_simd_bitwidthindrivers/libs, for example using "RTE_MAX_256_SIMD" instead of "256" in the condition checks.Quoted 23 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg)
Quoted 7 lines
lib/librte_eal/common/eal_common_options.c +7
-0+ +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) { +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { + RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - userruntime override enabled");
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg)
Quoted 4 lines
lib/librte_eal/common/eal_common_options.c +4
-0+return -EPERM ; + } + + if (bitwidth != RTE_MAX_SIMD_DISABLE && (bitwidth <
RTE_NO_SIMD||lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1967
Quoted 7 lines
lib/librte_eal/common/eal_common_options.c +7
-0+ !rte_is_power_of_2(bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +}Same question, should the parameter be enum
rte_max_simd_t?<snip>
Quoted 10 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 52
Quoted 7 lines
lib/librte_eal/include/rte_eal.h +7
-0+enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE =UINT16_MAX , +};What is the difference between
RTE_NO_SIMDandRTE_MAX_SIMD_DISABLE?
Quoted 5 lines
RTE_NO_SIMDhas value 64 to limit paths to scalar only.RTE_MAX_SIMD_DISABLEsets the highest value possible,
so essentially disables the limit affecting which vector paths are taken. This disable option was added to allow for ARM SVE which will be later added, Discussed with Honnappa on a previous version: https://patchwork.dpdk.org/patch/76097/
Ok, so RTE_MAX_SIMD_DISABLE means "disable the max limit", right?
I feel the name is a bit confusing. What about something like this:
enum rte_simd {
RTE_SIMD_DISABLED = 0,
RTE_SIMD_128 = 128,
RTE_SIMD_256 = 256,
RTE_SIMD_512 = 512,
RTE_SIMD_MAX = UINT16_MAX,
};Quoted 11 lines
Quoted 10 lines
The default value in
internal_configis 0, so in my understandingrte_get_max_simd_bitwidth()will return 0 if --force-max-simd-bitwidth is not passed. Is it expected?Maybe I'm missing something, but I don't understand why the value in
internal_configis not set to the maximum supported SIMD bitwidth by default, and optionally overriden by the command line argument, or by the API.
Quoted 3 lines
The default value for
max_simd_bitwidthis set depending on the architecture, 256 for x86/ppc, andUINT16_MAXfor ARM. So for example the default on x86 allows for AVX2 and under. The defaults can be seen in patch 2: https://patchwork.dpdk.org/patch/79339/
Ok, I was expecting to have a runtime check for this. For instance, on intel architecture, it is not known at compilation, it depends on the target which can support up to AVX, AVX2, or AVX512.
Quoted 5 lines
<snip>
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Hi Olivier,
Quoted 116 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Wednesday 7 October 2020 12:18
To: Power, Ciara <[email protected]>
Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>; Richardson, Bruce <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Quoted 49 lines · Ciara
Hi Olivier,
Thanks for reviewing, some comments below.
Quoted 28 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Tuesday 6 October 2020 10:32
To: Power, Ciara <[email protected]>
Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Please find some comments below.
Quoted 15 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.
---<snip>
Quoted 12 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1948
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +7
-0+uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +}Should the return value be enum
rte_max_simd_t?
If not, do we really need the enum definition?Quoted 2 lines
I kept the return value and param value below as
uint16_tto allow for arbitrary values, and will allow it be more flexible for future additions asnew enums won't need to be added.
Quoted 4 lines
For the set function below, this is used when a user passes the EAL command line flag, which passes an integer value rather than an enum one. The enums are useful when checking the
max_simd_bitwidthindrivers/libs, for example using "RTE_MAX_256_SIMD" instead of "256" inthe condition checks.
Quoted 27 lines
Quoted 24 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg)
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +7
-0+ +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) { +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { + RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - userruntime override enabled");
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg)
Quoted 4 lines
lib/librte_eal/common/eal_common_options.c +4
-0+return -EPERM ; + } + + if (bitwidth != RTE_MAX_SIMD_DISABLE && (bitwidth <
RTE_NO_SIMD||lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1967
Quoted 7 lines
lib/librte_eal/common/eal_common_options.c +7
-0+ !rte_is_power_of_2(bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +}Same question, should the parameter be enum
rte_max_simd_t?<snip>
Quoted 8 lines
Quoted 8 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t {
Quoted 6 lines
lib/librte_eal/include/rte_eal.h +6
-0+enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE =UINT16_MAX , };What is the difference between
RTE_NO_SIMDand
RTE_MAX_SIMD_DISABLE?Quoted 7 lines
RTE_NO_SIMDhas value 64 to limit paths to scalar only.RTE_MAX_SIMD_DISABLEsets the highest value possible, so essentially disables the limit affecting which vector paths are taken. This disable option was added to allow for ARM SVE which will be later added, Discussed with Honnappa on a previous version:
https://patchwork.dpdk.org/patch/76097/Ok, so
RTE_MAX_SIMD_DISABLEmeans "disable the max limit", right?I feel the name is a bit confusing. What about something like this:
Quoted 9 lines
enum rte_simd {
RTE_SIMD_DISABLED = 0,
RTE_SIMD_128 = 128,
RTE_SIMD_256 = 256,
RTE_SIMD_512 = 512,
RTE_SIMD_MAX = UINT16_MAX,
};Sure, I can rename these. Although will implement with RTE_SIMD_DISABLED=64 to allow for scalar path only.
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
The default value in
internal_configis 0, so in my understandingrte_get_max_simd_bitwidth()will return 0 if --force-max-simd-bitwidth is not passed. Is it expected?Quoted 8 lines
Quoted 5 lines
Maybe I'm missing something, but I don't understand why the value in
internal_configis not set to the maximum supported SIMD bitwidth by default, and optionally overriden by the command line argument, or by the API.The default value for
max_simd_bitwidthis set depending on the architecture, 256 for x86/ppc, andUINT16_MAXfor ARM. So for example
Quoted 8 lines
the default on x86 allows for AVX2 and under.
Quoted 2 lines
The defaults can be seen in patch 2:
https://patchwork.dpdk.org/patch/79339/Ok, I was expecting to have a runtime check for this. For instance, on intel architecture, it is not known at compilation, it depends on the target which can support up to AVX, AVX2, or AVX512.
Yes, the actual support will vary, but this max SIMD bitwidth is only an upper limit on what paths can be taken.
So for example with x86 default at 256, the path will still be chosen based on what the target can support, but it must be AVX2 or a lesser path. This allows for AVX512 to be enabled at runtime, by increasing the max SIMD bitwidth to 512, allowing for that path to be taken where supported.
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Hi Ciara,
Quoted 129 lines · Ciara
Hi Olivier,
Quoted 116 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Wednesday 7 October 2020 12:18
To: Power, Ciara <[email protected]>
Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>; Richardson, Bruce <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Quoted 49 lines · Ciara
Hi Olivier,
Thanks for reviewing, some comments below.
Quoted 28 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Tuesday 6 October 2020 10:32
To: Power, Ciara <[email protected]>
Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Please find some comments below.
Quoted 15 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.
---<snip>
Quoted 12 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1948
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +7
-0+uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +}Should the return value be enum
rte_max_simd_t?
If not, do we really need the enum definition?Quoted 2 lines
I kept the return value and param value below as
uint16_tto allow for arbitrary values, and will allow it be more flexible for future additions asnew enums won't need to be added.
Quoted 4 lines
For the set function below, this is used when a user passes the EAL command line flag, which passes an integer value rather than an enum one. The enums are useful when checking the
max_simd_bitwidthindrivers/libs, for example using "RTE_MAX_256_SIMD" instead of "256" inthe condition checks.
Quoted 27 lines
Quoted 24 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg)
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +7
-0+ +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) { +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { + RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - userruntime override enabled");
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg)
Quoted 4 lines
lib/librte_eal/common/eal_common_options.c +4
-0+return -EPERM ; + } + + if (bitwidth != RTE_MAX_SIMD_DISABLE && (bitwidth <
RTE_NO_SIMD||lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1967
Quoted 7 lines
lib/librte_eal/common/eal_common_options.c +7
-0+ !rte_is_power_of_2(bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +}Same question, should the parameter be enum
rte_max_simd_t?<snip>
Quoted 8 lines
Quoted 8 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t {
Quoted 6 lines
lib/librte_eal/include/rte_eal.h +6
-0+enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE =UINT16_MAX , };What is the difference between
RTE_NO_SIMDand
RTE_MAX_SIMD_DISABLE?Quoted 7 lines
RTE_NO_SIMDhas value 64 to limit paths to scalar only.RTE_MAX_SIMD_DISABLEsets the highest value possible, so essentially disables the limit affecting which vector paths are taken. This disable option was added to allow for ARM SVE which will be later added, Discussed with Honnappa on a previous version:
https://patchwork.dpdk.org/patch/76097/Ok, so
RTE_MAX_SIMD_DISABLEmeans "disable the max limit", right?I feel the name is a bit confusing. What about something like this:
Quoted 9 lines
enum rte_simd { RTE_SIMD_DISABLED = 0, RTE_SIMD_128 = 128, RTE_SIMD_256 = 256, RTE_SIMD_512 = 512, RTE_SIMD_MAX = UINT16_MAX, };
Quoted 1 line
Sure, I can rename these. Although will implement with RTE_SIMD_DISABLED=64 to allow for scalar path only.
Out of curiosity, why 64? I thought 0 was a good value for "disabled".
Quoted 17 lines
Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
The default value in
internal_configis 0, so in my understandingrte_get_max_simd_bitwidth()will return 0 if --force-max-simd-bitwidth is not passed. Is it expected?Quoted 8 lines
Quoted 5 lines
Maybe I'm missing something, but I don't understand why the value in
internal_configis not set to the maximum supported SIMD bitwidth by default, and optionally overriden by the command line argument, or by the API.The default value for
max_simd_bitwidthis set depending on the architecture, 256 for x86/ppc, andUINT16_MAXfor ARM. So for examplethe default on x86 allows for AVX2 and under.
Quoted 2 lines
The defaults can be seen in patch 2:
https://patchwork.dpdk.org/patch/79339/
Quoted 8 lines
Quoted 4 lines
Ok, I was expecting to have a runtime check for this. For instance, on intel architecture, it is not known at compilation, it depends on the target which can support up to AVX, AVX2, or AVX512.
Yes, the actual support will vary, but this max SIMD bitwidth is only an upper limit on what paths can be taken.
So for example with x86 default at 256, the path will still be chosen based on what the target can support, but it must be AVX2 or a lesser path. This allows for AVX512 to be enabled at runtime, by increasing the max SIMD bitwidth to 512, allowing for that path to be taken where supported.
Ah, this means that AVX512 won't be enabled by default on machine that support it? Is there a reason for that?
Another question: if the default value for max-simd-bitwidth is 256 on Intel, and we are running on a target that does not support AVX2, will the value be updated to 128 at initialization? In other word, is it still up to the dpdk libraries doing vector code to check the availability of vector instructions?
Thanks,
Olivier
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Hi Olivier,
Quoted 50 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Thursday 8 October 2020 11:04
To: Power, Ciara <[email protected]>
Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>; Richardson, Bruce <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Quoted 39 lines · Ciara
Hi Olivier,
Quoted 36 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Wednesday 7 October 2020 12:18
To: Power, Ciara <[email protected]>
Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>; Richardson, Bruce <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Quoted 24 lines · Ciara
Hi Olivier,
Thanks for reviewing, some comments below.
Quoted 19 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Tuesday 6 October 2020 10:32
To: Power, Ciara <[email protected]>
Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Please find some comments below.
Quoted 5 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
<snip>
Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 9 lines
Quoted 9 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t {
Quoted 7 lines
lib/librte_eal/include/rte_eal.h +6
-0+enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE =UINT16_MAX , };What is the difference between
RTE_NO_SIMDand
RTE_MAX_SIMD_DISABLE?Quoted 7 lines
RTE_NO_SIMDhas value 64 to limit paths to scalar only.RTE_MAX_SIMD_DISABLEsets the highest value possible, so essentially disables the limit affecting which vector paths are taken. This disable option was added to allow for ARM SVE which will be later added, Discussed with Honnappa on a previous version:
https://patchwork.dpdk.org/patch/76097/Ok, so
RTE_MAX_SIMD_DISABLEmeans "disable the max limit", right?I feel the name is a bit confusing. What about something like this:
enum rte_simd { RTE_SIMD_DISABLED = 0, RTE_SIMD_128 = 128, RTE_SIMD_256 = 256, RTE_SIMD_512 = 512, RTE_SIMD_MAX = UINT16_MAX, };
Quoted 5 lines
Quoted 1 line
Sure, I can rename these. Although will implement with
RTE_SIMD_DISABLED=64 to allow for scalar path only.
Out of curiosity, why 64? I thought 0 was a good value for "disabled".
64 was chosen because it represents the max bitwidth for the scalar path, 64 bits. Currently, we use 0 on the command-line to represent the RTE_SIMD_MAX = UINT16_MAX, as it is more user friendly to pass "--force-max-simd-bitwidth=0" rather than a max value, the 0 is then internally converted to the max value option. This would not be possible if we have the scalar option as 0 value.
Quoted 24 lines
Quoted 18 lines
Quoted 18 lines
Quoted 11 lines
Quoted 10 lines
The default value in
internal_configis 0, so in my understandingrte_get_max_simd_bitwidth()will return 0 if --force-max-simd-bitwidth is not passed. Is it expected?Maybe I'm missing something, but I don't understand why the value in
internal_configis not set to the maximum supported SIMD bitwidth by default, and optionally overriden by the command line argument, or by the API.Quoted 3 lines
The default value for
max_simd_bitwidthis set depending on the architecture, 256 for x86/ppc, andUINT16_MAXfor ARM. So for examplethe default on x86 allows for AVX2 and under.
Quoted 2 lines
The defaults can be seen in patch 2:
https://patchwork.dpdk.org/patch/79339/Quoted 6 lines
Quoted 4 lines
Ok, I was expecting to have a runtime check for this. For instance, on intel architecture, it is not known at compilation, it depends on the target which can support up to AVX, AVX2, or AVX512.
Yes, the actual support will vary, but this max SIMD bitwidth is only an
Quoted 9 lines
upper limit on what paths can be taken.
Quoted 1 line
So for example with x86 default at 256, the path will still be chosen based
on what the target can support, but it must be AVX2 or a lesser path.
Quoted 1 line
This allows for AVX512 to be enabled at runtime, by increasing the max
SIMD bitwidth to 512, allowing for that path to be taken where supported.
Ah, this means that AVX512 won't be enabled by default on machine that support it? Is there a reason for that?
We can't enable the AVX512 by default because it can cause CPU frequency slowdowns,
But this will allow runtime enabling to take that path if the app/user finds it is the best choice for their use, by setting the max SIMD bitwidth to 512.
Quoted 7 lines
Another question: if the default value for max-simd-bitwidth is 256 on Intel, and we are running on a target that does not support AVX2, will the value be updated to 128 at initialization? In other word, is it still up to the dpdk libraries doing vector code to check the availability of vector instructions?
Thanks,
Olivier
No the value is not updated depending on the support, it is just a limit.
Libraries still do the checks they had done previously to check what is supported, and once
that supported path is within the max SIMD bitwidth limit, it is okay to go ahead,
otherwise it will need to choose a lesser path.
For example, if a library supports AVX2, SSE and a scalar path, but the max SIMD bitwidth is set at 128 by app/user, although the library supports AVX2, it will be limited to choosing the SSE path.
Whereas if for example a library supports only SSE and a scalar path, and the default max SIMD bitwidth is used (256), the library can still choose SSE as it is below the 256 bit limit, and the limit remains at 256.
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Quoted 136 lines · Ciara
Hi Olivier,
Quoted 45 lines
-----Original Message----- From: Olivier Matz <[email protected]>
Sent: Thursday 8 October 2020 11:04 To: Power, Ciara <[email protected]> Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>; Richardson, Bruce <[email protected]> Subject: Re: [dpdk-dev] [PATCH v3 01/18]
eal: add max SIMD bitwidthHi Ciara,
Quoted 35 lines · Ciara
Hi Olivier,
Quoted 32 lines
-----Original Message----- From: Olivier Matz <[email protected]> Sent: Wednesday 7 October 2020 12:18 To:
Power, Ciara <[email protected]> Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>; Richardson, Bruce <[email protected]> Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Quoted 22 lines · Ciara
Hi Olivier,
Thanks for reviewing, some comments below.
Quoted 17 lines
-----Original Message----- From: Olivier Matz <[email protected]> Sent: Tuesday 6 October 2020 10:32 To:
Power, Ciara <[email protected]> Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Please find some comments below.
Quoted 5 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
<snip>
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
+enum
rte_max_simd_t{ +RTE_NO_SIMD = 64, +RTE_MAX_128_SIMD = 128, +RTE_MAX_256_SIMD = 256, +RTE_MAX_512_SIMD = 512, +RTE_MAX_SIMD_DISABLE =UINT16_MAX, };What is the difference between
RTE_NO_SIMDand
RTE_MAX_SIMD_DISABLE?Quoted 7 lines
RTE_NO_SIMDhas value 64 to limit paths to scalar only.RTE_MAX_SIMD_DISABLEsets the highest value possible, so essentially disables the limit affecting which vector paths are taken. This disable option was added to allow for ARM SVE which will be later added, Discussed with Honnappa on a previous version:
https://patchwork.dpdk.org/patch/76097/Ok, so
RTE_MAX_SIMD_DISABLEmeans "disable the max limit", right?I feel the name is a bit confusing. What about something like this:
enum
rte_simd{RTE_SIMD_DISABLED= 0,RTE_SIMD_128= 128,RTE_SIMD_256= 256,RTE_SIMD_512= 512,RTE_SIMD_MAX=UINT16_MAX, };Quoted 5 lines
Quoted 1 line
Sure, I can rename these. Although will implement with
RTE_SIMD_DISABLED=64 to allow for scalar path only.
Out of curiosity, why 64? I thought 0 was a good value for "disabled".
64 was chosen because it represents the max bitwidth for the scalar path, 64 bits. Currently, we use 0 on the command-line to represent the
RTE_SIMD_MAX=UINT16_MAX, as it is more user friendly to pass "--force-max-simd-bitwidth=0" rather than a max value, the 0 is then internally converted to the max value option. This would not be possible if we have the scalar option as 0 value.Quoted 28 lines
Quoted 18 lines
Quoted 18 lines
Quoted 11 lines
Quoted 10 lines
The default value in
internal_configis 0, so in my understandingrte_get_max_simd_bitwidth()will return 0 if --force-max-simd-bitwidth is not passed. Is it expected?Maybe I'm missing something, but I don't understand why the value in
internal_configis not set to the maximum supported SIMD bitwidth by default, and optionally overriden by the command line argument, or by the API.Quoted 3 lines
The default value for
max_simd_bitwidthis set depending on the architecture, 256 for x86/ppc, andUINT16_MAXfor ARM. So for examplethe default on x86 allows for AVX2 and under.
Quoted 2 lines
The defaults can be seen in patch 2:
https://patchwork.dpdk.org/patch/79339/Quoted 7 lines
Quoted 4 lines
Ok, I was expecting to have a runtime check for this. For instance, on intel architecture, it is not known at compilation, it depends on the target which can support up to AVX, AVX2, or AVX512.
Yes, the actual support will vary, but this max SIMD bitwidth is only an
upper limit on what paths can be taken.
Quoted 2 lines
So for example with x86 default at 256, the path will still be chosen based
Quoted 8 lines
on what the target can support, but it must be AVX2 or a lesser path.
Quoted 1 line
This allows for AVX512 to be enabled at runtime, by increasing the max
SIMD bitwidth to 512, allowing for that path to be taken where supported.
Ah, this means that AVX512 won't be enabled by default on machine that support it? Is there a reason for that?
We can't enable the AVX512 by default because it can cause CPU frequency slowdowns, But this will allow runtime enabling to take that path if the app/user finds it is the best choice for their use, by setting the max SIMD bitwidth to 512.
Quoted 7 lines
Another question: if the default value for max-simd-bitwidth is 256 on Intel, and we are running on a target that does not support AVX2, will the value be updated to 128 at initialization? In other word, is it still up to the dpdk libraries doing vector code to check the availability of vector instructions?
Thanks, Olivier
Quoted 11 lines
No the value is not updated depending on the support, it is just a limit. Libraries still do the checks they had done previously to check what is supported, and once that supported path is within the max SIMD bitwidth limit, it is okay to go ahead, otherwise it will need to choose a lesser path. For example, if a library supports AVX2, SSE and a scalar path, but the max SIMD bitwidth is set at 128 by app/user, although the library supports AVX2, it will be limited to choosing the SSE path. Whereas if for example a library supports only SSE and a scalar path, and the default max SIMD bitwidth is used (256), the library can still choose SSE as it is below the 256 bit limit, and the limit remains at 256.
Just to note too that the reason for keeping this separation is that the actual code path selection in each library is going to have to be architecture specific, e.g. to choose SSE or NEON for 128-bit width, whether or not the max-bitwidth functions take the running system into account. By leaving the libs/drivers to check the CPU support themselves, it keeps the max-bitwidth functions generic and saves having architecture-specific code in two places for this.
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Quoted 148 lines · Bruce Richardson
Quoted 136 lines · Ciara
Hi Olivier,
Quoted 45 lines
-----Original Message----- From: Olivier Matz <[email protected]>
Sent: Thursday 8 October 2020 11:04 To: Power, Ciara <[email protected]> Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>; Richardson, Bruce <[email protected]> Subject: Re: [dpdk-dev] [PATCH v3 01/18]
eal: add max SIMD bitwidthHi Ciara,
Quoted 35 lines · Ciara
Hi Olivier,
Quoted 32 lines
-----Original Message----- From: Olivier Matz <[email protected]> Sent: Wednesday 7 October 2020 12:18 To:
Power, Ciara <[email protected]> Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>; Richardson, Bruce <[email protected]> Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Quoted 22 lines · Ciara
Hi Olivier,
Thanks for reviewing, some comments below.
Quoted 17 lines
-----Original Message----- From: Olivier Matz <[email protected]> Sent: Tuesday 6 October 2020 10:32 To:
Power, Ciara <[email protected]> Cc: [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthHi Ciara,
Please find some comments below.
Quoted 5 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
<snip>
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
+enum
rte_max_simd_t{ +RTE_NO_SIMD = 64, +RTE_MAX_128_SIMD = 128, +RTE_MAX_256_SIMD = 256, +RTE_MAX_512_SIMD = 512, +RTE_MAX_SIMD_DISABLE =UINT16_MAX, };What is the difference between
RTE_NO_SIMDand
RTE_MAX_SIMD_DISABLE?Quoted 7 lines
RTE_NO_SIMDhas value 64 to limit paths to scalar only.RTE_MAX_SIMD_DISABLEsets the highest value possible, so essentially disables the limit affecting which vector paths are taken. This disable option was added to allow for ARM SVE which will be later added, Discussed with Honnappa on a previous version:
https://patchwork.dpdk.org/patch/76097/Ok, so
RTE_MAX_SIMD_DISABLEmeans "disable the max limit", right?I feel the name is a bit confusing. What about something like this:
enum
rte_simd{RTE_SIMD_DISABLED= 0,RTE_SIMD_128= 128,RTE_SIMD_256= 256,RTE_SIMD_512= 512,RTE_SIMD_MAX=UINT16_MAX, };Quoted 5 lines
Quoted 1 line
Sure, I can rename these. Although will implement with
RTE_SIMD_DISABLED=64 to allow for scalar path only.
Out of curiosity, why 64? I thought 0 was a good value for "disabled".
64 was chosen because it represents the max bitwidth for the scalar path, 64 bits. Currently, we use 0 on the command-line to represent the
RTE_SIMD_MAX=UINT16_MAX, as it is more user friendly to pass "--force-max-simd-bitwidth=0" rather than a max value, the 0 is then internally converted to the max value option. This would not be possible if we have the scalar option as 0 value.Quoted 28 lines
Quoted 18 lines
Quoted 18 lines
Quoted 11 lines
Quoted 10 lines
The default value in
internal_configis 0, so in my understandingrte_get_max_simd_bitwidth()will return 0 if --force-max-simd-bitwidth is not passed. Is it expected?Maybe I'm missing something, but I don't understand why the value in
internal_configis not set to the maximum supported SIMD bitwidth by default, and optionally overriden by the command line argument, or by the API.Quoted 3 lines
The default value for
max_simd_bitwidthis set depending on the architecture, 256 for x86/ppc, andUINT16_MAXfor ARM. So for examplethe default on x86 allows for AVX2 and under.
Quoted 2 lines
The defaults can be seen in patch 2:
https://patchwork.dpdk.org/patch/79339/Quoted 7 lines
Quoted 4 lines
Ok, I was expecting to have a runtime check for this. For instance, on intel architecture, it is not known at compilation, it depends on the target which can support up to AVX, AVX2, or AVX512.
Yes, the actual support will vary, but this max SIMD bitwidth is only an
upper limit on what paths can be taken.
Quoted 2 lines
So for example with x86 default at 256, the path will still be chosen based
Quoted 8 lines
on what the target can support, but it must be AVX2 or a lesser path.
Quoted 1 line
This allows for AVX512 to be enabled at runtime, by increasing the max
SIMD bitwidth to 512, allowing for that path to be taken where supported.
Ah, this means that AVX512 won't be enabled by default on machine that support it? Is there a reason for that?
We can't enable the AVX512 by default because it can cause CPU frequency slowdowns, But this will allow runtime enabling to take that path if the app/user finds it is the best choice for their use, by setting the max SIMD bitwidth to 512.
Quoted 7 lines
Another question: if the default value for max-simd-bitwidth is 256 on Intel, and we are running on a target that does not support AVX2, will the value be updated to 128 at initialization? In other word, is it still up to the dpdk libraries doing vector code to check the availability of vector instructions?
Thanks, Olivier
Quoted 11 lines
No the value is not updated depending on the support, it is just a limit. Libraries still do the checks they had done previously to check what is supported, and once that supported path is within the max SIMD bitwidth limit, it is okay to go ahead, otherwise it will need to choose a lesser path. For example, if a library supports AVX2, SSE and a scalar path, but the max SIMD bitwidth is set at 128 by app/user, although the library supports AVX2, it will be limited to choosing the SSE path. Whereas if for example a library supports only SSE and a scalar path, and the default max SIMD bitwidth is used (256), the library can still choose SSE as it is below the 256 bit limit, and the limit remains at 256.
Quoted 7 lines
Just to note too that the reason for keeping this separation is that the actual code path selection in each library is going to have to be architecture specific, e.g. to choose SSE or NEON for 128-bit width, whether or not the max-bitwidth functions take the running system into account. By leaving the libs/drivers to check the CPU support themselves, it keeps the max-bitwidth functions generic and saves having architecture-specific code in two places for this.
Ok, that's clearer to me, thanks Ciara and Bruce.
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
In reply to Ciara PowerQuoted 49 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.--- lib/librte_eal/common/eal_common_options.c | 64 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 33 +++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 111 insertions(+)lib/librte_eal/common/eal_common_options.c +12
-0@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };@@ -1309,6 +1310,34 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) +{ +char *end; +unsigned long bitwidth; +int ret; +struct internal_config *internal_conf = +eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ;
lib/librte_eal/common/eal_common_options.c eal_parse_iova_mode(const char *name) · line 1333
Quoted 10 lines
lib/librte_eal/common/eal_common_options.c +10
-0+ + errno =0 ; + bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if (bitwidth >UINT16_MAX || errno !=0 || end ==NULL || *end !='\0' ) +return -1 ; + +if (bitwidth ==0 ) + bitwidth =UINT16_MAX ;
(unsigned long)RTE_MAX_SIMD_DISABLE instead?
Quoted 25 lines
lib/librte_eal/common/eal_common_options.c +14
-0+ ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; + internal_conf->max_simd_bitwidth.locked = locked; +return 0 ; +} +static int eal_parse_base_virtaddr (const char *arg) {@@ -1707,6 +1736,13 @@ eal_parse_common_option(int opt, const char *optarg,case OPT_NO_TELEMETRY_NUM : conf->no_telemetry =1 ;break ; +case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) { +RTE_LOG (ERR ,EAL ,"invalid parameter for --" +OPT_FORCE_MAX_SIMD_BITWIDTH "\n" ); +return -1 ; + } +break ;/* don't know what to do, leave this to caller */ default :
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1942
Quoted 4 lines
lib/librte_eal/common/eal_common_options.c +1
-0@@ -1903,6 +1939,33 @@ eal_check_common_options(struct internal_config *internal_cfg)return 0 ; } +uint16_t
shouldn't it return an enum rte_max_simd_t?
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1947
Quoted 5 lines
lib/librte_eal/common/eal_common_options.c +5
-0+rte_get_max_simd_bitwidth (void) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth;
What is the default value if not set?
Quoted 138 lines
lib/librte_eal/common/eal_common_options.c +22
-0+} + +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) +{ +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { +RTE_LOG (NOTICE ,EAL ,"Cannot set max SIMD bitwidth - user runtime override enabled" ); +return -EPERM ; + } + +if (bitwidth !=RTE_MAX_SIMD_DISABLE && (bitwidth <RTE_NO_SIMD || + !rte_is_power_of_2 (bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +} +void eal_common_usage (void ) {@@ -1981,6 +2044,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --" OPT_TELEMETRY " Enable telemetry support (on by default)\n" " --" OPT_NO_TELEMETRY " Disable telemetry support\n" +" --" OPT_FORCE_MAX_SIMD_BITWIDTH " Force the max SIMD bitwidth\n" "\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" lib/librte_eal/common/eal_internal_cfg.h +8
-0@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ +}; +/** * internal configuration */ @@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth; };void eal_reset_internal_config (struct internal_config *internal_cfg);lib/librte_eal/common/eal_options.h +2
-0@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };lib/librte_eal/include/rte_eal.h +33
-0@@ -43,6 +43,14 @@ enum rte_proc_type_t { RTE_PROC_INVALID }; +enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE =UINT16_MAX , +}; +/** * Get the process type in a multi-process setup * @@ -51,6 +59,31 @@ enum rte_proc_type_t {*/ enum rte_proc_type_t rte_eal_process_type (void ); +/** +* Get the supported SIMD bitwidth. +* +* @return +* uint16_t bitwidth. +*/ +__rte_experimental +uint16_t rte_get_max_simd_bitwidth(void); + +/** +* Set the supported SIMD bitwidth. +* This API should only be called once at initialization, before EAL init. +* +* @param bitwidth +* uint16_t bitwidth. +* @return +* 0 on success. +* @return +* -EINVAL on invalid bitwidth parameter. +* @return +* -EPERM if bitwidth is locked. +*/ +__rte_experimental +int rte_set_max_simd_bitwidth(uint16_t bitwidth); +/** * Request iopl privilege for all RPL. * lib/librte_eal/rte_eal_version.map +4
-0@@ -397,6 +397,10 @@ EXPERIMENTAL { rte_service_lcore_may_be_active; rte_thread_register; rte_thread_unregister; + + # added in 20.11 + rte_get_max_simd_bitwidth; + rte_set_max_simd_bitwidth; }; INTERNAL {
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Hi Maxime,
Thanks for reviewing, some comments below.
Quoted 25 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday 6 October 2020 12:50
To: Power, Ciara <[email protected]>; [email protected]
Cc: Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthQuoted 15 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.
---
<snip>
Quoted 8 lines
Review eal_check_common_options(struct
Quoted 1 line
(quoted diff) +0
-0@@ -1903,6 +1939,33 @@ eal_check_common_options(struct
internal_config*internal_cfg)lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1942
Quoted 4 lines
lib/librte_eal/common/eal_common_options.c +1
-0return 0 ; } +uint16_t shouldn't it return an enum
rte_max_simd_t?
I kept the return value as uint16_t to allow for arbitrary values,
and will allow it be more flexible for future additions as new enums won't need to be added. The enums are really used for readability when checking the bitwidth limit in drivers/libs, so essentially #defines in enum form.
Quoted 9 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1947
Quoted 6 lines
lib/librte_eal/common/eal_common_options.c +5
-0+rte_get_max_simd_bitwidth (void) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth;What is the default value if not set?
The default value for max_simd_bitwidth is set depending on the architecture, 256 for x86/ppc, and UINT16_MAX for ARM. So for example the default on x86 allows for AVX2 and under. The defaults can be seen in patch 2: https://patchwork.dpdk.org/patch/79339/
<snip>
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
In reply to Ciara PowerQuoted 170 lines
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.--- lib/librte_eal/common/eal_common_options.c | 64 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 33 +++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 111 insertions(+)lib/librte_eal/common/eal_common_options.c +64
-0@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };@@ -1309,6 +1310,34 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) +{ +char *end; +unsigned long bitwidth; +int ret; +struct internal_config *internal_conf = +eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ; + + errno =0 ; + bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if (bitwidth >UINT16_MAX || errno !=0 || end ==NULL || *end !='\0' ) +return -1 ; + +if (bitwidth ==0 ) + bitwidth =UINT16_MAX ; + ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; + internal_conf->max_simd_bitwidth.locked = locked; +return 0 ; +} +static int eal_parse_base_virtaddr (const char *arg) {@@ -1707,6 +1736,13 @@ eal_parse_common_option(int opt, const char *optarg,case OPT_NO_TELEMETRY_NUM : conf->no_telemetry =1 ;break ; +case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) { +RTE_LOG (ERR ,EAL ,"invalid parameter for --" +OPT_FORCE_MAX_SIMD_BITWIDTH "\n" ); +return -1 ; + } +break ;/* don't know what to do, leave this to caller */ default :@@ -1903,6 +1939,33 @@ eal_check_common_options(struct internal_config *internal_cfg)return 0 ; } +uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +} + +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) +{ +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { +RTE_LOG (NOTICE ,EAL ,"Cannot set max SIMD bitwidth - user runtime override enabled" ); +return -EPERM ; + } + +if (bitwidth !=RTE_MAX_SIMD_DISABLE && (bitwidth <RTE_NO_SIMD || + !rte_is_power_of_2 (bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +} +void eal_common_usage (void ) {@@ -1981,6 +2044,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --" OPT_TELEMETRY " Enable telemetry support (on by default)\n" " --" OPT_NO_TELEMETRY " Disable telemetry support\n" +" --" OPT_FORCE_MAX_SIMD_BITWIDTH " Force the max SIMD bitwidth\n" "\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" lib/librte_eal/common/eal_internal_cfg.h +8
-0@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ +}; +/** * internal configuration */ @@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth; };void eal_reset_internal_config (struct internal_config *internal_cfg);lib/librte_eal/common/eal_options.h +2
-0@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };lib/librte_eal/include/rte_eal.h +0
-0
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 47
Quoted 5 lines
lib/librte_eal/include/rte_eal.h +2
-0@@ -43,6 +43,14 @@ enum rte_proc_type_t {RTE_PROC_INVALID }; +enum rte_max_simd_t { +RTE_NO_SIMD =64 ,
While I do understand the idea of having that value from consistency point of view, I wonder do we really need to allow user to specify values smaller then 128. At least on x86 we always have 128 bit SIMD enabled, even for -Dmachine=default. So seems no much point to forbid libraries using SSE code-path when compiler is free to insert SSE instructions on its own will.
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 51
Quoted 4 lines
lib/librte_eal/include/rte_eal.h +4
-0+RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , + RTE_MAX_SIMD_DISABLE = UINT16_MAX,
As a nit, I think it is safe enough to have this last value (RTE_MAX_SIMD_DISABLE or RTE_MAX_SIMD_MAX) equal to (INT16_MAX + 1). That would be big enough to probably never hit actual HW limit, while it still remains power of two, as other values.
Quoted 54 lines
lib/librte_eal/include/rte_eal.h +27
-0+}; +/** * Get the process type in a multi-process setup * @@ -51,6 +59,31 @@ enum rte_proc_type_t {*/ enum rte_proc_type_t rte_eal_process_type (void ); +/** +* Get the supported SIMD bitwidth. +* +* @return +* uint16_t bitwidth. +*/ +__rte_experimental +uint16_t rte_get_max_simd_bitwidth(void); + +/** +* Set the supported SIMD bitwidth. +* This API should only be called once at initialization, before EAL init. +* +* @param bitwidth +* uint16_t bitwidth. +* @return +* 0 on success. +* @return +* -EINVAL on invalid bitwidth parameter. +* @return +* -EPERM if bitwidth is locked. +*/ +__rte_experimental +int rte_set_max_simd_bitwidth(uint16_t bitwidth); +/** * Request iopl privilege for all RPL. * lib/librte_eal/rte_eal_version.map +4
-1@@ -397,6 +397,10 @@ EXPERIMENTAL { rte_service_lcore_may_be_active; rte_thread_register; rte_thread_unregister; + + # added in 20.11 + rte_get_max_simd_bitwidth; + rte_set_max_simd_bitwidth; }; INTERNAL { --2.17.1
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Quoted 173 lines · Konstantin
Quoted 173 lines
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.--- lib/librte_eal/common/eal_common_options.c | 64 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 33 +++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 111 insertions(+)lib/librte_eal/common/eal_common_options.c +64
-0@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };@@ -1309,6 +1310,34 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) +{ +char *end; +unsigned long bitwidth; +int ret; +struct internal_config *internal_conf = +eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ; + + errno =0 ; + bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if (bitwidth >UINT16_MAX || errno !=0 || end ==NULL || *end !='\0' ) +return -1 ; + +if (bitwidth ==0 ) + bitwidth =UINT16_MAX ; + ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; + internal_conf->max_simd_bitwidth.locked = locked; +return 0 ; +} +static int eal_parse_base_virtaddr (const char *arg) {@@ -1707,6 +1736,13 @@ eal_parse_common_option(int opt, const char *optarg,case OPT_NO_TELEMETRY_NUM : conf->no_telemetry =1 ;break ; +case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) { +RTE_LOG (ERR ,EAL ,"invalid parameter for --" +OPT_FORCE_MAX_SIMD_BITWIDTH "\n" ); +return -1 ; + } +break ;/* don't know what to do, leave this to caller */ default :@@ -1903,6 +1939,33 @@ eal_check_common_options(struct internal_config *internal_cfg)return 0 ; } +uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +} + +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) +{ +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { +RTE_LOG (NOTICE ,EAL ,"Cannot set max SIMD bitwidth - user runtime override enabled" ); +return -EPERM ; + } + +if (bitwidth !=RTE_MAX_SIMD_DISABLE && (bitwidth <RTE_NO_SIMD || + !rte_is_power_of_2 (bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +} +void eal_common_usage (void ) {@@ -1981,6 +2044,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --" OPT_TELEMETRY " Enable telemetry support (on by default)\n" " --" OPT_NO_TELEMETRY " Disable telemetry support\n" +" --" OPT_FORCE_MAX_SIMD_BITWIDTH " Force the max SIMD bitwidth\n" "\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" lib/librte_eal/common/eal_internal_cfg.h +8
-0@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ +}; +/** * internal configuration */ @@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth; };void eal_reset_internal_config (struct internal_config *internal_cfg);lib/librte_eal/common/eal_options.h +2
-0@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };lib/librte_eal/include/rte_eal.h +0
-0@@ -43,6 +43,14 @@ enum rte_proc_type_t { RTE_PROC_INVALID };
Quoted 9 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 47
Quoted 2 lines
lib/librte_eal/include/rte_eal.h +2
-0+enum rte_max_simd_t { +RTE_NO_SIMD =64 ,While I do understand the idea of having that value from consistency point of view, I wonder do we really need to allow user to specify values smaller then 128. At least on x86 we always have 128 bit SIMD enabled, even for -Dmachine=default. So seems no much point to forbid libraries using SSE code-path when compiler is free to insert SSE instructions on its own will.
The reason to support this is for testing purposes, as it allows an easy way for a tester to check out any scalar code paths - which are often common across architectures.
Quoted 10 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 51
Quoted 4 lines
lib/librte_eal/include/rte_eal.h +4
-0+RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , + RTE_MAX_SIMD_DISABLE = UINT16_MAX,As a nit, I think it is safe enough to have this last value (
RTE_MAX_SIMD_DISABLEorRTE_MAX_SIMD_MAX) equal to (INT16_MAX+ 1). That would be big enough to probably never hit actual HW limit, while it still remains power of two, as other values.
I actually think it's probably clearer as-is, because the fact of the rest being powers of 2 is irrelevant since we just check greater than or less than. If we did change it, then we need to put in a comment explaining why the plus-one, while as it is now it's clearly a placeholder $BIGNUM.
/Bruce
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Quoted 185 lines · Konstantin
Quoted 173 lines
Quoted 173 lines
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.--- lib/librte_eal/common/eal_common_options.c | 64 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 33 +++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 111 insertions(+)lib/librte_eal/common/eal_common_options.c +64
-0@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };@@ -1309,6 +1310,34 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) +{ +char *end; +unsigned long bitwidth; +int ret; +struct internal_config *internal_conf = +eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ; + + errno =0 ; + bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if (bitwidth >UINT16_MAX || errno !=0 || end ==NULL || *end !='\0' ) +return -1 ; + +if (bitwidth ==0 ) + bitwidth =UINT16_MAX ; + ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; + internal_conf->max_simd_bitwidth.locked = locked; +return 0 ; +} +static int eal_parse_base_virtaddr (const char *arg) {@@ -1707,6 +1736,13 @@ eal_parse_common_option(int opt, const char *optarg,case OPT_NO_TELEMETRY_NUM : conf->no_telemetry =1 ;break ; +case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) { +RTE_LOG (ERR ,EAL ,"invalid parameter for --" +OPT_FORCE_MAX_SIMD_BITWIDTH "\n" ); +return -1 ; + } +break ;/* don't know what to do, leave this to caller */ default :@@ -1903,6 +1939,33 @@ eal_check_common_options(struct internal_config *internal_cfg)return 0 ; } +uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +} + +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) +{ +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { +RTE_LOG (NOTICE ,EAL ,"Cannot set max SIMD bitwidth - user runtime override enabled" ); +return -EPERM ; + } + +if (bitwidth !=RTE_MAX_SIMD_DISABLE && (bitwidth <RTE_NO_SIMD || + !rte_is_power_of_2 (bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +} +void eal_common_usage (void ) {@@ -1981,6 +2044,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --" OPT_TELEMETRY " Enable telemetry support (on by default)\n" " --" OPT_NO_TELEMETRY " Disable telemetry support\n" +" --" OPT_FORCE_MAX_SIMD_BITWIDTH " Force the max SIMD bitwidth\n" "\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" lib/librte_eal/common/eal_internal_cfg.h +8
-0@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ +}; +/** * internal configuration */ @@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth; };void eal_reset_internal_config (struct internal_config *internal_cfg);lib/librte_eal/common/eal_options.h +2
-0@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };lib/librte_eal/include/rte_eal.h +0
-0@@ -43,6 +43,14 @@ enum rte_proc_type_t { RTE_PROC_INVALID };Quoted 9 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 47
Quoted 2 lines
lib/librte_eal/include/rte_eal.h +2
-0+enum rte_max_simd_t { +RTE_NO_SIMD =64 ,While I do understand the idea of having that value from consistency point of view, I wonder do we really need to allow user to specify values smaller then 128. At least on x86 we always have 128 bit SIMD enabled, even for -Dmachine=default. So seems no much point to forbid libraries using SSE code-path when compiler is free to insert SSE instructions on its own will.
Quoted 3 lines
The reason to support this is for testing purposes, as it allows an easy way for a tester to check out any scalar code paths - which are often common across architectures.
If it is just for testing things in a consistent way, then it is probably ok. The thing that worries me - later in this series there are patches that insert extra checks into inline functions that use SSE instincts:
https://patches.dpdk.org/patch/79355/ (lpm: choose vector path at runtime). Which seems like a total overkill for me.
Quoted 12 lines
Quoted 11 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 51
Quoted 5 lines
lib/librte_eal/include/rte_eal.h +4
-0+RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , + RTE_MAX_SIMD_DISABLE = UINT16_MAX,As a nit, I think it is safe enough to have this last value (
RTE_MAX_SIMD_DISABLEorRTE_MAX_SIMD_MAX) equal to (INT16_MAX+ 1). That would be big enough to probably never hit actual HW limit, while it still remains power of two, as other values.
Quoted 3 lines
I actually think it's probably clearer as-is, because the fact of the rest being powers of 2 is irrelevant since we just check greater than or less than.
Well, rte_set_max_simd_bitwidth() does accept only power of two values _AND_ this special one (UINT16_MAX).
By changing it to 2^15, we can remove that special value test.
Quoted 2 lines
If we did change it, then we need to put in a comment explaining why the plus-one,
I don't think it is that big deal to put a comment, plus for UINT16_MAX we do need some explanation too, right?
Quoted 3 lines
while as it is now it's clearly a placeholder $BIGNUM.
/Bruce
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Quoted 215 lines · Konstantin
Quoted 185 lines · Konstantin
Quoted 173 lines
Quoted 173 lines
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.--- lib/librte_eal/common/eal_common_options.c | 64 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 33 +++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 111 insertions(+)lib/librte_eal/common/eal_common_options.c +64
-0@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, +{OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };@@ -1309,6 +1310,34 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) +{ +char *end; +unsigned long bitwidth; +int ret; +struct internal_config *internal_conf = +eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ; + +errno =0 ; +bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if (bitwidth >UINT16_MAX || errno !=0 || end ==NULL || *end !='\0' ) +return -1 ; + +if (bitwidth ==0 ) +bitwidth =UINT16_MAX ; +ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; +internal_conf->max_simd_bitwidth.locked = locked; +return 0 ; +} +static int eal_parse_base_virtaddr (const char *arg) {@@ -1707,6 +1736,13 @@ eal_parse_common_option(int opt, const char *optarg,case OPT_NO_TELEMETRY_NUM : conf->no_telemetry =1 ;break ; +case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) { +RTE_LOG (ERR ,EAL ,"invalid parameter for --" +OPT_FORCE_MAX_SIMD_BITWIDTH "\n" ); +return -1 ; +} +break ;/* don't know what to do, leave this to caller */ default :@@ -1903,6 +1939,33 @@ eal_check_common_options(struct internal_config *internal_cfg)return 0 ; } +uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +} + +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) +{ +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { +RTE_LOG (NOTICE ,EAL ,"Cannot set max SIMD bitwidth - user runtime override enabled" ); +return -EPERM ; +} + +if (bitwidth !=RTE_MAX_SIMD_DISABLE && (bitwidth <RTE_NO_SIMD || +!rte_is_power_of_2 (bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; +} +internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +} +void eal_common_usage (void ) {@@ -1981,6 +2044,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --" OPT_TELEMETRY " Enable telemetry support (on by default)\n" " --" OPT_NO_TELEMETRY " Disable telemetry support\n" +" --" OPT_FORCE_MAX_SIMD_BITWIDTH " Force the max SIMD bitwidth\n" "\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" lib/librte_eal/common/eal_internal_cfg.h +8
-0@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ +}; +/** * internal configuration */ @@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth; };void eal_reset_internal_config (struct internal_config *internal_cfg);lib/librte_eal/common/eal_options.h +2
-0@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };lib/librte_eal/include/rte_eal.h +0
-0@@ -43,6 +43,14 @@ enum rte_proc_type_t { RTE_PROC_INVALID };Quoted 9 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 47
Quoted 2 lines
lib/librte_eal/include/rte_eal.h +2
-0+enum rte_max_simd_t { +RTE_NO_SIMD =64 ,While I do understand the idea of having that value from consistency point of view, I wonder do we really need to allow user to specify values smaller then 128. At least on x86 we always have 128 bit SIMD enabled, even for -Dmachine=default. So seems no much point to forbid libraries using SSE code-path when compiler is free to insert SSE instructions on its own will.
Quoted 3 lines
The reason to support this is for testing purposes, as it allows an easy way for a tester to check out any scalar code paths - which are often common across architectures.
If it is just for testing things in a consistent way, then it is probably ok. The thing that worries me - later in this series there are patches that insert extra checks into inline functions that use SSE instincts:
https://patches.dpdk.org/patch/79355/ (lpm: choose vector path at runtime). Which seems like a total overkill for me.Quoted 12 lines
Quoted 11 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 51
Quoted 5 lines
lib/librte_eal/include/rte_eal.h +4
-0+RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE = UINT16_MAX,As a nit, I think it is safe enough to have this last value (
RTE_MAX_SIMD_DISABLEorRTE_MAX_SIMD_MAX) equal to (INT16_MAX+ 1). That would be big enough to probably never hit actual HW limit, while it still remains power of two, as other values.Quoted 3 lines
I actually think it's probably clearer as-is, because the fact of the rest being powers of 2 is irrelevant since we just check greater than or less than.
Well,
rte_set_max_simd_bitwidth()does accept only power of two values _AND_ this special one (UINT16_MAX).
By changing it to 2^15, we can remove that special value test.
Quoted 6 lines
Quoted 2 lines
If we did change it, then we need to put in a comment explaining why the plus-one,
I don't think it is that big deal to put a comment, plus for
UINT16_MAXwe do need some explanation too, right?
I'm ok either way. Ciara, what do you think?
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
Hi Bruce, Konstantin,
Quoted 222 lines
-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Thursday 8 October 2020 15:18
To: Ananyev, Konstantin <[email protected]>
Cc: Power, Ciara <[email protected]>; [email protected]; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidthQuoted 10 lines · Konstantin
Quoted 10 lines · Konstantin
Quoted 8 lines
Quoted 8 lines
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.--- lib/librte_eal/common/eal_common_options.c | 64++++++++++++++++++++++
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 33 +++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 111 insertions(+)Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
lib/librte_eal/common/eal_common_options.c eal_long_options[] = { · line 102
Quoted 7 lines
lib/librte_eal/common/eal_common_options.c +0
-0@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL,
OPT_MATCH_ALLOCATIONS_NUM},Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
lib/librte_eal/common/eal_common_options.c +23
-0{OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, +{OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };@@ -1309,6 +1310,34 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked) {char +*end;unsigned long bitwidth;int ret;struct internal_config +*internal_conf =eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' )return -1 ; + +errno =0 ; +bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if (bitwidth >UINT16_MAX || errno !=0 || end ==NULL || *end +!='\0' )return -1 ; + +if (bitwidth ==0 ) +bitwidth =UINT16_MAX ; +ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; +internal_conf->max_simd_bitwidth.locked = locked;return 0 ; } +static int eal_parse_base_virtaddr(const char *arg) { @@ -1707,6 +1736,13@@ eal_parse_common_option(int opt, const char *optarg, case
OPT_NO_TELEMETRY_NUM:
conf->no_telemetry= 1;
break;lib/librte_eal/common/eal_common_options.c +4
-0+case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) {RTE_LOG (ERR ,EAL , +"invalid parameter for --" +OPT_FORCE_MAX_SIMD_BITWIDTH "\n" );return -1 ; }break ;/* don't know what to do, leave this to caller */ default :@@ -1903,6 +1939,33 @@ eal_check_common_options(struct internal_config *internal_cfg) return 0; }Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
lib/librte_eal/common/eal_common_options.c +7
-0+uint16_t +rte_get_max_simd_bitwidth (void ) {const struct internal_config +*internal_conf =eal_get_internal_configuration ();return +internal_conf->max_simd_bitwidth.bitwidth; +} + +int Quoted 8 lines
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct · line 1955
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +8
-0+rte_set_max_simd_bitwidth(uint16_t bitwidth) { struct +internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) {RTE_LOG (NOTICE , +EAL ,"Cannot set max SIMD bitwidth - user runtime override +enabled"); return -EPERM; } + +if (bitwidth != RTE_MAX_SIMD_DISABLE && (bitwidth <
RTE_NO_SIMDQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
lib/librte_eal/common/eal_common_options.c +4
-0+|| +!rte_is_power_of_2(bitwidth))) { RTE_LOG(ERR, EAL, "Invalid +bitwidth value!\n"); return -EINVAL; } +internal_conf->max_simd_bitwidth.bitwidth = bitwidth; return 0;Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c eal_common_usage(void) · line 2045
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +2
-0+} +void eal_common_usage (void ) {@@ -1981,6 +2044,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --"OPT_TELEMETRY" Enable telemetry support (on bydefault)\n"
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
lib/librte_eal/common/eal_common_options.c eal_common_usage(void) · line 2047
Quoted 2 lines
lib/librte_eal/common/eal_common_options.c +1
-0" --" OPT_NO_TELEMETRY " Disable telemetry support\n" + " --"OPT_FORCE_MAX_SIMD_BITWIDTH" Force the max SIMDbitwidth\n"
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Review
Quoted 4 lines
lib/librte_eal/common/eal_common_options.c +0
-0"\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" (quoted diff) +0
-0
b/lib/librte_eal/common/eal_internal_cfg.hQuoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
index
13f93388a7..367e0cc19e100644lib/librte_eal/common/eal_internal_cfg.h +8
-0@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ +}; +/** * internal configuration */ @@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */ +struct simd_bitwidth max_simd_bitwidth; };Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Review
Quoted 2 lines
lib/librte_eal/common/eal_internal_cfg.h +0
-0void eal_reset_internal_config (struct internal_config *internal_cfg);(quoted diff) +0
-0
b/lib/librte_eal/common/eal_options.hQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
lib/librte_eal/common/eal_options.h enum { · line 88
Quoted 8 lines
index
89769d48b4..ef33979664100644lib/librte_eal/common/eal_options.h +1
-0@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth"
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Review
Quoted 5 lines
lib/librte_eal/common/eal_options.h +1
-0+OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };(quoted diff) +0
-0
b/lib/librte_eal/include/rte_eal.hQuoted 11 lines
Quoted 11 lines
Quoted 11 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 47
Quoted 9 lines
index
ddcf6a2e7a..fb739f3474100644lib/librte_eal/include/rte_eal.h +2
-0@@ -43,6 +43,14 @@ enum rte_proc_type_t {RTE_PROC_INVALID }; +enum rte_max_simd_t { +RTE_NO_SIMD =64 ,While I do understand the idea of having that value from consistency
point of view,
Quoted 1 line
Quoted 1 line
Quoted 1 line
I wonder do we really need to allow user to specify values smaller then
128.
Quoted 1 line
Quoted 1 line
Quoted 1 line
At least on x86 we always have 128 bit SIMD enabled, even for -
Dmachine=default.
Quoted 1 line
Quoted 1 line
Quoted 1 line
So seems no much point to forbid libraries using SSE code-path when
compiler
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines
is free to insert SSE instructions on its own will.
The reason to support this is for testing purposes, as it allows an easy way for a tester to check out any scalar code paths - which are often common across architectures.
If it is just for testing things in a consistent way, then it is probably ok. The thing that worries me - later in this series there are patches that insert extra checks into inline functions that use SSE instincts:
https://patches.dpdk.org/patch/79355/ (lpm: choose vector path atruntime).
Quoted 10 lines
Which seems like a total overkill for me.
Quoted 8 lines
Quoted 8 lines
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 51
Quoted 5 lines
lib/librte_eal/include/rte_eal.h +4
-0+RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE = UINT16_MAX,As a nit, I think it is safe enough to have this last value (
RTE_MAX_SIMD_DISABLEorRTE_MAX_SIMD_MAX) equal to(
INT16_MAX+ 1).Quoted 12 lines
Quoted 7 lines
Quoted 3 lines
That would be big enough to probably never hit actual HW limit, while it still remains power of two, as other values.
I actually think it's probably clearer as-is, because the fact of the rest being powers of 2 is irrelevant since we just check greater than or less than.
Well,
rte_set_max_simd_bitwidth()does accept only power of two values _AND_ this special one (UINT16_MAX).
By changing it to 2^15, we can remove that special value test.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
If we did change it, then we need to put in a comment explaining why the plus-one,
I don't think it is that big deal to put a comment, plus for
UINT16_MAXwe do need some explanation too, right?I'm ok either way. Ciara, what do you think?
Either is fine with me, I can change it to (INT16_MAX + 1) if that is preferred, and remove the extra special case check in the rte_set_max_simd_bitwidth()
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
In reply to Ciara Powerlib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 46
Quoted 12 lines
lib/librte_eal/include/rte_eal.h +1
-0@@ -43,6 +43,14 @@ enum rte_proc_type_t {RTE_PROC_INVALID }; +enum rte_max_simd_t {
Just one more nit, why do we need '_t' suffix here? Usually we '_t' is reserved for typedefs only.
Quoted 7 lines
lib/librte_eal/include/rte_eal.h +7
-0+RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , + RTE_MAX_SIMD_DISABLE = UINT16_MAX, +}; +
Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth
In reply to Ciara PowerQuoted 36 lines · Ciara Power
This patch adds a max SIMD bitwidth EAL configuration. The API allows for an app to set this value. It can also be set using EAL argument --force-max-simd-bitwidth, which will lock the value and override any modifications made by the app.
Signed-off-by Ciara Power <[email protected]>---
v3:
- Added enum value to essentially disable using max SIMD to choose paths, intended for use by ARM SVE.
- Fixed parsing bitwidth argument to return an error for values greater thanuint16_t.
v2: Added to Doxygen comment for API.--- lib/librte_eal/common/eal_common_options.c | 64 ++++++++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 +++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 33 +++++++++++ lib/librte_eal/rte_eal_version.map | 4 ++ 5 files changed, 111 insertions(+)lib/librte_eal/common/eal_common_options.c +1
-0@@ -102,6 +102,7 @@ eal_long_options[] = { {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, {0, 0, NULL, 0 } };
lib/librte_eal/common/eal_common_options.c eal_parse_iova_mode(const char *name) · line 1314
Quoted 5 lines
lib/librte_eal/common/eal_common_options.c +2
-0@@ -1309,6 +1310,34 @@ eal_parse_iova_mode(const char *name)return 0 ; } +static int +eal_parse_simd_bitwidth (const char *arg,bool locked)
No need to pass a "locked" bool, we only care about forced value in this function.
Quoted 5 lines
lib/librte_eal/common/eal_common_options.c +5
-0+{ +char *end; +unsigned long bitwidth; +int ret; + struct internal_config *internal_conf =
lib/librte_eal/common/eal_common_options.c eal_parse_iova_mode(const char *name) · line 1329
Quoted 10 lines
lib/librte_eal/common/eal_common_options.c +10
-0+eal_get_internal_configuration (); + +if (arg ==NULL || arg[0 ] =='\0' ) +return -1 ; + + errno =0 ; + bitwidth =strtoul (arg, &end,0 ); + +/* check for errors */ +if (bitwidth >UINT16_MAX || errno !=0 || end ==NULL || *end !='\0' )
Nit: look at bitwidth after checking errno and consorts.
lib/librte_eal/common/eal_common_options.c eal_parse_iova_mode(const char *name) · line 1337
Quoted 8 lines
lib/librte_eal/common/eal_common_options.c +8
-0+return -1 ; + +if (bitwidth ==0 ) + bitwidth =UINT16_MAX ; + ret =rte_set_max_simd_bitwidth (bitwidth); +if (ret <0 ) +return -1 ; + internal_conf->max_simd_bitwidth.locked = locked;
Please align eal option and internal config field name.
--force-max-simd-bitwidth => .forced ?
And then %s/locked/forced/g
Quoted 80 lines
lib/librte_eal/common/eal_common_options.c +38
-0+return 0 ; +} +static int eal_parse_base_virtaddr (const char *arg) {@@ -1707,6 +1736,13 @@ eal_parse_common_option(int opt, const char *optarg,case OPT_NO_TELEMETRY_NUM : conf->no_telemetry =1 ;break ; +case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM : +if (eal_parse_simd_bitwidth (optarg,1 ) <0 ) { +RTE_LOG (ERR ,EAL ,"invalid parameter for --" +OPT_FORCE_MAX_SIMD_BITWIDTH "\n" ); +return -1 ; + } +break ;/* don't know what to do, leave this to caller */ default :@@ -1903,6 +1939,33 @@ eal_check_common_options(struct internal_config *internal_cfg)return 0 ; } +uint16_t +rte_get_max_simd_bitwidth (void ) +{ +const struct internal_config *internal_conf = +eal_get_internal_configuration (); +return internal_conf->max_simd_bitwidth.bitwidth; +} + +int +rte_set_max_simd_bitwidth (uint16_t bitwidth) +{ +struct internal_config *internal_conf = +eal_get_internal_configuration (); +if (internal_conf->max_simd_bitwidth.locked) { +RTE_LOG (NOTICE ,EAL ,"Cannot set max SIMD bitwidth - user runtime override enabled" ); +return -EPERM ; + } + +if (bitwidth !=RTE_MAX_SIMD_DISABLE && (bitwidth <RTE_NO_SIMD || + !rte_is_power_of_2 (bitwidth))) { +RTE_LOG (ERR ,EAL ,"Invalid bitwidth value!\n" ); +return -EINVAL ; + } + internal_conf->max_simd_bitwidth.bitwidth = bitwidth; +return 0 ; +} +void eal_common_usage (void ) {@@ -1981,6 +2044,7 @@ eal_common_usage(void)" --" OPT_BASE_VIRTADDR " Base virtual address\n" " --" OPT_TELEMETRY " Enable telemetry support (on by default)\n" " --" OPT_NO_TELEMETRY " Disable telemetry support\n" +" --" OPT_FORCE_MAX_SIMD_BITWIDTH " Force the max SIMD bitwidth\n" "\nEAL options for DEBUG use only:\n" " --" OPT_HUGE_UNLINK " Unlink hugepage files after init\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" lib/librte_eal/common/eal_internal_cfg.h +6
-0@@ -33,6 +33,12 @@ struct hugepage_info {int lock_descriptor;/**< file descriptor for hugepage dir */ }; +struct simd_bitwidth { +/**< flag indicating if bitwidth is locked from further modification */ +bool locked; +uint16_t bitwidth;/**< bitwidth value */ +}; +/** * internal configuration */
lib/librte_eal/common/eal_internal_cfg.h struct internal_config { · line 94
Quoted 4 lines
lib/librte_eal/common/eal_internal_cfg.h +1
-0@@ -85,6 +91,8 @@ struct internal_config {volatile unsigned int init_complete;/**< indicates whether EAL has completed initialization */ unsigned int no_telemetry;/**< true to disable Telemetry */ +/** max simd bitwidth path to use */
/**<
Quoted 51 lines
lib/librte_eal/common/eal_internal_cfg.h +1
-0+struct simd_bitwidth max_simd_bitwidth; };void eal_reset_internal_config (struct internal_config *internal_cfg);lib/librte_eal/common/eal_options.h +2
-0@@ -85,6 +85,8 @@ enum {OPT_TELEMETRY_NUM , #define OPT_NO_TELEMETRY "no-telemetry"OPT_NO_TELEMETRY_NUM , +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" +OPT_FORCE_MAX_SIMD_BITWIDTH_NUM , OPT_LONG_MAX_NUM };lib/librte_eal/include/rte_eal.h +19
-0@@ -43,6 +43,14 @@ enum rte_proc_type_t { RTE_PROC_INVALID }; +enum rte_max_simd_t { +RTE_NO_SIMD =64 , +RTE_MAX_128_SIMD =128 , +RTE_MAX_256_SIMD =256 , +RTE_MAX_512_SIMD =512 , +RTE_MAX_SIMD_DISABLE =UINT16_MAX , +}; +/** * Get the process type in a multi-process setup * @@ -51,6 +59,31 @@ enum rte_proc_type_t {*/ enum rte_proc_type_t rte_eal_process_type (void ); +/** +* Get the supported SIMD bitwidth. +* +* @return +* uint16_t bitwidth. +*/ +__rte_experimental +uint16_t rte_get_max_simd_bitwidth(void); + +/** +* Set the supported SIMD bitwidth.
lib/librte_eal/include/rte_eal.h enum rte_proc_type_t { · line 82
Quoted 10 lines
lib/librte_eal/include/rte_eal.h +10
-0+* This API should only be called once at initialization, before EAL init. +* +* @param bitwidth +* uint16_t bitwidth. +* @return +* 0 on success. +* @return +* -EINVAL on invalid bitwidth parameter. +* @return +* -EPERM if bitwidth is locked.
A single @return with a bullet list is preferred (note to self: fix rte_eal_cleanup).
@return
- 0 on success.
- -EINVAL on invalid bitwidth parameter.
- -EPERM if bitwidth is forced.
Quoted 25 lines
lib/librte_eal/include/rte_eal.h +4
-0+*/ +__rte_experimental +int rte_set_max_simd_bitwidth(uint16_t bitwidth); +/** * Request iopl privilege for all RPL. * lib/librte_eal/rte_eal_version.map +4
-1@@ -397,6 +397,10 @@ EXPERIMENTAL { rte_service_lcore_may_be_active; rte_thread_register; rte_thread_unregister; + + # added in 20.11 + rte_get_max_simd_bitwidth; + rte_set_max_simd_bitwidth; }; INTERNAL { --2.17.1
Signature · 1 line
David Marchand
PATCH v3 2/18 eal: add default SIMD bitwidth values
In reply to Ciara PowerEach arch has a define for the default SIMD bitwidth value, this is used on EAL init to set the config max SIMD bitwidth.
---
v3:
- Removed unnecessary define in generic rte_vect.h
- Changed default bitwidth for ARM to UINT16_MAX, to allow for SVE.
v2: Changed default bitwidth for Arm to 128.
--- lib/librte_eal/arm/include/rte_vect.h | 2 ++ lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/ppc/include/rte_vect.h | 2 ++ lib/librte_eal/x86/include/rte_vect.h | 2 ++ 4 files changed, 9 insertions(+)
lib/librte_eal/arm/include/rte_vect.h +2 -0
@@ -14,6 +14,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH UINT16_MAX +typedef int32x4_t xmm_t ;#define XMM_SIZE (sizeof(xmm_t))
lib/librte_eal/common/eal_common_options.c +3 -0
@@ -35,6 +35,7 @@#ifndef RTE_EXEC_ENV_WINDOWS #include <rte_telemetry.h> #endif +#include <rte_vect.h> #include "eal_internal_cfg.h" #include "eal_options.h"
@@ -344,6 +345,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg) internal_cfg->user_mbuf_pool_ops_name =NULL ;CPU_ZERO (&internal_cfg->ctrl_cpuset); internal_cfg->init_complete =0 ; + internal_cfg->max_simd_bitwidth.bitwidth =RTE_DEFAULT_SIMD_BITWIDTH ; + internal_cfg->max_simd_bitwidth.locked =0 ; } static int
lib/librte_eal/ppc/include/rte_vect.h +2 -0
@@ -15,6 +15,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 + typedef vector signed int xmm_t;#define XMM_SIZE (sizeof(xmm_t))
lib/librte_eal/x86/include/rte_vect.h +2 -0
@@ -35,6 +35,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +typedef __m128i xmm_t ;#define XMM_SIZE (sizeof(xmm_t))
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 02/18] eal: add default SIMD bitwidth values
Quoted 15 lines · Ciara Power
Each arch has a define for the default SIMD bitwidth value, this is used on EAL init to set the config max SIMD bitwidth.
Cc Ruifeng Wang <[email protected]>Cc Jerin Jacob <[email protected]>Cc Honnappa Nagarahalli <[email protected]>Cc David Christensen <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Removed unnecessary define in genericrte_vect.h
- Changed default bitwidth for ARM toUINT16_MAX, to allow for SVE.
v2: Changed default bitwidth for Arm to 128.
Quoted 7 lines
--- lib/librte_eal/arm/include/rte_vect.h | 2 ++ lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/ppc/include/rte_vect.h | 2 ++ lib/librte_eal/x86/include/rte_vect.h | 2 ++ 4 files changed, 9 insertions(+)
Re: [dpdk-dev] [PATCH v3 02/18] eal: add default SIMD bitwidth values
In reply to Ciara PowerQuoted 29 lines
Each arch has a define for the default SIMD bitwidth value, this is used on EAL init to set the config max SIMD bitwidth.
Cc Ruifeng Wang <[email protected]>Cc Jerin Jacob <[email protected]>Cc Honnappa Nagarahalli <[email protected]>Cc David Christensen <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Removed unnecessary define in genericrte_vect.h
- Changed default bitwidth for ARM toUINT16_MAX, to allow for SVE.
v2: Changed default bitwidth for Arm to 128.--- lib/librte_eal/arm/include/rte_vect.h | 2 ++ lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/ppc/include/rte_vect.h | 2 ++ lib/librte_eal/x86/include/rte_vect.h | 2 ++ 4 files changed, 9 insertions(+)lib/librte_eal/arm/include/rte_vect.h +0
-0
lib/librte_eal/arm/include/rte_vect.h line 17
Quoted 4 lines
lib/librte_eal/arm/include/rte_vect.h +1
-0@@ -14,6 +14,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH UINT16_MAX
As a nit - can we use here values from enum rte_max_simd_t? That would make things more consistent...
Probably you'll need to move enum rte_max_simd_t definition into rte_vect.h for that.
Quoted 53 lines
lib/librte_eal/arm/include/rte_vect.h +1
-0+typedef int32x4_t xmm_t ;#define XMM_SIZE (sizeof(xmm_t))lib/librte_eal/common/eal_common_options.c +3
-0@@ -35,6 +35,7 @@#ifndef RTE_EXEC_ENV_WINDOWS #include <rte_telemetry.h> #endif +#include <rte_vect.h> #include "eal_internal_cfg.h" #include "eal_options.h" @@ -344,6 +345,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg) internal_cfg->user_mbuf_pool_ops_name =NULL ;CPU_ZERO (&internal_cfg->ctrl_cpuset); internal_cfg->init_complete =0 ; + internal_cfg->max_simd_bitwidth.bitwidth =RTE_DEFAULT_SIMD_BITWIDTH ; + internal_cfg->max_simd_bitwidth.locked =0 ; } static intlib/librte_eal/ppc/include/rte_vect.h +2
-0@@ -15,6 +15,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 + typedef vector signed int xmm_t;#define XMM_SIZE (sizeof(xmm_t))lib/librte_eal/x86/include/rte_vect.h +2
-1@@ -35,6 +35,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +typedef __m128i xmm_t ;#define XMM_SIZE (sizeof(xmm_t)) --2.17.1
Re: [dpdk-dev] [PATCH v3 02/18] eal: add default SIMD bitwidth values
In reply to Ciara PowerQuoted 49 lines · Ciara Power
Each arch has a define for the default SIMD bitwidth value, this is used on EAL init to set the config max SIMD bitwidth.
Cc Ruifeng Wang <[email protected]>Cc Jerin Jacob <[email protected]>Cc Honnappa Nagarahalli <[email protected]>Cc David Christensen <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Removed unnecessary define in genericrte_vect.h
- Changed default bitwidth for ARM toUINT16_MAX, to allow for SVE.
v2: Changed default bitwidth for Arm to 128.--- lib/librte_eal/arm/include/rte_vect.h | 2 ++ lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/ppc/include/rte_vect.h | 2 ++ lib/librte_eal/x86/include/rte_vect.h | 2 ++ 4 files changed, 9 insertions(+)lib/librte_eal/arm/include/rte_vect.h +2
-0@@ -14,6 +14,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH UINT16_MAX +typedef int32x4_t xmm_t ;#define XMM_SIZE (sizeof(xmm_t))lib/librte_eal/common/eal_common_options.c +1
-0@@ -35,6 +35,7 @@#ifndef RTE_EXEC_ENV_WINDOWS #include <rte_telemetry.h> #endif +#include <rte_vect.h> #include "eal_internal_cfg.h" #include "eal_options.h"
lib/librte_eal/common/eal_common_options.c eal_reset_internal_config(struct internal_config *internal_cfg) · line 349
Quoted 5 lines
lib/librte_eal/common/eal_common_options.c +2
-0@@ -344,6 +345,8 @@ eal_reset_internal_config(struct internal_config *internal_cfg) internal_cfg->user_mbuf_pool_ops_name =NULL ;CPU_ZERO (&internal_cfg->ctrl_cpuset); internal_cfg->init_complete =0 ; + internal_cfg->max_simd_bitwidth.bitwidth =RTE_DEFAULT_SIMD_BITWIDTH ; + internal_cfg->max_simd_bitwidth.locked =0 ;
Does the previous patch work without this one?
In any case, it seems a whole to me and reading one of Olivier's questions on the default value, I would squash them together.
Quoted 32 lines
lib/librte_eal/common/eal_common_options.c +0
-0} static intlib/librte_eal/ppc/include/rte_vect.h +2
-0@@ -15,6 +15,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 + typedef vector signed int xmm_t;#define XMM_SIZE (sizeof(xmm_t))lib/librte_eal/x86/include/rte_vect.h +2
-1@@ -35,6 +35,8 @@extern "C" {#endif +#define RTE_DEFAULT_SIMD_BITWIDTH 256 +typedef __m128i xmm_t ;#define XMM_SIZE (sizeof(xmm_t)) --2.17.1
Signature · 1 line
David Marchand
PATCH v3 3/18 doc: add detail on using max SIMD bitwidth
In reply to Ciara PowerThis patch adds documentation on the usage of the max SIMD bitwidth EAL setting, and how to use it to enable AVX-512 at runtime.
---
v3:
- Added enum value for disabling use of max SIMD to doc.
- Added entry to HowTo index.
--- doc/guides/howto/avx512.rst | 36 +++++++++++++++++++ doc/guides/howto/index.rst | 1 + doc/guides/linux_gsg/eal_args.include.rst | 16 +++++++++ .../prog_guide/env_abstraction_layer.rst | 32 +++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 doc/guides/howto/avx512.rst
doc/guides/howto/avx512.rst new file +36 -0
@@ -0,0 +1,36 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2020 Intel Corporation. + + +Using AVX-512 with DPDK +======================= + +AVX-512 is not used by default in DPDK, but it can be selected at runtime by apps through the use of EAL API, +and by the user with a commandline argument. DPDK has a setting for max SIMD bitwidth, +which can be modified and will then limit the vector path taken by the code. + + +Using the API in apps +--------------------- + +Apps can request DPDK uses AVX-512 at runtime, if it provides improved application performance. +This can be done by modifying the EAL setting for max SIMD bitwidth to 512, as by default it is 256, +which does not allow for AVX-512. + +.. code-block:: c + + rte_set_max_simd_bitwidth(RTE_MAX_512_SIMD); + +This API should only be called once at initialization, before EAL init. +For more information on the possible enum values to use as a parameter, go to :ref:`max_simd_bitwidth`: + + +Using the command-line argument +--------------------------------------------- + +The user can select to use AVX-512 at runtime, using the following argument to set the max bitwidth:: + + ./app/dpdk-testpmd --force-max-simd-bitwidth=512 + +This will override any further changes to the max SIMD bitwidth in DPDK, +which is useful for testing purposes.
doc/guides/howto/index.rst +1 -0
@@ -20,3 +20,4 @@ HowTo Guides telemetry debug_troubleshoot openwrt + avx512
doc/guides/linux_gsg/eal_args.include.rst +16 -0
@@ -210,3 +210,19 @@ Other options * ``--no-telemetry``: Disable telemetry. + +* ``--force-max-simd-bitwidth=<val>``: + + Specify the maximum SIMD bitwidth size to handle. This limits which vector paths, + if any, are taken, as any paths taken must use a bitwidth below the max bitwidth limit. + For example, to allow all SIMD bitwidths up to and including AVX-512:: + + --force-max-simd-bitwidth=512 + + The following example shows limiting the bitwidth to 64-bits to disable all vector code:: + + --force-max-simd-bitwidth=64 + + To disable use of max SIMD bitwidth limit:: + + --force-max-simd-bitwidth=0
doc/guides/prog_guide/env_abstraction_layer.rst +32 -0
@@ -486,6 +486,38 @@ the desired addressing mode when virtual devices that are not directly attached To facilitate forcing the IOVA mode to a specific value the EAL command line option ``--iova-mode`` can be used to select either physical addressing('pa') or virtual addressing('va'). +.. _max_simd_bitwidth: + + +Max SIMD bitwidth +~~~~~~~~~~~~~~~~~ + +The EAL provides a single setting to limit the max SIMD bitwidth used by DPDK, +which is used in determining the vector path, if any, chosen by a component. +The value can be set at runtime by an application using the 'rte_set_max_simd_bitwidth(uint16_t bitwidth)' function, +which should only be called once at initialization, before EAL init. +The value can be overridden by the user using the EAL command-line option '--force-max-simd-bitwidth'. + +When choosing a vector path, along with checking the CPU feature support, +the value of the max SIMD bitwidth must also be checked, and can be retrieved using the 'rte_get_max_simd_bitwidth()' function. +The value should be compared against the enum values for accepted max SIMD bitwidths: + +.. code-block:: c + + enum rte_max_simd_t { + RTE_NO_SIMD = 64, + RTE_MAX_128_SIMD = 128, + RTE_MAX_256_SIMD = 256, + RTE_MAX_512_SIMD = 512, + RTE_MAX_SIMD_DISABLE = UINT16_MAX, + }; + + if (rte_get_max_simd_bitwidth() >= RTE_MAX_512_SIMD) + /* Take AVX-512 vector path */ + else if (rte_get_max_simd_bitwidth() >= RTE_MAX_256_SIMD) + /* Take AVX2 vector path */ + + Memory Segments and Memory Zones (memzone) ------------------------------------------
Signature · 1 line
2.17.1
PATCH v3 4/18 net/i40e: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_rxtx.c +13 -6
@@ -3098,7 +3098,8 @@ static eth_rx_burst_t i40e_get_latest_rx_vec(bool scatter) {#if defined(RTE_ARCH_X86 ) && defined(CC_AVX2_SUPPORT ) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;#endif
@@ -3115,7 +3116,8 @@ i40e_get_recommend_rx_vec(bool scatter)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;#endif
@@ -3154,7 +3156,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev) } } -if (ad->rx_vec_allowed) { +if (ad->rx_vec_allowed &&rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {/* Vec Rx path */ PMD_INIT_LOG (DEBUG ,"Vector Rx path will be used on port=%d." , dev->data->port_id);
@@ -3268,7 +3271,8 @@ static eth_tx_burst_ti40e_get_latest_tx_vec (void) {#if defined(RTE_ARCH_X86 ) && defined(CC_AVX2_SUPPORT ) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;
@@ -3283,7 +3287,8 @@ i40e_get_recommend_tx_vec(void)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;
@@ -3311,7 +3316,9 @@ i40e_set_tx_function(struct rte_eth_dev *dev) }if (ad->tx_simple_allowed) { -if (ad->tx_vec_allowed) { +if (ad->tx_vec_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Vector tx finally be used." );if (ad->use_latest_vec) dev->tx_pkt_burst =
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidth
Quoted 19 lines
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Beilei Xing <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)drivers/net/i40e/i40e_rxtx.c +0
-0
drivers/net/i40e/i40e_rxtx.c static eth_rx_burst_t · line 3104
Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c +2
-1@@ -3098,7 +3098,8 @@ static eth_rx_burst_t i40e_get_latest_rx_vec(bool scatter) {#if defined(RTE_ARCH_X86 ) && defined(CC_AVX2_SUPPORT ) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;
Hmm, but that means - if user will set --simd-bitwidth=128 we'll select scalar function, right? Even though sse one is available.
Is that what we really want in that case?
Quoted 54 lines
drivers/net/i40e/i40e_rxtx.c +11
-6#endif @@ -3115,7 +3116,8 @@ i40e_get_recommend_rx_vec(bool scatter)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;#endif @@ -3154,7 +3156,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev) } } -if (ad->rx_vec_allowed) { +if (ad->rx_vec_allowed &&rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {/* Vec Rx path */ PMD_INIT_LOG (DEBUG ,"Vector Rx path will be used on port=%d." , dev->data->port_id);@@ -3268,7 +3271,8 @@ static eth_tx_burst_ti40e_get_latest_tx_vec (void) {#if defined(RTE_ARCH_X86 ) && defined(CC_AVX2_SUPPORT ) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;@@ -3283,7 +3287,8 @@ i40e_get_recommend_tx_vec(void)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;@@ -3311,7 +3316,9 @@ i40e_set_tx_function(struct rte_eth_dev *dev) }if (ad->tx_simple_allowed) { -if (ad->tx_vec_allowed) { +if (ad->tx_vec_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Vector tx finally be used." );if (ad->use_latest_vec) dev->tx_pkt_burst = --2.17.1
Re: [dpdk-dev] [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidth
Hi Konstantin,
Quoted 34 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Thursday 8 October 2020 16:22
To: Power, Ciara <[email protected]>; [email protected]
Cc: Power, Ciara <[email protected]>; Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthQuoted 20 lines
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Beilei Xing <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex60b33d20a1..9b535b52fa100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -3098,7 +3098,8 @@ static eth_rx_burst_t
i40e_get_latest_rx_vec(bool scatter){ #ifdefined(RTE_ARCH_X86)&&defined(CC_AVX2_SUPPORT)drivers/net/i40e/i40e_rxtx.c static eth_rx_burst_t
Quoted 3 lines
drivers/net/i40e/i40e_rxtx.c +2
-1-if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && + rte_get_max_simd_bitwidth() >=
RTE_MAX_256_SIMD)
Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c
Quoted 2 lines
drivers/net/i40e/i40e_rxtx.c +0
-0return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;Hmm, but that means - if user will set --simd-bitwidth=128 we'll select scalar function, right?
Even though sse one is available.
Is that what we really want in that case?
If the max SIMD is 128, the second return in this function is used, which I believe is SSE:
return scatter ? i40e_recv_scattered_pkts_vec : i40e_recv_pkts_vec;
And that function is only called if the max SIMD is >=128, scalar is used otherwise.
Am I missing something else here?
Thanks,
Ciara
Quoted 58 lines
drivers/net/i40e/i40e_rxtx.c i40e_get_recommend_rx_vec(bool scatter) · line 3120
Quoted 8 lines
#endif
drivers/net/i40e/i40e_rxtx.c +2
-1@@ -3115,7 +3116,8 @@ i40e_get_recommend_rx_vec(bool scatter)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && + rte_get_max_simd_bitwidth() >=
RTE_MAX_256_SIMD)drivers/net/i40e/i40e_rxtx.c i40e_set_rx_function(struct rte_eth_dev *dev) · line 3162
Quoted 12 lines
drivers/net/i40e/i40e_rxtx.c +2
-1return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;#endif @@ -3154,7 +3156,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev) } } -if (ad->rx_vec_allowed) { +if (ad->rx_vec_allowed &&rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {/* Vec Rx path */ PMD_INIT_LOG(DEBUG, "Vector Rx path will be used onport=%d.",
drivers/net/i40e/i40e_rxtx.c static eth_tx_burst_t · line 3275
Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c +2
-1dev->data->port_id);@@ -3268,7 +3271,8 @@ static eth_tx_burst_ti40e_get_latest_tx_vec (void) {#if defined(RTE_ARCH_X86 ) && defined(CC_AVX2_SUPPORT ) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) + if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) && + rte_get_max_simd_bitwidth() >=
RTE_MAX_256_SIMD)drivers/net/i40e/i40e_rxtx.c i40e_get_recommend_tx_vec(void) · line 3291
Quoted 10 lines
drivers/net/i40e/i40e_rxtx.c +2
-1return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;@@ -3283,7 +3287,8 @@ i40e_get_recommend_tx_vec(void)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && + rte_get_max_simd_bitwidth() >=
RTE_MAX_256_SIMD)Quoted 16 lines
drivers/net/i40e/i40e_rxtx.c +3
-2return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;@@ -3311,7 +3316,9 @@ i40e_set_tx_function(struct rte_eth_dev *dev) }if (ad->tx_simple_allowed) { -if (ad->tx_vec_allowed) { +if (ad->tx_vec_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Vector tx finally be used." );if (ad->use_latest_vec) dev->tx_pkt_burst = --2.17.1
Ananyev, Konstantin
Acked-byRe: [dpdk-dev] [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidth
Quoted 47 lines
Hi Konstantin,
Quoted 34 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Thursday 8 October 2020 16:22
To: Power, Ciara <[email protected]>; [email protected]
Cc: Power, Ciara <[email protected]>; Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthQuoted 20 lines
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Beilei Xing <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex60b33d20a1..9b535b52fa100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -3098,7 +3098,8 @@ static eth_rx_burst_t
i40e_get_latest_rx_vec(bool scatter){ #ifdefined(RTE_ARCH_X86)&&defined(CC_AVX2_SUPPORT)drivers/net/i40e/i40e_rxtx.c static eth_rx_burst_t
Quoted 3 lines
drivers/net/i40e/i40e_rxtx.c +2
-1-if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && + rte_get_max_simd_bitwidth() >=
RTE_MAX_256_SIMD)Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c
Quoted 2 lines
drivers/net/i40e/i40e_rxtx.c +0
-0return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;Hmm, but that means - if user will set --simd-bitwidth=128 we'll select scalar function, right?
Even though sse one is available.
Is that what we really want in that case?
Quoted 8 lines
If the max SIMD is 128, the second return in this function is used, which I believe is SSE:
return scatter ? i40e_recv_scattered_pkts_vec : i40e_recv_pkts_vec;And that function is only called if the max SIMD is >=128, scalar is used otherwise.
Am I missing something else here?
Nope, you are right, that was me not reading code properly 😊
Quoted 62 lines
Thanks,
CiaraQuoted 58 lines
drivers/net/i40e/i40e_rxtx.c i40e_get_recommend_rx_vec(bool scatter) · line 3120
Quoted 8 lines
#endif
drivers/net/i40e/i40e_rxtx.c +2
-1@@ -3115,7 +3116,8 @@ i40e_get_recommend_rx_vec(bool scatter)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && + rte_get_max_simd_bitwidth() >=
RTE_MAX_256_SIMD)drivers/net/i40e/i40e_rxtx.c i40e_set_rx_function(struct rte_eth_dev *dev) · line 3162
Quoted 12 lines
drivers/net/i40e/i40e_rxtx.c +2
-1return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;#endif @@ -3154,7 +3156,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev) } } -if (ad->rx_vec_allowed) { +if (ad->rx_vec_allowed &&rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {/* Vec Rx path */ PMD_INIT_LOG(DEBUG, "Vector Rx path will be used onport=%d.",
drivers/net/i40e/i40e_rxtx.c static eth_tx_burst_t · line 3275
Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c +2
-1dev->data->port_id);@@ -3268,7 +3271,8 @@ static eth_tx_burst_ti40e_get_latest_tx_vec (void) {#if defined(RTE_ARCH_X86 ) && defined(CC_AVX2_SUPPORT ) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) + if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) && + rte_get_max_simd_bitwidth() >=
RTE_MAX_256_SIMD)drivers/net/i40e/i40e_rxtx.c i40e_get_recommend_tx_vec(void) · line 3291
Quoted 10 lines
drivers/net/i40e/i40e_rxtx.c +2
-1return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;@@ -3283,7 +3287,8 @@ i40e_get_recommend_tx_vec(void)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && + rte_get_max_simd_bitwidth() >=
RTE_MAX_256_SIMD)Quoted 16 lines
drivers/net/i40e/i40e_rxtx.c +3
-2return i40e_xmit_pkts_vec_avx2;#endif return i40e_xmit_pkts_vec;@@ -3311,7 +3316,9 @@ i40e_set_tx_function(struct rte_eth_dev *dev) }if (ad->tx_simple_allowed) { -if (ad->tx_vec_allowed) { +if (ad->tx_vec_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Vector tx finally be used." );if (ad->use_latest_vec) dev->tx_pkt_burst = --2.17.1
Re: [dpdk-dev] [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidth
In reply to Ciara PowerHi, power
Quoted 24 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 9:04 PM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>
Subject: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Beilei Xing <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)drivers/net/i40e/i40e_rxtx.c index renamed from drivers/net/i40e/i40e_rxtx.c +0
-0
60b33d20a1..9b535b52fa100644
drivers/net/i40e/i40e_rxtx.c static eth_rx_burst_t i40e_get_latest_rx_vec(bool · line 3100
Quoted 4 lines
drivers/net/i40e/i40e_rxtx.c +2
-1@@ -3098,7 +3098,8 @@ static eth_rx_burst_t i40e_get_latest_rx_vec(bool scatter) { #if defined(RTE_ARCH_X86) && defined(CC_AVX2_SUPPORT) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) + if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) && + rte_get_max_simd_bitwidth() >=
Nitpick: I think if consistent to keep alignment for open parenthesis in this patch set would be better. Do you think so?
Quoted 61 lines
drivers/net/i40e/i40e_rxtx.c +2
-1RTE_MAX_256_SIMD)return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;#endif @@ -3115,7 +3116,8 @@ i40e_get_recommend_rx_vec(bool scatter)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return scatter ? i40e_recv_scattered_pkts_vec_avx2 : i40e_recv_pkts_vec_avx2;#endif
drivers/net/i40e/i40e_rxtx.c +2
-1@@ -3154,7 +3156,8 @@ i40e_set_rx_function(struct rte_eth_dev *dev) } } -if (ad->rx_vec_allowed) { +if (ad->rx_vec_allowed &&rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {/* Vec Rx path */ PMD_INIT_LOG(DEBUG, "Vector Rx path will be used on port=%d.",drivers/net/i40e/i40e_rxtx.c +2
-1dev->data->port_id);@@ -3268,7 +3271,8 @@ static eth_tx_burst_ti40e_get_latest_tx_vec (void) {#if defined(RTE_ARCH_X86 ) && defined(CC_AVX2_SUPPORT ) -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return i40e_xmit_pkts_vec_avx2;#endif drivers/net/i40e/i40e_rxtx.c +2
-1return i40e_xmit_pkts_vec;@@ -3283,7 +3287,8 @@ i40e_get_recommend_tx_vec(void)* use of AVX2 version to later plaforms, not all those that could * theoretically run it. */ -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )return i40e_xmit_pkts_vec_avx2;#endif drivers/net/i40e/i40e_rxtx.c +3
-2return i40e_xmit_pkts_vec;@@ -3311,7 +3316,9 @@ i40e_set_tx_function(struct rte_eth_dev *dev) }if (ad->tx_simple_allowed) { -if (ad->tx_vec_allowed) { +if (ad->tx_vec_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Vector tx finally be used." );if (ad->use_latest_vec) dev->tx_pkt_burst = --2.17.1
Re: [dpdk-dev] [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidth
Hi Jeff,
Quoted 28 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Friday 9 October 2020 04:03
To: Power, Ciara <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: RE: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthHi, power
Quoted 19 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 9:04 PM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>
Subject: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Beilei Xing <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
Quoted 14 lines
drivers/net/i40e/i40e_rxtx.c
Quoted 10 lines
(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex60b33d20a1..9b535b52fa100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -3098,7 +3098,8 @@ static eth_rx_burst_ti40e_get_latest_rx_vec(bool
scatter) { #ifdefined(RTE_ARCH_X86)&&defined(CC_AVX2_SUPPORT)-if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2))drivers/net/i40e/i40e_rxtx.c +2
-0+if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth() >=Nitpick: I think if consistent to keep alignment for open parenthesis in this patch set would be better. Do you think so?
This file doesn't seem to have any if statements indented as you suggest, Some do have a double indent for the continued line as I have done here though.
<snip>
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidth
Hi, power
Quoted 55 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Friday, October 9, 2020 10:03 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: RE: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthHi Jeff,
Quoted 8 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Friday 9 October 2020 04:03
To: Power, Ciara <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: RE: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthQuoted 12 lines
Hi, power
Quoted 10 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 9:04 PM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>
Subject: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled
path.
Quoted 9 lines
Quoted 9 lines
Cc Beilei Xing <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)Quoted 15 lines
drivers/net/i40e/i40e_rxtx.c
Quoted 11 lines
(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex60b33d20a1..9b535b52fa100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -3098,7 +3098,8 @@ static eth_rx_burst_ti40e_get_latest_rx_vec(bool
scatter) { #ifdefined(RTE_ARCH_X86)&&defined(CC_AVX2_SUPPORT)-if
(rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2))drivers/net/i40e/i40e_rxtx.c +2
-0+if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth() >=Nitpick: I think if consistent to keep alignment for open parenthesis in this patch set would be better. Do you think so?
Quoted 4 lines
This file doesn't seem to have any if statements indented as you suggest, Some do have a double indent for the continued line as I have done here though.
Sorry, maybe I didn't say clear, what I said is the "CHECK" as below when use checkpatch.pl to guaranty the patch's format.
CHECK: Alignment should match open parenthesis
#733: FILE: drivers/net/i40e/i40e_rxtx.c:3102:
+ if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) &&
+ rte_get_max_simd_bitwidth() >= RTE_MAX_256_SIMD)
CHECK: Alignment should match open parenthesis
#743: FILE: drivers/net/i40e/i40e_rxtx.c:3120:
+ if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) &&
+ rte_get_max_simd_bitwidth() >= RTE_MAX_256_SIMD)
CHECK: Alignment should match open parenthesis
#763: FILE: drivers/net/i40e/i40e_rxtx.c:3275:
+ if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) &&
+ rte_get_max_simd_bitwidth() >= RTE_MAX_256_SIMD)
CHECK: Alignment should match open parenthesis
#773: FILE: drivers/net/i40e/i40e_rxtx.c:3291:
+ if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) &&
+ rte_get_max_simd_bitwidth() >= RTE_MAX_256_SIMD)
CHECK: Alignment should match open parenthesis
#783: FILE: drivers/net/i40e/i40e_rxtx.c:3320:
+ if (ad->tx_vec_allowed &&
+ rte_get_max_simd_bitwidth()
Quoted 5 lines
<snip>
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidth
Quoted 67 lines · Jia
Hi, power
Quoted 55 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Friday, October 9, 2020 10:03 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: RE: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthHi Jeff,
Quoted 8 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Friday 9 October 2020 04:03
To: Power, Ciara <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: RE: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthQuoted 12 lines
Hi, power
Quoted 10 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 9:04 PM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>
Subject: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled
path.
Quoted 9 lines
Quoted 9 lines
Cc Beilei Xing <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)Quoted 15 lines
drivers/net/i40e/i40e_rxtx.c
Quoted 11 lines
(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex60b33d20a1..9b535b52fa100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -3098,7 +3098,8 @@ static eth_rx_burst_ti40e_get_latest_rx_vec(bool
scatter) { #ifdefined(RTE_ARCH_X86)&&defined(CC_AVX2_SUPPORT)-if
(rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2))drivers/net/i40e/i40e_rxtx.c +2
-0+if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth() >=Nitpick: I think if consistent to keep alignment for open parenthesis in this patch set would be better. Do you think so?
Quoted 4 lines
This file doesn't seem to have any if statements indented as you suggest, Some do have a double indent for the continued line as I have done here though.
Sorry, maybe I didn't say clear, what I said is the "CHECK" as below when use checkpatch.pl to guaranty the patch's format.
CHECK: Alignment should match open parenthesis
#733: FILE:drivers/net/i40e/i40e_rxtx.c:3102:
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) && + rte_get_max_simd_bitwidth() >= RTE_MAX_256_SIMD)
Did you run checkpatch using the DPDK "checkpatches.sh" script? In that script there are a list of things to ignore, one of which is "PARENTHESIS_ALIGNMENT", so that should not be flagged here. It's also not flagged in patchwork by the CI system.
/Bruce
Re: [dpdk-dev] [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidth
Quoted 86 lines
-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Monday, October 12, 2020 5:38 PM
To: Guo, Jia <[email protected]>
Cc: Power, Ciara <[email protected]>; [email protected]; Xing, Beilei <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthQuoted 61 lines · Jia
Hi, power
Quoted 59 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Friday, October 9, 2020 10:03 PM
To: Guo, Jia <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: RE: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthHi Jeff,
Quoted 8 lines
-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Friday 9 October 2020 04:03
To: Power, Ciara <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: RE: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthQuoted 14 lines
Hi, power
Quoted 12 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 9:04 PM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>
Subject: [PATCH v3 04/18] net/i40e: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled
path.
Quoted 25 lines
Quoted 19 lines
Cc Beilei Xing <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_rxtx.cindex60b33d20a1..9b535b52fa100644drivers/net/i40e/i40e_rxtx.c +0
-0@@ -3098,7 +3098,8 @@ static eth_rx_burst_ti40e_get_latest_rx_vec(bool
scatter) { #ifdefined(RTE_ARCH_X86)&&defined(CC_AVX2_SUPPORT)-if
(rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2))drivers/net/i40e/i40e_rxtx.c
Quoted 2 lines
drivers/net/i40e/i40e_rxtx.c +2
-0+if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth() >=Nitpick: I think if consistent to keep alignment for open parenthesis in this patch set would be better. Do you think so?
Quoted 6 lines
Quoted 4 lines
This file doesn't seem to have any if statements indented as you suggest, Some do have a double indent for the continued line as I have done here though.
Sorry, maybe I didn't say clear, what I said is the "CHECK" as below when
use checkpatch.pl to guaranty the patch's format.
Review
Quoted 7 lines
CHECK: Alignment should match open parenthesis
#733: FILE:drivers/net/i40e/i40e_rxtx.c:3102:(quoted diff) +3
-0+ if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) && + rte_get_max_simd_bitwidth() >= + RTE_MAX_256_SIMD)
Quoted 5 lines
Did you run checkpatch using the DPDK "
checkpatches.sh" script? In that script there are a list of things to ignore, one of which is "PARENTHESIS_ALIGNMENT", so that should not be flagged here. It's also not flagged in patchwork by the CI system.
Ok, seems that parenthesis alignment had been explicit ignored even I would prefer to make the format to be more consistent. @ power, you could choose keep it or not if there is a coming new version, that is both fine base on the rule.
Quoted 1 line
/Bruce
PATCH v3 5/18 net/axgbe: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/axgbe/axgbe_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/axgbe/axgbe_rxtx.c +2 -1
@@ -557,7 +557,8 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,if (!pdata->tx_queues) pdata->tx_queues = dev->data->tx_queues; -if (txq->vector_disable) +if (txq->vector_disable ||rte_get_max_simd_bitwidth () + <RTE_MAX_128_SIMD ) dev->tx_pkt_burst = &axgbe_xmit_pkts; else#ifdef RTE_ARCH_X86
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 05/18] net/axgbe: add checks for max SIMD bitwidth
-----Original Message-----
From: Ciara Power <[email protected]>
Sent: Wednesday, September 30, 2020 6:34 PM
To: [email protected]
Cc: Ciara Power <[email protected]>; Somalapuram, Amaranath <[email protected]>
Subject: [PATCH v3 05/18] net/axgbe: add checks for max SIMD bitwidth
[CAUTION: External Email]
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/axgbe/axgbe_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/axgbe/axgbe_rxtx.c +2 -1
@@ -557,7 +557,8 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,if (!pdata->tx_queues) pdata->tx_queues = dev->data->tx_queues; -if (txq->vector_disable) +if (txq->vector_disable ||rte_get_max_simd_bitwidth () + <RTE_MAX_128_SIMD ) dev->tx_pkt_burst = &axgbe_xmit_pkts; else#ifdef RTE_ARCH_X86
--
2.17.1
PATCH v3 6/18 net/bnxt: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/bnxt/bnxt_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +4 -2
@@ -1122,7 +1122,8 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev) DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_RSS_HASH | DEV_RX_OFFLOAD_VLAN_FILTER)) && - !BNXT_TRUFLOW_EN(bp) && BNXT_NUM_ASYNC_CPR(bp)) { + !BNXT_TRUFLOW_EN(bp) && BNXT_NUM_ASYNC_CPR(bp) && + rte_get_max_simd_bitwidth() >= RTE_MAX_128_SIMD) {PMD_DRV_LOG (INFO ,"Using vector mode receive for port %d\n" , eth_dev->data->port_id); bp->flags |=BNXT_FLAG_RX_VECTOR_PKT_MODE ;
@@ -1154,7 +1155,8 @@ bnxt_transmit_function(__rte_unused struct rte_eth_dev *eth_dev)*/ if (!eth_dev->data->scattered_rx && !eth_dev->data->dev_conf.txmode.offloads && - !BNXT_TRUFLOW_EN (bp)) { + !BNXT_TRUFLOW_EN (bp) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) {PMD_DRV_LOG (INFO ,"Using vector mode transmit for port %d\n" , eth_dev->data->port_id);return bnxt_xmit_pkts_vec;
Signature · 1 line
2.17.1
PATCH v3 7/18 net/enic: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/enic/enic_rxtx_vec_avx2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/enic/enic_rxtx_vec_avx2.c +2 -1
@@ -821,7 +821,8 @@ enic_use_vector_rx_handler(struct rte_eth_dev *eth_dev) fconf = ð_dev->data->dev_conf.fdir_conf;if (fconf->mode !=RTE_FDIR_MODE_NONE )return false; -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) { +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) {ENICPMD_LOG (DEBUG ," use the non-scatter avx2 Rx handler" ); eth_dev->rx_pkt_burst = &enic_noscatter_vec_recv_pkts; enic->use_noscatter_vec_rx_handler =1 ;
Signature · 1 line
2.17.1
PATCH v3 8/18 net/fm10k: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/fm10k/fm10k_ethdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/fm10k/fm10k_ethdev.c +8 -3
@@ -2930,7 +2930,9 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {/* primary process has set the ftag flag and offloads */ txq = dev->data->tx_queues[0 ]; -if (fm10k_tx_vec_condition_check (txq)) { +if (fm10k_tx_vec_condition_check (txq) || +rte_get_max_simd_bitwidth () + <RTE_MAX_128_SIMD ) { dev->tx_pkt_burst = fm10k_xmit_pkts; dev->tx_pkt_prepare = fm10k_prep_pkts;PMD_INIT_LOG (DEBUG ,"Use regular Tx func" );
@@ -2949,7 +2951,8 @@ fm10k_set_tx_function(struct rte_eth_dev *dev) txq = dev->data->tx_queues[i]; txq->tx_ftag_en = tx_ftag_en;/* Check if Vector Tx is satisfied */ -if (fm10k_tx_vec_condition_check (txq)) +if (fm10k_tx_vec_condition_check (txq) || +rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) use_sse =0 ; }
@@ -2983,7 +2986,9 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)* conditions to be met. */ if (!fm10k_rx_vec_condition_check (dev) && - dev_info->rx_vec_allowed && !rx_ftag_en) { + dev_info->rx_vec_allowed && !rx_ftag_en && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {if (dev->data->scattered_rx) dev->rx_pkt_burst = fm10k_recv_scattered_pkts_vec;else
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 08/18] net/fm10k: add checks for max SIMD bitwidth
Quoted 10 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 9:04 PM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Zhang, Qi Z <[email protected]>; Wang, Xiao W <[email protected]>
Subject: [PATCH v3 08/18] net/fm10k: add checks for max SIMD bitwidth
Quoted 7 lines
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Qi Zhang <[email protected]>Cc Xiao Wang <[email protected]>Signed-off-by Ciara Power <[email protected]>
Quoted 43 lines
--- drivers/net/fm10k/fm10k_ethdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/net/fm10k/fm10k_ethdev.c +9
-4@@ -2930,7 +2930,9 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {/* primary process has set the ftag flag and offloads */ txq = dev->data->tx_queues[0 ]; -if (fm10k_tx_vec_condition_check (txq)) { +if (fm10k_tx_vec_condition_check (txq) || +rte_get_max_simd_bitwidth () + <RTE_MAX_128_SIMD ) { dev->tx_pkt_burst = fm10k_xmit_pkts; dev->tx_pkt_prepare = fm10k_prep_pkts; PMD_INIT_LOG(DEBUG, "Use regular Tx func"); @@ -2949,7 +2951,8 @@ fm10k_set_tx_function(struct rte_eth_dev *dev) txq = dev->data->tx_queues[i]; txq->tx_ftag_en = tx_ftag_en;/* Check if Vector Tx is satisfied */ -if (fm10k_tx_vec_condition_check (txq)) +if (fm10k_tx_vec_condition_check (txq) || +rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) use_sse =0 ; }@@ -2983,7 +2986,9 @@ fm10k_set_rx_function(struct rte_eth_dev *dev)* conditions to be met. */ if (!fm10k_rx_vec_condition_check (dev) && - dev_info->rx_vec_allowed && !rx_ftag_en) { + dev_info->rx_vec_allowed && !rx_ftag_en && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {if (dev->data->scattered_rx) dev->rx_pkt_burst = fm10k_recv_scattered_pkts_vec;else --2.17.1
PATCH v3 9/18 net/iavf: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/iavf/iavf_rxtx.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/net/iavf/iavf_rxtx.c +10 -6
@@ -2105,14 +2105,16 @@ iavf_set_rx_function(struct rte_eth_dev *dev)int i;bool use_avx2 = false; -if (!iavf_rx_vec_dev_check (dev)) { +if (!iavf_rx_vec_dev_check (dev) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) {for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; (void )iavf_rxq_vec_setup (rxq); } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) use_avx2 = true;if (dev->data->scattered_rx) {
@@ -2178,7 +2180,8 @@ iavf_set_tx_function(struct rte_eth_dev *dev)int i;bool use_avx2 = false; -if (!iavf_tx_vec_dev_check (dev)) { +if (!iavf_tx_vec_dev_check (dev) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) {for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];if (!txq)
@@ -2186,8 +2189,9 @@ iavf_set_tx_function(struct rte_eth_dev *dev)iavf_txq_vec_setup (txq); } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) use_avx2 = true; PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).",
Signature · 1 line
2.17.1
PATCH v3 10/18 net/ice: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/ice/ice_rxtx.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/net/ice/ice_rxtx.c +14 -6
@@ -2936,7 +2936,9 @@ ice_set_rx_function(struct rte_eth_dev *dev)bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed) { +if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) { ad->rx_vec_allowed = true;for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i];
@@ -2946,8 +2948,10 @@ ice_set_rx_function(struct rte_eth_dev *dev) } } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_256_SIMD ) use_avx2 = true; }else {
@@ -3114,7 +3118,9 @@ ice_set_tx_function(struct rte_eth_dev *dev)bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_tx_vec_dev_check (dev)) { +if (!ice_tx_vec_dev_check (dev) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) { ad->tx_vec_allowed = true;for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];
@@ -3124,8 +3130,10 @@ ice_set_tx_function(struct rte_eth_dev *dev) } } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_256_SIMD ) use_avx2 = true; }else {
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 10/18] net/ice: add checks for max SIMD bitwidth
Quoted 10 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 9:04 PM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [PATCH v3 10/18] net/ice: add checks for max SIMD bitwidth
Quoted 7 lines
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Qiming Yang <[email protected]>Cc Qi Zhang <[email protected]>Signed-off-by Ciara Power <[email protected]>
Quoted 58 lines
--- drivers/net/ice/ice_rxtx.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)drivers/net/ice/ice_rxtx.c index renamed from drivers/net/ice/ice_rxtx.c +0
-0
fef6ad4544..5a29af743c100644drivers/net/ice/ice_rxtx.c +14
-7@@ -2936,7 +2936,9 @@ ice_set_rx_function(struct rte_eth_dev *dev)bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed) { +if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) { ad->rx_vec_allowed = true;for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i];@@ -2946,8 +2948,10 @@ ice_set_rx_function(struct rte_eth_dev *dev) } } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_256_SIMD ) use_avx2 = true; }else {@@ -3114,7 +3118,9 @@ ice_set_tx_function(struct rte_eth_dev *dev)bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_tx_vec_dev_check (dev)) { +if (!ice_tx_vec_dev_check (dev) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) { ad->tx_vec_allowed = true;for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];@@ -3124,8 +3130,10 @@ ice_set_tx_function(struct rte_eth_dev *dev) } } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_256_SIMD ) use_avx2 = true; }else { --2.17.1
Re: [dpdk-dev] [PATCH v3 10/18] net/ice: add checks for max SIMD bitwidth
Quoted 22 lines
-----Original Message-----
From: Zhang, Qi Z
Sent: Friday, October 9, 2020 8:05 AM
To: Power, Ciara <[email protected]>; [email protected]
Cc: Yang, Qiming <[email protected]>
Subject: RE: [PATCH v3 10/18] net/ice: add checks for max SIMD bitwidthQuoted 11 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 9:04 PM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [PATCH v3 10/18] net/ice: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Quoted 6 lines
Quoted 4 lines
Cc Qiming Yang <[email protected]>Cc Qi Zhang <[email protected]>Signed-off-by Ciara Power <[email protected]>Acked-by Qi Zhang <[email protected]>
I'd like to withdraw my ack, due to more consideration as below
Quoted 24 lines
Quoted 24 lines
--- drivers/net/ice/ice_rxtx.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)drivers/net/ice/ice_rxtx.c +3
-1@@ -2936,7 +2936,9 @@ ice_set_rx_function(struct rte_eth_dev *dev)bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed) { +if (!ice_rx_vec_dev_check (dev) && ad->rx_bulk_alloc_allowed && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) { ad->rx_vec_allowed = true;for (i =0 ; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i];@@ -2946,8 +2948,10 @@ ice_set_rx_function(struct rte_eth_dev *dev) } }
Quoted 6 lines
drivers/net/ice/ice_rxtx.c ice_set_rx_function(struct rte_eth_dev *dev) · line 2954
Quoted 6 lines
drivers/net/ice/ice_rxtx.c +4
-2-if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_256_SIMD )
As we have this max SIMD hint, the avx512 flag check is not necessary,
and I think for old platform which not support avx512, the default RTE_DEFAULT_SIMD_BITWIDTH should be configured to 128, so AVX2 will not be over used.
Quoted 29 lines
Quoted 29 lines
drivers/net/ice/ice_rxtx.c +7
-4use_avx2 = true; }else {@@ -3114,7 +3118,9 @@ ice_set_tx_function(struct rte_eth_dev *dev)bool use_avx2 = false;if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -if (!ice_tx_vec_dev_check (dev)) { +if (!ice_tx_vec_dev_check (dev) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) { ad->tx_vec_allowed = true;for (i =0 ; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i];@@ -3124,8 +3130,10 @@ ice_set_tx_function(struct rte_eth_dev *dev) } } -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || -rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) +if ((rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) ==1 || +rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) ==1 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_256_SIMD ) use_avx2 = true; }else { --2.17.1
PATCH v3 11/18 net/ixgbe: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx.c +5 -2
@@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) dev->tx_pkt_prepare =NULL ;if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type () !=RTE_PROC_PRIMARY || -ixgbe_txq_vec_setup (txq) ==0 )) { +ixgbe_txq_vec_setup (txq) ==0 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Vector tx enabled." ); dev->tx_pkt_burst = ixgbe_xmit_pkts_vec; }else
@@ -4743,7 +4745,8 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev)* conditions to be met and Rx Bulk Allocation should be allowed. */ if (ixgbe_rx_vec_dev_conf_condition_check (dev) || - !adapter->rx_bulk_alloc_allowed) { + !adapter->rx_bulk_alloc_allowed || +rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Port[%d] doesn't meet Vector Rx " "preconditions" , dev->data->port_id);
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidth
Quoted 20 lines
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Wei Zhao <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/net/ixgbe/ixgbe_rxtx.c +0
-0
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) · line 2508
Quoted 7 lines
drivers/net/ixgbe/ixgbe_rxtx.c +3
-1@@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) dev->tx_pkt_prepare =NULL ;if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type () !=RTE_PROC_PRIMARY || -ixgbe_txq_vec_setup (txq) ==0 )) { +ixgbe_txq_vec_setup (txq) ==0 ) && +rte_get_max_simd_bitwidth () + >=RTE_MAX_128_SIMD ) {
As a nit - I think it is a bit safer to do all checks first before doing txq_vec_setup().
Quoted 15 lines
drivers/net/ixgbe/ixgbe_rxtx.c +2
-2PMD_INIT_LOG (DEBUG ,"Vector tx enabled." ); dev->tx_pkt_burst = ixgbe_xmit_pkts_vec; }else @@ -4743,7 +4745,8 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev)* conditions to be met and Rx Bulk Allocation should be allowed. */ if (ixgbe_rx_vec_dev_conf_condition_check (dev) || - !adapter->rx_bulk_alloc_allowed) { + !adapter->rx_bulk_alloc_allowed || +rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Port[%d] doesn't meet Vector Rx " "preconditions" , dev->data->port_id); --2.17.1
Re: [dpdk-dev] [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidth
In reply to Ciara PowerHi Ciara,
Quoted 25 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 21:04
To: [email protected]
Cc: Power, Ciara <[email protected]>; Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Wei Zhao <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/net/ixgbe/ixgbe_rxtx.c +0
-0
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) · line 2507
Quoted 6 lines
drivers/net/ixgbe/ixgbe_rxtx.c +2
-1@@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) dev->tx_pkt_prepare =NULL ;if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type () !=RTE_PROC_PRIMARY || -ixgbe_txq_vec_setup (txq) ==0 )) { +ixgbe_txq_vec_setup (txq) ==0 ) && + rte_get_max_simd_bitwidth()
As Konstantin mentioned: " I think it is a bit safer to do all checks first before
doing txq_vec_setup()."
Fox x86 & arm platforms, the setup is always 0, since 'sw_ring_v' is union with 'sw_ring' which is initialize at 'ixgbe_dev_tx_queue_setup'.
union {
struct ixgbe_tx_entry *sw_ring; /**< address of SW ring for scalar PMD. */
struct ixgbe_tx_entry_v *sw_ring_v; /**< address of SW ring for vector PMD */
};static inline int
ixgbe_txq_vec_setup_default(struct ixgbe_tx_queue *txq,
const struct ixgbe_txq_ops *txq_ops)
{
if (txq->sw_ring_v == NULL)
return -1;
/* leave the first one for overflow */
txq->sw_ring_v = txq->sw_ring_v + 1;
txq->ops = txq_ops;
return 0;
}So we need check the SIMD bitwidth firstly to avoid changing the sw_ring* pointer address.
Also, looks like we need to add check on:
intixgbe_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt)
{
struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue;
if (txq->offloads == 0 &&
#ifdef RTE_LIBRTE_SECURITY
!(txq->using_ipsec) &&
#endif
txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST) {
if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ &&
<------------------- Add the same check
(rte_eal_process_type() != RTE_PROC_PRIMARY ||
txq->sw_ring_v != NULL)) {
return ixgbe_tx_done_cleanup_vec(txq, free_cnt);
} else {
return ixgbe_tx_done_cleanup_simple(txq, free_cnt);
}
}Quoted 16 lines
drivers/net/ixgbe/ixgbe_rxtx.c +3
-2+ >= RTE_MAX_128_SIMD) {PMD_INIT_LOG (DEBUG ,"Vector tx enabled." ); dev->tx_pkt_burst = ixgbe_xmit_pkts_vec; } else@@ -4743,7 +4745,8 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev)* conditions to be met and Rx Bulk Allocation should be allowed. */ if (ixgbe_rx_vec_dev_conf_condition_check (dev) || - !adapter->rx_bulk_alloc_allowed) { + !adapter->rx_bulk_alloc_allowed || +rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Port[%d] doesn't meet Vector Rx " "preconditions" , dev->data->port_id); --2.17.1
Re: [dpdk-dev] [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidth
Quoted 65 lines
Quoted 26 lines
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 21:04
To: [email protected]
Cc: Power, Ciara <[email protected]>; Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Wei Zhao <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/net/ixgbe/ixgbe_rxtx.c +0
-0drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) · line 2507
Quoted 6 lines
drivers/net/ixgbe/ixgbe_rxtx.c +2
-1@@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) dev->tx_pkt_prepare =NULL ;if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type () !=RTE_PROC_PRIMARY || -ixgbe_txq_vec_setup (txq) ==0 )) { +ixgbe_txq_vec_setup (txq) ==0 ) && + rte_get_max_simd_bitwidth()As Konstantin mentioned: " I think it is a bit safer to do all checks first before
doingtxq_vec_setup()."Fox x86 & arm platforms, the setup is always 0, since '
sw_ring_v' is union with 'sw_ring' which is initialize at 'ixgbe_dev_tx_queue_setup'.union { struct ixgbe_tx_entry *sw_ring; /**< address of SW ring for scalar PMD. */ struct ixgbe_tx_entry_v *sw_ring_v; /**< address of SW ring for vector PMD */ };static inline int
ixgbe_txq_vec_setup_default(structixgbe_tx_queue*txq,
const structixgbe_txq_ops*txq_ops){ if (txq->sw_ring_v == NULL) return -1; /* leave the first one for overflow */ txq->sw_ring_v = txq->sw_ring_v + 1; txq->ops = txq_ops; return 0; }So we need check the SIMD bitwidth firstly to avoid changing the sw_ring* pointer address.
Also, looks like we need to add check on:
int
ixgbe_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt)
Quoted 12 lines
{
struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue;
if (txq->offloads == 0 &&
#ifdef RTE_LIBRTE_SECURITY
!(txq->using_ipsec) &&
#endif
txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST) {
if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ &&
<------------------- Add the same check
(rte_eal_process_type() != RTE_PROC_PRIMARY ||
txq->sw_ring_v != NULL)) {
return ixgbe_tx_done_cleanup_vec(txq, free_cnt);Could you probably explain a bit more why it is needed?
Quoted 21 lines
} else { return ixgbe_tx_done_cleanup_simple(txq, free_cnt); } }Quoted 16 lines
drivers/net/ixgbe/ixgbe_rxtx.c +3
-2+ >= RTE_MAX_128_SIMD) {PMD_INIT_LOG (DEBUG ,"Vector tx enabled." ); dev->tx_pkt_burst = ixgbe_xmit_pkts_vec; } else@@ -4743,7 +4745,8 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev)* conditions to be met and Rx Bulk Allocation should be allowed. */ if (ixgbe_rx_vec_dev_conf_condition_check (dev) || - !adapter->rx_bulk_alloc_allowed) { + !adapter->rx_bulk_alloc_allowed || +rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) {PMD_INIT_LOG (DEBUG ,"Port[%d] doesn't meet Vector Rx " "preconditions" , dev->data->port_id); --2.17.1
Re: [dpdk-dev] [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidth
Quoted 85 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Monday, October 12, 2020 06:31
To: Wang, Haiyue <[email protected]>; Power, Ciara <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>
Subject: RE: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthQuoted 63 lines
Quoted 24 lines
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 21:04
To: [email protected]
Cc: Power, Ciara <[email protected]>; Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Wei Zhao <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/net/ixgbe/ixgbe_rxtx.c +0
-0drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) · line 2507
Quoted 6 lines
drivers/net/ixgbe/ixgbe_rxtx.c +2
-1@@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) dev->tx_pkt_prepare =NULL ;if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type () !=RTE_PROC_PRIMARY || -ixgbe_txq_vec_setup (txq) ==0 )) { +ixgbe_txq_vec_setup (txq) ==0 ) && + rte_get_max_simd_bitwidth()As Konstantin mentioned: " I think it is a bit safer to do all checks first before
doingtxq_vec_setup()."Fox x86 & arm platforms, the setup is always 0, since '
sw_ring_v' is union with 'sw_ring' which is initialize at 'ixgbe_dev_tx_queue_setup'.union { struct ixgbe_tx_entry *sw_ring; /**< address of SW ring for scalar PMD. */ struct ixgbe_tx_entry_v *sw_ring_v; /**< address of SW ring for vector PMD */ };static inline int
ixgbe_txq_vec_setup_default(structixgbe_tx_queue*txq,
const structixgbe_txq_ops*txq_ops){ if (txq->sw_ring_v == NULL) return -1; /* leave the first one for overflow */ txq->sw_ring_v = txq->sw_ring_v + 1; txq->ops = txq_ops; return 0; }So we need check the SIMD bitwidth firstly to avoid changing the sw_ring* pointer address.
Also, looks like we need to add check on:
int
ixgbe_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt)Quoted 12 lines
{ struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; if (txq->offloads == 0 && #ifdef RTE_LIBRTE_SECURITY !(txq->using_ipsec) && #endif txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST) { if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && <------------------- Add the same check (rte_eal_process_type() != RTE_PROC_PRIMARY || txq->sw_ring_v != NULL)) { return ixgbe_tx_done_cleanup_vec(txq, free_cnt);
Quoted 1 line
Could you probably explain a bit more why it is needed?
To align with the vector selection path:
if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type() != RTE_PROC_PRIMARY || ixgbe_txq_vec_setup(txq) == 0))
Quoted 7 lines
Quoted 7 lines
} else { return ixgbe_tx_done_cleanup_simple(txq, free_cnt); }Quoted 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidth
Quoted 76 lines
Quoted 76 lines
Quoted 75 lines
Quoted 24 lines
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 21:04
To: [email protected]
Cc: Power, Ciara <[email protected]>; Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Wei Zhao <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/net/ixgbe/ixgbe_rxtx.c +0
-0drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) · line 2507
Quoted 6 lines
drivers/net/ixgbe/ixgbe_rxtx.c +2
-1@@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) dev->tx_pkt_prepare =NULL ;if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type () !=RTE_PROC_PRIMARY || -ixgbe_txq_vec_setup (txq) ==0 )) { +ixgbe_txq_vec_setup (txq) ==0 ) && + rte_get_max_simd_bitwidth()As Konstantin mentioned: " I think it is a bit safer to do all checks first before
doingtxq_vec_setup()."Fox x86 & arm platforms, the setup is always 0, since '
sw_ring_v' is union with 'sw_ring' which is initialize at 'ixgbe_dev_tx_queue_setup'.union { struct ixgbe_tx_entry *sw_ring; /**< address of SW ring for scalar PMD. */ struct ixgbe_tx_entry_v *sw_ring_v; /**< address of SW ring for vector PMD */ };static inline int
ixgbe_txq_vec_setup_default(structixgbe_tx_queue*txq,
const structixgbe_txq_ops*txq_ops){ if (txq->sw_ring_v == NULL) return -1; /* leave the first one for overflow */ txq->sw_ring_v = txq->sw_ring_v + 1; txq->ops = txq_ops; return 0; }So we need check the SIMD bitwidth firstly to avoid changing the sw_ring* pointer address.
Also, looks like we need to add check on:
int
ixgbe_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt){ struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; if (txq->offloads == 0 && #ifdef RTE_LIBRTE_SECURITY !(txq->using_ipsec) && #endif txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST) { if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && <------------------- Add the same check (rte_eal_process_type() != RTE_PROC_PRIMARY || txq->sw_ring_v != NULL)) { return ixgbe_tx_done_cleanup_vec(txq, free_cnt);
Quoted 7 lines
Quoted 1 line
Could you probably explain a bit more why it is needed?
To align with the vector selection path:
if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type() != RTE_PROC_PRIMARY || ixgbe_txq_vec_setup(txq) == 0))
Ok, so to make sure that TX is running in vector mode? If so, then doesn't txq->sw_ring_v != NULL was intended to do so? BTW, is it a valid check? Considering that sw_ring and sw_ring_v is a union?
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
} else { return ixgbe_tx_done_cleanup_simple(txq, free_cnt); }Quoted 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidth
Quoted 86 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Monday, October 12, 2020 17:09
To: Wang, Haiyue <[email protected]>; Power, Ciara <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>
Subject: RE: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthQuoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 21:04
To: [email protected]
Cc: Power, Ciara <[email protected]>; Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Wei Zhao <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue
Quoted 5 lines
drivers/net/ixgbe/ixgbe_rxtx.c +0
-0@@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue*txq)
Quoted 54 lines
Quoted 53 lines
Quoted 39 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) · line 2507
Quoted 6 lines
drivers/net/ixgbe/ixgbe_rxtx.c +2
-1dev->tx_pkt_prepare =NULL ;if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type () !=RTE_PROC_PRIMARY || -ixgbe_txq_vec_setup (txq) ==0 )) { +ixgbe_txq_vec_setup (txq) ==0 ) && + rte_get_max_simd_bitwidth()As Konstantin mentioned: " I think it is a bit safer to do all checks first before
doingtxq_vec_setup()."Fox x86 & arm platforms, the setup is always 0, since '
sw_ring_v' is union with 'sw_ring' which is initialize at 'ixgbe_dev_tx_queue_setup'.union { struct ixgbe_tx_entry *sw_ring; /**< address of SW ring for scalar PMD. */ struct ixgbe_tx_entry_v *sw_ring_v; /**< address of SW ring for vector PMD */ };static inline int
ixgbe_txq_vec_setup_default(structixgbe_tx_queue*txq,
const structixgbe_txq_ops*txq_ops){ if (txq->sw_ring_v == NULL) return -1; /* leave the first one for overflow */ txq->sw_ring_v = txq->sw_ring_v + 1; txq->ops = txq_ops; return 0; }So we need check the SIMD bitwidth firstly to avoid changing the sw_ring* pointer address.
Also, looks like we need to add check on:
int
ixgbe_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt)Quoted 12 lines
{ struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; if (txq->offloads == 0 && #ifdef RTE_LIBRTE_SECURITY !(txq->using_ipsec) && #endif txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST) { if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && <------------------- Add the same check (rte_eal_process_type() != RTE_PROC_PRIMARY || txq->sw_ring_v != NULL)) { return ixgbe_tx_done_cleanup_vec(txq, free_cnt);Could you probably explain a bit more why it is needed?
Quoted 8 lines
Quoted 5 lines
To align with the vector selection path:
if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type() != RTE_PROC_PRIMARY || ixgbe_txq_vec_setup(txq) == 0))Ok, so to make sure that TX is running in vector mode?
That's right, since no variable to save the vector mode selection, then the check condition should be the same.
Quoted 3 lines
If so, then doesn't
txq->sw_ring_v!= NULL was intended to do so? BTW, is it a valid check? Considering thatsw_ringandsw_ring_vis a union?
Yes, sw_ring_v should always be !NULL ;-)
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
} else { return ixgbe_tx_done_cleanup_simple(txq, free_cnt); }Quoted 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidth
Quoted 94 lines
Quoted 94 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Monday, October 12, 2020 17:09
To: Wang, Haiyue <[email protected]>; Power, Ciara <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>
Subject: RE: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthQuoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 21:04
To: [email protected]
Cc: Power, Ciara <[email protected]>; Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Wei Zhao <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue
Quoted 5 lines
drivers/net/ixgbe/ixgbe_rxtx.c +0
-0@@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue*txq)
Quoted 59 lines
Quoted 52 lines
Quoted 39 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) · line 2507
Quoted 6 lines
drivers/net/ixgbe/ixgbe_rxtx.c +2
-1dev->tx_pkt_prepare =NULL ;if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type () !=RTE_PROC_PRIMARY || -ixgbe_txq_vec_setup (txq) ==0 )) { +ixgbe_txq_vec_setup (txq) ==0 ) && + rte_get_max_simd_bitwidth()As Konstantin mentioned: " I think it is a bit safer to do all checks first before
doingtxq_vec_setup()."Fox x86 & arm platforms, the setup is always 0, since '
sw_ring_v' is union with 'sw_ring' which is initialize at 'ixgbe_dev_tx_queue_setup'.union { struct ixgbe_tx_entry *sw_ring; /**< address of SW ring for scalar PMD. */ struct ixgbe_tx_entry_v *sw_ring_v; /**< address of SW ring for vector PMD */ };static inline int
ixgbe_txq_vec_setup_default(structixgbe_tx_queue*txq,
const structixgbe_txq_ops*txq_ops){ if (txq->sw_ring_v == NULL) return -1; /* leave the first one for overflow */ txq->sw_ring_v = txq->sw_ring_v + 1; txq->ops = txq_ops; return 0; }So we need check the SIMD bitwidth firstly to avoid changing the sw_ring* pointer address.
Also, looks like we need to add check on:
int
ixgbe_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt)Quoted 12 lines
{ struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; if (txq->offloads == 0 && #ifdef RTE_LIBRTE_SECURITY !(txq->using_ipsec) && #endif txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST) { if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && <------------------- Add the same check (rte_eal_process_type() != RTE_PROC_PRIMARY || txq->sw_ring_v != NULL)) { return ixgbe_tx_done_cleanup_vec(txq, free_cnt);Quoted 1 line
Could you probably explain a bit more why it is needed?
To align with the vector selection path:
if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type() != RTE_PROC_PRIMARY || ixgbe_txq_vec_setup(txq) == 0))
Quoted 4 lines
Quoted 1 line
Ok, so to make sure that TX is running in vector mode?
That's right, since no variable to save the vector mode selection, then the check condition should be the same.
What I am saying, that here instead of conditions we should check was vector mode already selected or not.
Probably the easiest way to do it - check what tx function is setup.
Quoted 17 lines
Quoted 4 lines
If so, then doesn't
txq->sw_ring_v!= NULL was intended to do so? BTW, is it a valid check? Considering thatsw_ringandsw_ring_vis a union?Yes,
sw_ring_vshould always be !NULL ;-)Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
} else { return ixgbe_tx_done_cleanup_simple(txq, free_cnt); }Quoted 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidth
Quoted 101 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Tuesday, October 13, 2020 00:25
To: Wang, Haiyue <[email protected]>; Power, Ciara <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>
Subject: RE: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthQuoted 93 lines
Quoted 93 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Monday, October 12, 2020 17:09
To: Wang, Haiyue <[email protected]>; Power, Ciara <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>
Subject: RE: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthQuoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 21:04
To: [email protected]
Cc: Power, Ciara <[email protected]>; Zhao1, Wei <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>
Subject: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Wei Zhao <[email protected]>Cc Jeff Guo <[email protected]>Signed-off-by Ciara Power <[email protected]>--- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue
Quoted 5 lines
drivers/net/ixgbe/ixgbe_rxtx.c +0
-0@@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue*txq)
Quoted 59 lines
Quoted 52 lines
Quoted 39 lines
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue · line 2507
Quoted 6 lines
drivers/net/ixgbe/ixgbe_rxtx.c +2
-1dev->tx_pkt_prepare =NULL ;if (txq->tx_rs_thresh <=RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type () !=RTE_PROC_PRIMARY || -ixgbe_txq_vec_setup (txq) ==0 )) { +ixgbe_txq_vec_setup (txq) ==0 ) && + rte_get_max_simd_bitwidth()As Konstantin mentioned: " I think it is a bit safer to do all checks first before
doingtxq_vec_setup()."Fox x86 & arm platforms, the setup is always 0, since '
sw_ring_v' is union with 'sw_ring' which is initialize at 'ixgbe_dev_tx_queue_setup'.union { struct ixgbe_tx_entry *sw_ring; /**< address of SW ring for scalar PMD. */ struct ixgbe_tx_entry_v *sw_ring_v; /**< address of SW ring for vector PMD */ };static inline int
ixgbe_txq_vec_setup_default(structixgbe_tx_queue*txq,
const structixgbe_txq_ops*txq_ops){ if (txq->sw_ring_v == NULL) return -1; /* leave the first one for overflow */ txq->sw_ring_v = txq->sw_ring_v + 1; txq->ops = txq_ops; return 0; }So we need check the SIMD bitwidth firstly to avoid changing the sw_ring* pointer address.
Also, looks like we need to add check on:
int
ixgbe_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt)Quoted 12 lines
{ struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; if (txq->offloads == 0 && #ifdef RTE_LIBRTE_SECURITY !(txq->using_ipsec) && #endif txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST) { if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && <------------------- Add the same check (rte_eal_process_type() != RTE_PROC_PRIMARY || txq->sw_ring_v != NULL)) { return ixgbe_tx_done_cleanup_vec(txq, free_cnt);Quoted 1 line
Could you probably explain a bit more why it is needed?
To align with the vector selection path:
if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type() != RTE_PROC_PRIMARY || ixgbe_txq_vec_setup(txq) == 0))
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
Ok, so to make sure that TX is running in vector mode?
That's right, since no variable to save the vector mode selection, then the check condition should be the same.
What I am saying, that here instead of conditions we should check was vector mode already selected or not.
Probably the easiest way to do it - check what tx function is setup.
Misunderstood, yes, this is more intuitive and clean.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
2.17.1
PATCH v3 12/18 net/mlx5: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
---
v2: Moved check for max bitwidth into existing check vec
support function.
--- drivers/net/mlx5/mlx5_rxtx_vec.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/mlx5/mlx5_rxtx_vec.c +2 -0
@@ -148,6 +148,8 @@ mlx5_check_vec_rx_support(struct rte_eth_dev *dev)struct mlx5_priv *priv = dev->data->dev_private;uint32_t i; +if (rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) +return -ENOTSUP ;if (!priv->config.rx_vec_en)return -ENOTSUP ;if (mlx5_mprq_enabled (dev))
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 12/18] net/mlx5: add checks for max SIMD bitwidth
Quoted 9 lines
-----Original Message-----
From: Ciara Power <[email protected]>
Sent: Wednesday, September 30, 2020 16:04
To: [email protected]
Cc: Ciara Power <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Viacheslav Ovsiienko <[email protected]>
Subject: [PATCH v3 12/18] net/mlx5: add checks for max SIMD bitwidth
Quoted 8 lines
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Matan Azrad <[email protected]>Cc Shahaf Shuler <[email protected]>Cc Viacheslav Ovsiienko <[email protected]>Signed-off-by Ciara Power <[email protected]>
Looks good to me,
thank you, Ciara.
With best regards, Slava
PATCH v3 13/18 net/virtio: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
---
v3: Moved max SIMD bitwidth check to configure function with other vec
support checks.
--- drivers/net/virtio/virtio_ethdev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/virtio/virtio_ethdev.c +8 -1
@@ -2306,7 +2306,8 @@ virtio_dev_configure(struct rte_eth_dev *dev)if ((hw->use_vec_rx || hw->use_vec_tx) && (!rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F ) || !vtpci_with_feature (hw,VIRTIO_F_IN_ORDER ) || - !vtpci_with_feature (hw,VIRTIO_F_VERSION_1 ))) { + !vtpci_with_feature (hw,VIRTIO_F_VERSION_1 ) || +rte_get_max_simd_bitwidth () <RTE_MAX_512_SIMD )) {PMD_DRV_LOG (INFO ,"disabled packed ring vectorized path for requirements not met" ); hw->use_vec_rx =0 ;
@@ -2359,6 +2360,12 @@ virtio_dev_configure(struct rte_eth_dev *dev) "disabled split ring vectorized rx for offloading enabled"); hw->use_vec_rx =0 ; } + +if (rte_get_max_simd_bitwidth () <RTE_MAX_128_SIMD ) { +PMD_DRV_LOG (INFO , +"disabled split ring vectorized rx, max SIMD bitwidth too low" ); + hw->use_vec_rx =0 ; + } } }
Signature · 1 line
2.17.1
PATCH v3 14/18 distributor: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- lib/librte_distributor/rte_distributor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/librte_distributor/rte_distributor.c +2 -1
@@ -636,7 +636,8 @@ rte_distributor_create(const char *name, d->dist_match_fn =RTE_DIST_MATCH_SCALAR ;#if defined(RTE_ARCH_X86 ) - d->dist_match_fn =RTE_DIST_MATCH_VECTOR ; +if (rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) + d->dist_match_fn =RTE_DIST_MATCH_VECTOR ;#endif /*
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 14/18] distributor: add checks for max SIMD bitwidth
Hi Ciara,
Quoted 16 lines · Ciara Power
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc David Hunt <[email protected]>Signed-off-by Ciara Power <[email protected]>--- lib/librte_distributor/rte_distributor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/librte_distributor/rte_distributor.c +0
-0
lib/librte_distributor/rte_distributor.c rte_distributor_create(const char *name, · line 643
Quoted 9 lines
lib/librte_distributor/rte_distributor.c +2
-1@@ -636,7 +636,8 @@ rte_distributor_create(const char *name, d->dist_match_fn =RTE_DIST_MATCH_SCALAR ;#if defined(RTE_ARCH_X86 ) - d->dist_match_fn =RTE_DIST_MATCH_VECTOR ; +if (rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) + d->dist_match_fn =RTE_DIST_MATCH_VECTOR ;#endif /*
PATCH v3 15/18 member: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- lib/librte_member/rte_member_ht.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/librte_member/rte_member_ht.c +2 -1
@@ -113,7 +113,8 @@ rte_member_create_ht(struct rte_member_setsum *ss, }#if defined(RTE_ARCH_X86 )if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && -RTE_MEMBER_BUCKET_ENTRIES ==16 ) +RTE_MEMBER_BUCKET_ENTRIES ==16 && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) ss->sig_cmp_fn =RTE_MEMBER_COMPARE_AVX2 ; else#endif
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 15/18] member: add checks for max SIMD bitwidth
Quoted 34 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 6:04 AM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Wang, Yipeng1 <[email protected]>; Gobriel, Sameh <[email protected]>
Subject: [PATCH v3 15/18] member: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Yipeng Wang <[email protected]>Cc Sameh Gobriel <[email protected]>Signed-off-by Ciara Power <[email protected]>--- lib/librte_member/rte_member_ht.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/librte_member/rte_member_ht.c +2
-1@@ -113,7 +113,8 @@ rte_member_create_ht(struct rte_member_setsum *ss, }#if defined(RTE_ARCH_X86 )if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) && -RTE_MEMBER_BUCKET_ENTRIES ==16 ) +RTE_MEMBER_BUCKET_ENTRIES ==16 && +rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) ss->sig_cmp_fn =RTE_MEMBER_COMPARE_AVX2 ;
Quoted 4 lines
else
#endif
--
2.17.1
PATCH v3 16/18 efd: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
--- lib/librte_efd/rte_efd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_efd/rte_efd.c +5 -2
@@ -645,7 +645,9 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,* For less than 4 bits, scalar function performs better * than vectorised version */ -if (RTE_EFD_VALUE_NUM_BITS >3 &&rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) +if (RTE_EFD_VALUE_NUM_BITS >3 + &&rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) + &&rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD ) table->lookup_fn =EFD_LOOKUP_AVX2 ; else#endif
@@ -655,7 +657,8 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,* than vectorised version */ if (RTE_EFD_VALUE_NUM_BITS >16 && -rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON )) +rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) table->lookup_fn =EFD_LOOKUP_NEON ; else#endif
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 16/18] efd: add checks for max SIMD bitwidth
Quoted 47 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 30, 2020 6:04 AM
To: [email protected]
Cc: Power, Ciara <[email protected]>; Marohn, Byron <[email protected]>; Wang, Yipeng1 <[email protected]>
Subject: [PATCH v3 16/18] efd: add checks for max SIMD bitwidthWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
Cc Byron Marohn <[email protected]>Cc Yipeng Wang <[email protected]>Signed-off-by Ciara Power <[email protected]>--- lib/librte_efd/rte_efd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)lib/librte_efd/rte_efd.c index renamed from lib/librte_efd/rte_efd.c +0
-0
6a799556d4..509ecc8256100644lib/librte_efd/rte_efd.c +3
-1@@ -645,7 +645,9 @@ rte_efd_create(const char *name, uint32_tmax_num_rules, uint32_t key_len, * For less than 4 bits, scalar function performs better * than vectorised version */ -if (RTE_EFD_VALUE_NUM_BITS >3 && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)) + if (RTE_EFD_VALUE_NUM_BITS > 3 + &&rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 ) + &&rte_get_max_simd_bitwidth () >=RTE_MAX_256_SIMD )lib/librte_efd/rte_efd.c +2
-1table->lookup_fn =EFD_LOOKUP_AVX2 ; else#endif @@ -655,7 +657,8 @@ rte_efd_create(const char *name, uint32_tmax_num_rules, uint32_t key_len, * than vectorised version */ if (RTE_EFD_VALUE_NUM_BITS >16 && -rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON )) +rte_cpu_get_flag_enabled (RTE_CPUFLAG_NEON ) && +rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) table->lookup_fn =EFD_LOOKUP_NEON ;
Quoted 4 lines
else
#endif
--
2.17.1
PATCH v3 17/18 net: add checks for max SIMD bitwidth
In reply to Ciara PowerWhen choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
The vector path was initially chosen in RTE_INIT, however this is no longer suitable as we cannot check the max SIMD bitwidth at that time. The default chosen in RTE_INIT is now scalar. For best performance and to use vector paths, apps must explicitly call the set algorithm function before using other functions from this library, as this is where vector handlers are now chosen.
---
v3:
- Moved choosing vector paths out of RTE_INIT.
- Moved checking max_simd_bitwidth into the set_alg function.
--- lib/librte_net/rte_net_crc.c | 26 +++++++++++++++++--------- lib/librte_net/rte_net_crc.h | 3 ++- 2 files changed, 19 insertions(+), 10 deletions(-)
lib/librte_net/rte_net_crc.c +17 -9
@@ -9,6 +9,7 @@#include <rte_cpuflags.h> #include <rte_common.h> #include <rte_net_crc.h> +#include <rte_eal.h> #if defined(RTE_ARCH_X86_64 ) && defined(RTE_MACHINE_CPUFLAG_PCLMULQDQ )#define X86_64_SSE42_PCLMULQDQ 1
@@ -60,6 +61,9 @@ static rte_net_crc_handler handlers_neon[] = { };#endif +static uint16_t max_simd_bitwidth; +#define RTE_LOGTYPE_NET RTE_LOGTYPE_USER1 +/** * Reflect the bits about the middle *
@@ -145,18 +149,26 @@ rte_crc32_eth_handler(const uint8_t *data, uint32_t data_len)void rte_net_crc_set_alg (enum rte_net_crc_alg alg) { +if (max_simd_bitwidth ==0 ) + max_simd_bitwidth =rte_get_max_simd_bitwidth (); +switch (alg) {#ifdef X86_64_SSE42_PCLMULQDQ case RTE_NET_CRC_SSE42 : - handlers = handlers_sse42; -break ; +if (max_simd_bitwidth >=RTE_MAX_128_SIMD ) { + handlers = handlers_sse42; +return ; + } +RTE_LOG (INFO ,NET ,"Max SIMD Bitwidth too low, using scalar\n" );#elif definedARM64_NEON_PMULL /* fall-through */ case RTE_NET_CRC_NEON : -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_PMULL )) { +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_PMULL ) && + max_simd_bitwidth >=RTE_MAX_128_SIMD ) { handlers = handlers_neon; -break ; +return ; } +RTE_LOG (INFO ,NET ,"Max SIMD Bitwidth too low or CPU flag not enabled, using scalar\n" );#endif /* fall-through */ case RTE_NET_CRC_SCALAR :
@@ -184,19 +196,15 @@ rte_net_crc_calc(const void *data,/* Select highest available crc algorithm as default one */ RTE_INIT (rte_net_crc_init) { -enum rte_net_crc_alg alg =RTE_NET_CRC_SCALAR ; -rte_net_crc_scalar_init ();#ifdef X86_64_SSE42_PCLMULQDQ - alg =RTE_NET_CRC_SSE42 ;rte_net_crc_sse42_init ();#elif definedARM64_NEON_PMULL if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_PMULL )) { - alg =RTE_NET_CRC_NEON ;rte_net_crc_neon_init (); }#endif -rte_net_crc_set_alg (alg); +rte_net_crc_set_alg (RTE_NET_CRC_SCALAR ); }
lib/librte_net/rte_net_crc.h +2 -1
@@ -28,7 +28,8 @@ enum rte_net_crc_alg {/** * This API set the CRC computation algorithm (i.e. scalar version, * x86 64-bit sse4.2 intrinsic version, etc.) and internal data -* structure. +* structure. This should be called before any other functions, to +* choose the algorithm for best performance. * * @param alg * This parameter is used to select the CRC implementation version.
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidth
Hi Ciara,
Quoted 10 lines
From: dev <[email protected]> On Behalf Of Ciara Power
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.The vector path was initially chosen in
RTE_INIT, however this is no longer suitable as we cannot check the max SIMD bitwidth at that time. The default chosen inRTE_INITis now scalar. For best performance and to use vector paths, apps must explicitly call the set algorithm function before using other functions from this library, as this is where vector handlers are now chosen.
[DC] Has it been decided that it is ok to now require applications to pick the CRC algorithm they want to use?
An application which previously automatically got SSE4.2 CRC, for example, will now automatically only get scalar.
If this is ok, this should probably be called out explicitly in release notes as it may not be Immediately noticeable to users that they now need to select the CRC algo.
Actually, in general, the release notes need to be updated for this patchset.
Quoted 18 lines
Suggested-by Jasvinder Singh <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Moved choosing vector paths out ofRTE_INIT.
- Moved checkingmax_simd_bitwidthinto theset_algfunction.--- lib/librte_net/rte_net_crc.c | 26 +++++++++++++++++--------- lib/librte_net/rte_net_crc.h | 3 ++- 2 files changed, 19 insertions(+), 10 deletions(-)lib/librte_net/rte_net_crc.c index renamed from lib/librte_net/rte_net_crc.c +0
-0
9fd4794a9d..241eb16399100644lib/librte_net/rte_net_crc.c +0
-0
<snip>
Quoted 6 lines
lib/librte_net/rte_net_crc.c +3
-0@@ -145,18 +149,26 @@ rte_crc32_eth_handler(const uint8_t *data, uint32_t data_len) void rte_net_crc_set_alg(enum rte_net_crc_alg alg) { +if (max_simd_bitwidth ==0 ) + max_simd_bitwidth =rte_get_max_simd_bitwidth (); +switch (alg) {
lib/librte_net/rte_net_crc.c rte_crc32_eth_handler(const uint8_t *data, · line 161
Quoted 10 lines
lib/librte_net/rte_net_crc.c +5
-2#ifdef X86_64_SSE42_PCLMULQDQ case RTE_NET_CRC_SSE42 : - handlers = handlers_sse42; -break ; +if (max_simd_bitwidth >=RTE_MAX_128_SIMD ) { + handlers = handlers_sse42; +return ; + } +RTE_LOG (INFO ,NET ,"Max SIMD Bitwidth too low, using scalar\n");
[DC] Not sure if you're aware but there is another patchset which adds an AVX512 CRC implementation and run-time checking of cpuflags to select the CRC path to use:
https://patchwork.dpdk.org/project/dpdk/list/?series=12596
There will be a task to merge these 2 patchsets if both are merged. It looks fairly straightforward to me to merge these, but it would be good if you take a look too
Re: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidth
Quoted 30 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Wednesday, September 30, 2020 4:04 PM
To: Power, Ciara <[email protected]>; [email protected]
Cc: Power, Ciara <[email protected]>; Singh, Jasvinder <[email protected]>; Olivier Matz <[email protected]>; O'loingsigh, Mairtin <[email protected]>; Ryan, Brendan <[email protected]>; Richardson, Bruce <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidthHi Ciara,
Quoted 10 lines
From: dev <[email protected]> On Behalf Of Ciara Power When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
The vector path was initially chosen in
RTE_INIT, however this is no longer suitable as we cannot check the max SIMD bitwidth at that time. The default chosen inRTE_INITis now scalar. For best performance and to use vector paths, apps must explicitly call the set algorithm function before using other functions from this library, as this is where vector handlers are now chosen.[DC] Has it been decided that it is ok to now require applications to pick the CRC algorithm they want to use?
Quoted 8 lines
An application which previously automatically got SSE4.2 CRC, for example, will now automatically only get scalar.
If this is ok, this should probably be called out explicitly in release notes as it may not be Immediately noticeable to users that they now need to select the CRC algo.
Actually, in general, the release notes need to be updated for this patchset.
The decision to move rte_set_alg() out of RTE_INIT was taken to avoid check on max_simd_bitwidth in data path for every single time when crc_calc() api is invoked. Based on my understanding, max_simd_bitwidth is set after eal init, and when used in crc_calc(), it might override the default crc algo set during RTE_INIT. Therefore, to avoid extra check on max_simd_bitwidth in data path, better option will be to use this static configuration one time after eal init in the set_algo API.
Quoted 48 lines
Quoted 19 lines
Suggested-by Jasvinder Singh <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Moved choosing vector paths out ofRTE_INIT.
- Moved checkingmax_simd_bitwidthinto theset_algfunction.--- lib/librte_net/rte_net_crc.c | 26 +++++++++++++++++--------- lib/librte_net/rte_net_crc.h | 3 ++- 2 files changed, 19 insertions(+), 10 deletions(-)(quoted diff) +0
-0
b/lib/librte_net/rte_net_crc.cindex9fd4794a9d..241eb16399100644lib/librte_net/rte_net_crc.c +0
-0<snip>
Quoted 16 lines
lib/librte_net/rte_net_crc.c +0
-0@@ -145,18 +149,26 @@ rte_crc32_eth_handler(const uint8_t *data,
uint32_tdata_len) voidrte_net_crc_set_alg(enum rte_net_crc_alg alg){lib/librte_net/rte_net_crc.c +8
-2+if (max_simd_bitwidth ==0 ) + max_simd_bitwidth =rte_get_max_simd_bitwidth (); +switch (alg) {#ifdef X86_64_SSE42_PCLMULQDQ case RTE_NET_CRC_SSE42 : - handlers = handlers_sse42; -break ; +if (max_simd_bitwidth >=RTE_MAX_128_SIMD ) { + handlers = handlers_sse42; +return ; + } + RTE_LOG(INFO, NET, "Max SIMD Bitwidth too low, usingQuoted 1 line
scalar\n");
[DC] Not sure if you're aware but there is another patchset which adds an AVX512 CRC implementation and run-time checking of cpuflags to select the CRC path to use:
https://patchwork.dpdk.org/project/dpdk/list/?series=12596There will be a task to merge these 2 patchsets if both are merged. It looks fairly straightforward to me to merge these, but it would be good if you take a look too
Re: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidth
Hi Jasvinder/Ciara
Quoted 27 lines
-----Original Message-----
From: Singh, Jasvinder <[email protected]>Quoted 15 lines
Quoted 11 lines
From: dev <[email protected]> On Behalf Of Ciara Power When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
The vector path was initially chosen in
RTE_INIT, however this is no longer suitable as we cannot check the max SIMD bitwidth at that time. The default chosen inRTE_INITis now scalar. For best performance and to use vector paths, apps must explicitly call the set algorithm function before using other functions from this library, as this is where vector handlers are now chosen.[DC] Has it been decided that it is ok to now require applications to pick the CRC algorithm they want to use?
Quoted 8 lines
An application which previously automatically got SSE4.2 CRC, for example, will now automatically only get scalar.
If this is ok, this should probably be called out explicitly in release notes as it may not be Immediately noticeable to users that they now need to select the CRC algo.
Actually, in general, the release notes need to be updated for this
patchset.
Quoted 7 lines
The decision to move
rte_set_alg()out ofRTE_INITwas taken to avoid check onmax_simd_bitwidthin data path for every single time whencrc_calc()api is invoked. Based on my understanding,max_simd_bitwidthis set after eal init, and when used incrc_calc(), it might override the default crc algo set duringRTE_INIT. Therefore, to avoid extra check onmax_simd_bitwidthin data path, better option will be to use this static configuration one time after eal init in theset_algoAPI.
[DC] Yes that is a good change to have made to avoid extra datapath checks.
Based on off-list discussion, I now also know the reason behind now defaulting to scalar CRC in RTE_INIT. If a higher bitwidth CRC was chosen by RTE_INIT (e.g. SSE4.2 CRC) but the max_simd_bitwidth was then set to RTE_NO_SIMD (64) through the EAL parameter or call to rte_set_max_simd_bitwidth(), then there is a mismatch if rte_net_crc_set_alg() is not then called to reconfigure the CRC. Defaulting to scalar avoids this mismatch and works on all archs
As I mentioned before, I think this needs to be called out in release notes, as it's an under-the-hood change which could cause app performance to drop if app developers aren't aware of it - the API itself hasn't changed, so they may not read the doxygen :)
Quoted 51 lines
Quoted 51 lines
Quoted 21 lines
Suggested-by Jasvinder Singh <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Moved choosing vector paths out ofRTE_INIT.
- Moved checkingmax_simd_bitwidthinto theset_algfunction.--- lib/librte_net/rte_net_crc.c | 26 +++++++++++++++++--------- lib/librte_net/rte_net_crc.h | 3 ++- 2 files changed, 19 insertions(+), 10 deletions(-)(quoted diff) +0
-0
b/lib/librte_net/rte_net_crc.cindex9fd4794a9d..241eb16399100644lib/librte_net/rte_net_crc.c +0
-0<snip>
Quoted 16 lines
lib/librte_net/rte_net_crc.c +0
-0@@ -145,18 +149,26 @@ rte_crc32_eth_handler(const uint8_t *data,
uint32_tdata_len) voidrte_net_crc_set_alg(enum rte_net_crc_alg alg){lib/librte_net/rte_net_crc.c +8
-2+if (max_simd_bitwidth ==0 ) + max_simd_bitwidth =rte_get_max_simd_bitwidth (); +switch (alg) {#ifdef X86_64_SSE42_PCLMULQDQ case RTE_NET_CRC_SSE42 : - handlers = handlers_sse42; -break ; +if (max_simd_bitwidth >=RTE_MAX_128_SIMD ) { + handlers = handlers_sse42; +return ; + } + RTE_LOG(INFO, NET, "Max SIMD Bitwidth too low, usingQuoted 1 line
scalar\n");
[DC] Not sure if you're aware but there is another patchset which adds an
AVX512 CRC implementation and run-time checking of cpuflags to select the CRC path to use:
https://patchwork.dpdk.org/project/dpdk/list/?series=12596There will be a task to merge these 2 patchsets if both are merged. It looks fairly straightforward to me to merge these, but it would be good if you take a look too
Re: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidth
Hi David,
Thanks for reviewing,
Quoted 62 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Thursday 1 October 2020 15:17
To: Singh, Jasvinder <[email protected]>; Power, Ciara <[email protected]>; [email protected]
Cc: Power, Ciara <[email protected]>; Olivier Matz <[email protected]>; O'loingsigh, Mairtin <[email protected]>; Ryan, Brendan <[email protected]>; Richardson, Bruce <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidthHi Jasvinder/Ciara
Quoted 6 lines
-----Original Message-----
From: Singh, Jasvinder <[email protected]>Quoted 4 lines
Quoted 4 lines
From: dev <[email protected]> On Behalf Of Ciara Power When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled
path.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The vector path was initially chosen in
RTE_INIT, however this is no longer suitable as we cannot check the max SIMD bitwidth at thattime.
Quoted 18 lines
Quoted 8 lines
Quoted 4 lines
The default chosen in
RTE_INITis now scalar. For best performance and to use vector paths, apps must explicitly call the set algorithm function before using other functions from this library, as this is where vector handlers are now chosen.[DC] Has it been decided that it is ok to now require applications to pick the CRC algorithm they want to use?
Quoted 8 lines
An application which previously automatically got SSE4.2 CRC, for example, will now automatically only get scalar.
If this is ok, this should probably be called out explicitly in release notes as it may not be Immediately noticeable to users that they now need to select the CRC algo.
Actually, in general, the release notes need to be updated for this
patchset.
Quoted 7 lines
The decision to move
rte_set_alg()out ofRTE_INITwas taken to avoid check onmax_simd_bitwidthin data path for every single time whencrc_calc()api is invoked. Based on my understanding,max_simd_bitwidthis set after eal init, and when used incrc_calc(), it might override the default crc algo set duringRTE_INIT. Therefore, to avoid extra check onmax_simd_bitwidthin data path, better option will be to use this static configuration one time after eal init in theset_algoAPI.
[DC] Yes that is a good change to have made to avoid extra datapath checks.
Based on off-list discussion, I now also know the reason behind now defaulting to scalar CRC in
RTE_INIT. If a higher bitwidth CRC was chosen byRTE_INIT(e.g.
SSE4.2 CRC) but themax_simd_bitwidthwas then set toRTE_NO_SIMD(64) through the EAL parameter or call torte_set_max_simd_bitwidth(), then there is a mismatch ifrte_net_crc_set_alg()is not then called to reconfigure the CRC. Defaulting to scalar avoids this mismatch and works on all archs
Quoted 5 lines
As I mentioned before, I think this needs to be called out in release notes, as it's an under-the-hood change which could cause app performance to drop if app developers aren't aware of it - the API itself hasn't changed, so they may not read the doxygen :)
Yes that is a good point, I can add to the release notes for this to call it out.
Quoted 48 lines
Quoted 48 lines
Quoted 48 lines
Quoted 21 lines
Suggested-by Jasvinder Singh <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Moved choosing vector paths out ofRTE_INIT.
- Moved checkingmax_simd_bitwidthinto theset_algfunction.--- lib/librte_net/rte_net_crc.c | 26 +++++++++++++++++--------- lib/librte_net/rte_net_crc.h | 3 ++- 2 files changed, 19 insertions(+), 10 deletions(-)(quoted diff) +0
-0
b/lib/librte_net/rte_net_crc.cindex9fd4794a9d..241eb16399100644lib/librte_net/rte_net_crc.c +0
-0<snip>
Quoted 16 lines
lib/librte_net/rte_net_crc.c +0
-0@@ -145,18 +149,26 @@ rte_crc32_eth_handler(const uint8_t *data,
uint32_tdata_len) voidrte_net_crc_set_alg(enum rte_net_crc_alg alg){lib/librte_net/rte_net_crc.c +8
-2+if (max_simd_bitwidth ==0 ) + max_simd_bitwidth =rte_get_max_simd_bitwidth (); +switch (alg) {#ifdef X86_64_SSE42_PCLMULQDQ case RTE_NET_CRC_SSE42 : - handlers = handlers_sse42; -break ; +if (max_simd_bitwidth >=RTE_MAX_128_SIMD ) { + handlers = handlers_sse42; +return ; + } + RTE_LOG(INFO, NET, "Max SIMD Bitwidth too low, usingQuoted 1 line
scalar\n");
[DC] Not sure if you're aware but there is another patchset which adds an
AVX512 CRC implementation and run-time checking of cpuflags to select the CRC path to use:
https://patchwork.dpdk.org/project/dpdk/list/?series=12596
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
There will be a task to merge these 2 patchsets if both are merged. It looks fairly straightforward to me to merge these, but it would be good if you take a look too
I have looked at that patchset, I agree, I think they will be straightforward to merge together.
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidth
Hi,
Quoted 66 lines · Ciara
Hi David,
Thanks for reviewing,
Quoted 62 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Thursday 1 October 2020 15:17
To: Singh, Jasvinder <[email protected]>; Power, Ciara <[email protected]>; [email protected]
Cc: Power, Ciara <[email protected]>; Olivier Matz <[email protected]>; O'loingsigh, Mairtin <[email protected]>; Ryan, Brendan <[email protected]>; Richardson, Bruce <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidthHi Jasvinder/Ciara
Quoted 6 lines
-----Original Message-----
From: Singh, Jasvinder <[email protected]>Quoted 4 lines
Quoted 4 lines
From: dev <[email protected]> On Behalf Of Ciara Power When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled
path.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The vector path was initially chosen in
RTE_INIT, however this is no longer suitable as we cannot check the max SIMD bitwidth at thattime.
Quoted 18 lines
Quoted 8 lines
Quoted 4 lines
The default chosen in
RTE_INITis now scalar. For best performance and to use vector paths, apps must explicitly call the set algorithm function before using other functions from this library, as this is where vector handlers are now chosen.[DC] Has it been decided that it is ok to now require applications to pick the CRC algorithm they want to use?
Quoted 8 lines
An application which previously automatically got SSE4.2 CRC, for example, will now automatically only get scalar.
If this is ok, this should probably be called out explicitly in release notes as it may not be Immediately noticeable to users that they now need to select the CRC algo.
Actually, in general, the release notes need to be updated for this
patchset.
Quoted 7 lines
The decision to move
rte_set_alg()out ofRTE_INITwas taken to avoid check onmax_simd_bitwidthin data path for every single time whencrc_calc()api is invoked. Based on my understanding,max_simd_bitwidthis set after eal init, and when used incrc_calc(), it might override the default crc algo set duringRTE_INIT. Therefore, to avoid extra check onmax_simd_bitwidthin data path, better option will be to use this static configuration one time after eal init in theset_algoAPI.
[DC] Yes that is a good change to have made to avoid extra datapath checks.
Based on off-list discussion, I now also know the reason behind now defaulting to scalar CRC in
RTE_INIT. If a higher bitwidth CRC was chosen byRTE_INIT(e.g.
SSE4.2 CRC) but themax_simd_bitwidthwas then set toRTE_NO_SIMD(64) through the EAL parameter or call torte_set_max_simd_bitwidth(), then there is a mismatch ifrte_net_crc_set_alg()is not then called to reconfigure the CRC. Defaulting to scalar avoids this mismatch and works on all archs
Quoted 7 lines
Quoted 5 lines
As I mentioned before, I think this needs to be called out in release notes, as it's an under-the-hood change which could cause app performance to drop if app developers aren't aware of it - the API itself hasn't changed, so they may not read the doxygen :)
Yes that is a good point, I can add to the release notes for this to call it out.
I don't think it is a good idea to have the scalar crc by default. To me, the fastest available CRC has to be enabled by default.
I understand the technical reason why you did it like this however: the SIMD bitwidth may not be known at the time the RTE_INIT(rte_net_crc_init) function is called.
A simple approach to solve this issue would be to initialize the rte_net_crc_handler pointer to a handlers_default. The first time a crc is called, the rte_crc32_*_default_handler() function would check the configured SIMD bitwidth, and set the handler to the correct one, to avoid to do the test for next time.
This approach still does not solve the case where the SIMD bitwidth is modified during the life of the application. In this case, a callback would have to be registered to notify SIMD bitwidth changes... but I don't think it is worth to do it. Instead, it can be documented that rte_set_max_simd_bitwidth() has to be called early, before rte_eal_init().
Quoted 56 lines
Quoted 48 lines
Quoted 48 lines
Quoted 48 lines
Quoted 21 lines
Suggested-by Jasvinder Singh <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Moved choosing vector paths out ofRTE_INIT.
- Moved checkingmax_simd_bitwidthinto theset_algfunction.--- lib/librte_net/rte_net_crc.c | 26 +++++++++++++++++--------- lib/librte_net/rte_net_crc.h | 3 ++- 2 files changed, 19 insertions(+), 10 deletions(-)(quoted diff) +0
-0
b/lib/librte_net/rte_net_crc.cindex9fd4794a9d..241eb16399100644lib/librte_net/rte_net_crc.c +0
-0<snip>
Quoted 16 lines
lib/librte_net/rte_net_crc.c +0
-0@@ -145,18 +149,26 @@ rte_crc32_eth_handler(const uint8_t *data,
uint32_tdata_len) voidrte_net_crc_set_alg(enum rte_net_crc_alg alg){lib/librte_net/rte_net_crc.c +8
-2+if (max_simd_bitwidth ==0 ) + max_simd_bitwidth =rte_get_max_simd_bitwidth (); +switch (alg) {#ifdef X86_64_SSE42_PCLMULQDQ case RTE_NET_CRC_SSE42 : - handlers = handlers_sse42; -break ; +if (max_simd_bitwidth >=RTE_MAX_128_SIMD ) { + handlers = handlers_sse42; +return ; + } + RTE_LOG(INFO, NET, "Max SIMD Bitwidth too low, usingQuoted 1 line
scalar\n");
[DC] Not sure if you're aware but there is another patchset which adds an
AVX512 CRC implementation and run-time checking of cpuflags to select the CRC path to use:
https://patchwork.dpdk.org/project/dpdk/list/?series=12596Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
There will be a task to merge these 2 patchsets if both are merged. It looks fairly straightforward to me to merge these, but it would be good if you take a look too
I have looked at that patchset, I agree, I think they will be straightforward to merge together.
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidth
Hi Olivier,
Quoted 103 lines
-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Tuesday 6 October 2020 11:01
To: Power, Ciara <[email protected]>
Cc: Coyle, David <[email protected]>; Singh, Jasvinder <[email protected]>; [email protected]; O'loingsigh, Mairtin <[email protected]>; Ryan, Brendan <[email protected]>; Richardson, Bruce <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidthHi,
Quoted 63 lines · Ciara
Hi David,
Thanks for reviewing,
Quoted 59 lines
-----Original Message-----
From: Coyle, David <[email protected]>
Sent: Thursday 1 October 2020 15:17
To: Singh, Jasvinder <[email protected]>; Power, Ciara <[email protected]>; [email protected]
Cc: Power, Ciara <[email protected]>; Olivier Matz <[email protected]>; O'loingsigh, Mairtin <[email protected]>; Ryan, Brendan <[email protected]>; Richardson, Bruce <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidthHi Jasvinder/Ciara
Quoted 7 lines
-----Original Message-----
From: Singh, Jasvinder <[email protected]>Quoted 5 lines
Quoted 5 lines
From: dev <[email protected]> On Behalf Of Ciara Power When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled
path.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The vector path was initially chosen in
RTE_INIT, however this is no longer suitable as we cannot check the max SIMD bitwidth at thattime.
Quoted 19 lines
Quoted 11 lines
Quoted 4 lines
The default chosen in
RTE_INITis now scalar. For best performance and to use vector paths, apps must explicitly call the set algorithm function before using other functions from this library, as this is where vector handlers are now chosen.[DC] Has it been decided that it is ok to now require applications to pick the CRC algorithm they want to use?
An application which previously automatically got SSE4.2 CRC, for example, will now automatically only get scalar.
Quoted 6 lines
If this is ok, this should probably be called out explicitly in release notes as it may not be Immediately noticeable to users that they now need to select the CRC algo.
Actually, in general, the release notes need to be updated for this
patchset.
Quoted 9 lines
The decision to move
rte_set_alg()out ofRTE_INITwas taken to avoid check onmax_simd_bitwidthin data path for every single time whencrc_calc()api is invoked. Based on my understanding,max_simd_bitwidthis set after eal init, and when used incrc_calc(), it might override the default crc algo set duringRTE_INIT. Therefore, to avoid extra check onmax_simd_bitwidthin data path, better option will be to use this static configuration one time after eal init in theset_algoAPI.
[DC] Yes that is a good change to have made to avoid extra datapath
checks.
Quoted 10 lines
Quoted 10 lines
Based on off-list discussion, I now also know the reason behind now defaulting to scalar CRC in
RTE_INIT. If a higher bitwidth CRC was chosen byRTE_INIT(e.g.
SSE4.2 CRC) but themax_simd_bitwidthwas then set toRTE_NO_SIMD
(64) through the EAL parameter or call torte_set_max_simd_bitwidth(), then there is a mismatch ifrte_net_crc_set_alg()is not then called to reconfigure the CRC. Defaulting to scalar avoids this mismatch and works on all archsQuoted 7 lines
Quoted 5 lines
As I mentioned before, I think this needs to be called out in release notes, as it's an under-the-hood change which could cause app performance to drop if app developers aren't aware of it - the API itself hasn't changed, so they may not read the doxygen :)
Yes that is a good point, I can add to the release notes for this to call it out.
I don't think it is a good idea to have the scalar crc by default. To me, the fastest available CRC has to be enabled by default.
I understand the technical reason why you did it like this however: the SIMD bitwidth may not be known at the time the
RTE_INIT(rte_net_crc_init)function is called.
Quoted 5 lines
A simple approach to solve this issue would be to initialize the
rte_net_crc_handlerpointer to ahandlers_default. The first time a crc is called, the rte_crc32_*_default_handler() function would check the configured SIMD bitwidth, and set the handler to the correct one, to avoid to do the test for next time.
Thanks for this suggestion, will try this for the next version, it seems it will work quite well, thanks.
Quoted 6 lines
This approach still does not solve the case where the SIMD bitwidth is modified during the life of the application. In this case, a callback would have to be registered to notify SIMD bitwidth changes... but I don't think it is worth to do it. Instead, it can be documented that
rte_set_max_simd_bitwidth()has to be called early, beforerte_eal_init().
Yes, It is documented in the Doxygen comment for the rte_set_max_simd_bitwidth() function
that it should be called early, as you mentioned.
<snip>
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidth
In reply to Olivier MatzQuoted 66 lines
Quoted 45 lines
Quoted 45 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: dev <[email protected]> On Behalf Of Ciara Power When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled
path.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The vector path was initially chosen in
RTE_INIT, however this is no longer suitable as we cannot check the max SIMD bitwidth at thattime.
Quoted 18 lines
Quoted 8 lines
Quoted 4 lines
The default chosen in
RTE_INITis now scalar. For best performance and to use vector paths, apps must explicitly call the set algorithm function before using other functions from this library, as this is where vector handlers are now chosen.[DC] Has it been decided that it is ok to now require applications to pick the CRC algorithm they want to use?
Quoted 8 lines
An application which previously automatically got SSE4.2 CRC, for example, will now automatically only get scalar.
If this is ok, this should probably be called out explicitly in release notes as it may not be Immediately noticeable to users that they now need to select the CRC algo.
Actually, in general, the release notes need to be updated for this
patchset.
Quoted 7 lines
The decision to move
rte_set_alg()out ofRTE_INITwas taken to avoid check onmax_simd_bitwidthin data path for every single time whencrc_calc()api is invoked. Based on my understanding,max_simd_bitwidthis set after eal init, and when used incrc_calc(), it might override the default crc algo set duringRTE_INIT. Therefore, to avoid extra check onmax_simd_bitwidthin data path, better option will be to use this static configuration one time after eal init in theset_algoAPI.
[DC] Yes that is a good change to have made to avoid extra datapath checks.
Based on off-list discussion, I now also know the reason behind now defaulting to scalar CRC in
RTE_INIT. If a higher bitwidth CRC was chosen byRTE_INIT(e.g.
SSE4.2 CRC) but themax_simd_bitwidthwas then set toRTE_NO_SIMD(64) through the EAL parameter or call torte_set_max_simd_bitwidth(), then there is a mismatch ifrte_net_crc_set_alg()is not then called to reconfigure the CRC. Defaulting to scalar avoids this mismatch and works on all archsQuoted 7 lines
Quoted 5 lines
As I mentioned before, I think this needs to be called out in release notes, as it's an under-the-hood change which could cause app performance to drop if app developers aren't aware of it - the API itself hasn't changed, so they may not read the doxygen :)
Yes that is a good point, I can add to the release notes for this to call it out.
I don't think it is a good idea to have the scalar crc by default. To me, the fastest available CRC has to be enabled by default.
I understand the technical reason why you did it like this however: the SIMD bitwidth may not be known at the time the
RTE_INIT(rte_net_crc_init)function is called.A simple approach to solve this issue would be to initialize the
rte_net_crc_handlerpointer to ahandlers_default. The first time a crc is called, the rte_crc32_*_default_handler() function would check the configured SIMD bitwidth, and set the handler to the correct one, to avoid to do the test for next time.
Quoted 6 lines
This approach still does not solve the case where the SIMD bitwidth is modified during the life of the application. In this case, a callback would have to be registered to notify SIMD bitwidth changes... but I don't think it is worth to do it. Instead, it can be documented that
rte_set_max_simd_bitwidth()has to be called early, beforerte_eal_init().
Actually I also thought about callback approach.
It does complicate things a bit for sure, but on a positive side - it allows to solve RTE_INIT() code-path selection problem in a generic way, plus it means zero changes in the data-path. So probably worth to consider it.
Quoted 59 lines
Quoted 59 lines
Quoted 51 lines
Quoted 51 lines
Quoted 51 lines
Quoted 24 lines
Suggested-by Jasvinder Singh <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Moved choosing vector paths out ofRTE_INIT.
- Moved checkingmax_simd_bitwidthinto theset_algfunction.--- lib/librte_net/rte_net_crc.c | 26 +++++++++++++++++--------- lib/librte_net/rte_net_crc.h | 3 ++- 2 files changed, 19 insertions(+), 10 deletions(-)(quoted diff) +0
-0
b/lib/librte_net/rte_net_crc.cindex9fd4794a9d..241eb16399100644lib/librte_net/rte_net_crc.c +0
-0<snip>
Quoted 16 lines
lib/librte_net/rte_net_crc.c +0
-0@@ -145,18 +149,26 @@ rte_crc32_eth_handler(const uint8_t *data,
uint32_tdata_len) voidrte_net_crc_set_alg(enum rte_net_crc_alg alg){lib/librte_net/rte_net_crc.c +8
-2+if (max_simd_bitwidth ==0 ) + max_simd_bitwidth =rte_get_max_simd_bitwidth (); +switch (alg) {#ifdef X86_64_SSE42_PCLMULQDQ case RTE_NET_CRC_SSE42 : - handlers = handlers_sse42; -break ; +if (max_simd_bitwidth >=RTE_MAX_128_SIMD ) { + handlers = handlers_sse42; +return ; + } + RTE_LOG(INFO, NET, "Max SIMD Bitwidth too low, usingQuoted 1 line
scalar\n");
[DC] Not sure if you're aware but there is another patchset which adds an
AVX512 CRC implementation and run-time checking of cpuflags to select the CRC path to use:
https://patchwork.dpdk.org/project/dpdk/list/?series=12596Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
There will be a task to merge these 2 patchsets if both are merged. It looks fairly straightforward to me to merge these, but it would be good if you take a look too
I have looked at that patchset, I agree, I think they will be straightforward to merge together.
Thanks,
Ciara
Re: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidth
Hi Konstantin,
Quoted 93 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Thursday 8 October 2020 15:55
To: Olivier Matz <[email protected]>; Power, Ciara <[email protected]>
Cc: Coyle, David <[email protected]>; Singh, Jasvinder <[email protected]>; [email protected]; O'loingsigh, Mairtin <[email protected]>; Ryan, Brendan <[email protected]>; Richardson, Bruce <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidthQuoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
From: dev <[email protected]> On Behalf Of Ciara Power When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled
path.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The vector path was initially chosen in
RTE_INIT, however this is no longer suitable as we cannot check the max SIMD bitwidth at thattime.
Quoted 28 lines
Quoted 11 lines
Quoted 4 lines
The default chosen in
RTE_INITis now scalar. For best performance and to use vector paths, apps must explicitly call the set algorithm function before using other functions from this library, as this is where vector handlers are now chosen.[DC] Has it been decided that it is ok to now require applications to pick the CRC algorithm they want to use?
An application which previously automatically got SSE4.2 CRC, for example, will now automatically only get scalar.
Quoted 6 lines
If this is ok, this should probably be called out explicitly in release notes as it may not be Immediately noticeable to users that they now need to select the CRC algo.
Actually, in general, the release notes need to be updated for this
patchset.
The decision to move
rte_set_alg()out ofRTE_INITwas taken to avoid check onmax_simd_bitwidthin data path for every single time whencrc_calc()api is invoked. Based on my understanding,max_simd_bitwidthis set after eal init, and when used incrc_calc(), it might override the default crc algo set duringRTE_INIT. Therefore, to avoid extra check onmax_simd_bitwidthin data path, better option will be to use this static configuration one time after eal init in theset_algoQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
API.
[DC] Yes that is a good change to have made to avoid extra datapath
checks.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Based on off-list discussion, I now also know the reason behind now defaulting to scalar CRC in
RTE_INIT. If a higher bitwidth CRC was chosen byRTE_INIT(e.g.
SSE4.2 CRC) but themax_simd_bitwidthwas then set toRTE_NO_SIMD
(64) through the EAL parameter or call torte_set_max_simd_bitwidth(), then there is a mismatch ifrte_net_crc_set_alg()is not then called to reconfigure the CRC. Defaulting to scalar avoids this mismatch and works on all archsQuoted 7 lines
Quoted 7 lines
Quoted 5 lines
As I mentioned before, I think this needs to be called out in release notes, as it's an under-the-hood change which could cause app performance to drop if app developers aren't aware of it - the API itself hasn't changed, so they may not read the doxygen :)
Yes that is a good point, I can add to the release notes for this to call it
out.
Quoted 14 lines
I don't think it is a good idea to have the scalar crc by default. To me, the fastest available CRC has to be enabled by default.
I understand the technical reason why you did it like this however:
the SIMD bitwidth may not be known at the time theRTE_INIT(rte_net_crc_init)function is called.A simple approach to solve this issue would be to initialize the
rte_net_crc_handlerpointer to ahandlers_default. The first time a crc is called, the rte_crc32_*_default_handler() function would check the configured SIMD bitwidth, and set the handler to the correct one, to avoid to do the test for next time.Quoted 6 lines
This approach still does not solve the case where the SIMD bitwidth is modified during the life of the application. In this case, a callback would have to be registered to notify SIMD bitwidth changes... but I don't think it is worth to do it. Instead, it can be documented that
rte_set_max_simd_bitwidth()has to be called early, beforerte_eal_init().
Quoted 6 lines
Actually I also thought about callback approach.
It does complicate things a bit for sure, but on a positive side - it allows to solveRTE_INIT()code-path selection problem in a generic way, plus it means zero changes in the data-path.
So probably worth to consider it.
I am not sure adding callbacks to allow for runtime changes to max SIMD bitwidth is worth it. I have sent a new version of my patchset which currently does not have this suggested rework to use callbacks.
Thanks,
Ciara
<snip>
Re: [dpdk-dev] [PATCH v3 17/18] net: add checks for max SIMD bitwidth
In reply to Ciara PowerHi,
Quoted 37 lines · Ciara Power
When choosing a vector path to take, an extra condition must be satisfied to ensure the max SIMD bitwidth allows for the CPU enabled path.
The vector path was initially chosen in
RTE_INIT, however this is no longer suitable as we cannot check the max SIMD bitwidth at that time. The default chosen inRTE_INITis now scalar. For best performance and to use vector paths, apps must explicitly call the set algorithm function before using other functions from this library, as this is where vector handlers are now chosen.Suggested-by Jasvinder Singh <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Moved choosing vector paths out ofRTE_INIT.
- Moved checkingmax_simd_bitwidthinto theset_algfunction.--- lib/librte_net/rte_net_crc.c | 26 +++++++++++++++++--------- lib/librte_net/rte_net_crc.h | 3 ++- 2 files changed, 19 insertions(+), 10 deletions(-)lib/librte_net/rte_net_crc.c +1
-0@@ -9,6 +9,7 @@#include <rte_cpuflags.h> #include <rte_common.h> #include <rte_net_crc.h> +#include <rte_eal.h> #if defined(RTE_ARCH_X86_64 ) && defined(RTE_MACHINE_CPUFLAG_PCLMULQDQ )#define X86_64_SSE42_PCLMULQDQ 1
lib/librte_net/rte_net_crc.c static rte_net_crc_handler handlers_neon[] = { · line 65
Quoted 5 lines
lib/librte_net/rte_net_crc.c +2
-0@@ -60,6 +61,9 @@ static rte_net_crc_handler handlers_neon[] = { };#endif +static uint16_t max_simd_bitwidth; +#define RTE_LOGTYPE_NET RTE_LOGTYPE_USER1
RTE_LOG_REGISTER() should be used instead.
Quoted 11 lines
lib/librte_net/rte_net_crc.c +4
-0+/** * Reflect the bits about the middle * @@ -145,18 +149,26 @@ rte_crc32_eth_handler(const uint8_t *data, uint32_t data_len)void rte_net_crc_set_alg (enum rte_net_crc_alg alg) { +if (max_simd_bitwidth ==0 ) + max_simd_bitwidth =rte_get_max_simd_bitwidth (); +
lib/librte_net/rte_net_crc.c rte_crc32_eth_handler(const uint8_t *data, uint32_t data_len) · line 162
Quoted 10 lines
lib/librte_net/rte_net_crc.c +5
-2switch (alg) {#ifdef X86_64_SSE42_PCLMULQDQ case RTE_NET_CRC_SSE42 : - handlers = handlers_sse42; -break ; +if (max_simd_bitwidth >=RTE_MAX_128_SIMD ) { + handlers = handlers_sse42; +return ; + } +RTE_LOG (INFO ,NET ,"Max SIMD Bitwidth too low, using scalar\n" );
If max_simd_bitwidth is too low, it will keep the previous value. I think we should avoid to say "using scalar" in the log, even if it is correct today. For instance, when the avx implementation will be added, the log will become wrong.
Quoted 52 lines
lib/librte_net/rte_net_crc.c +5
-7#elif definedARM64_NEON_PMULL /* fall-through */ case RTE_NET_CRC_NEON : -if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_PMULL )) { +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_PMULL ) && + max_simd_bitwidth >=RTE_MAX_128_SIMD ) { handlers = handlers_neon; -break ; +return ; } +RTE_LOG (INFO ,NET ,"Max SIMD Bitwidth too low or CPU flag not enabled, using scalar\n" );#endif /* fall-through */ case RTE_NET_CRC_SCALAR :@@ -184,19 +196,15 @@ rte_net_crc_calc(const void *data,/* Select highest available crc algorithm as default one */ RTE_INIT (rte_net_crc_init) { -enum rte_net_crc_alg alg =RTE_NET_CRC_SCALAR ; -rte_net_crc_scalar_init ();#ifdef X86_64_SSE42_PCLMULQDQ - alg =RTE_NET_CRC_SSE42 ;rte_net_crc_sse42_init ();#elif definedARM64_NEON_PMULL if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_PMULL )) { - alg =RTE_NET_CRC_NEON ;rte_net_crc_neon_init (); }#endif -rte_net_crc_set_alg (alg); +rte_net_crc_set_alg (RTE_NET_CRC_SCALAR ); }lib/librte_net/rte_net_crc.h +2
-1@@ -28,7 +28,8 @@ enum rte_net_crc_alg {/** * This API set the CRC computation algorithm (i.e. scalar version, * x86 64-bit sse4.2 intrinsic version, etc.) and internal data -* structure. +* structure. This should be called before any other functions, to +* choose the algorithm for best performance. * * @param alg * This parameter is used to select the CRC implementation version. Signature · 1 line
2.17.1
PATCH v3 18/18 lpm: choose vector path at runtime
In reply to Ciara PowerWhen choosing the vector path, max SIMD bitwidth is now checked to ensure a vector path is allowable. To do this, rather than the vector lookup functions being called directly from apps, a generic lookup function is called which will call the vector functions if suitable.
--- lib/librte_lpm/rte_lpm.h | 57 ++++++++++++++++++++++++++------ lib/librte_lpm/rte_lpm_altivec.h | 2 +- lib/librte_lpm/rte_lpm_neon.h | 2 +- lib/librte_lpm/rte_lpm_sse.h | 2 +- 4 files changed, 50 insertions(+), 13 deletions(-)
lib/librte_lpm/rte_lpm.h +47 -10
@@ -397,8 +397,18 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,/* Mask four results. */ #define RTE_LPM_MASKX4_RES UINT64_C(0x00ffffff00ffffff) +#if defined(RTE_ARCH_ARM ) || defined(RTE_ARCH_ARM64 ) +#include "rte_lpm_neon.h" +#elif defined(RTE_ARCH_PPC_64 ) +#include "rte_lpm_altivec.h" +#else +#include "rte_lpm_sse.h" +#endif +/** -* Lookup four IP addresses in an LPM table. +* Lookup four IP addresses in an LPM table individually by calling the +* lookup function for each ip. This is used when lookupx4 is called but +* the vector path is not suitable. * * @param lpm * LPM object handle
@@ -417,16 +427,43 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,* if lookup would fail. */ static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], -uint32_t defv); +rte_lpm_lookupx4_scalar (struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +uint32_t defv) +{ +int i; +for (i =0 ; i <4 ; i++) +if (rte_lpm_lookup (lpm, ((uint32_t *) &ip)[i], &hop[i]) <0 ) + hop[i] = defv;/* lookupx4 expected to set on failure */ +} -#if defined(RTE_ARCH_ARM ) || defined(RTE_ARCH_ARM64 ) -#include "rte_lpm_neon.h" -#elif defined(RTE_ARCH_PPC_64 ) -#include "rte_lpm_altivec.h" -#else -#include "rte_lpm_sse.h" -#endif +/** +* Lookup four IP addresses in an LPM table. +* +* @param lpm +* LPM object handle +* @param ip +* Four IPs to be looked up in the LPM table +* @param hop +* Next hop of the most specific rule found for IP (valid on lookup hit only). +* This is an 4 elements array of two byte values. +* If the lookup was successful for the given IP, then least significant byte +* of the corresponding element is the actual next hop and the most +* significant byte is zero. +* If the lookup for the given IP failed, then corresponding element would +* contain default value, see description of then next parameter. +* @param defv +* Default value to populate into corresponding element of hop[] array, +* if lookup would fail. +*/ +static inline void +rte_lpm_lookupx4 (struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +uint32_t defv) +{ +if (rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) +rte_lpm_lookupx4_vec (lpm, ip, hop, defv); +else +rte_lpm_lookupx4_scalar (lpm, ip, hop, defv); +} #ifdef __cplusplus }
lib/librte_lpm/rte_lpm_altivec.h +1 -1
@@ -16,7 +16,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ],uint32_t defv) { vector signed int i24;
lib/librte_lpm/rte_lpm_neon.h +1 -1
@@ -16,7 +16,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ],uint32_t defv) {uint32x4_t i24;
lib/librte_lpm/rte_lpm_sse.h +1 -1
@@ -15,7 +15,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ],uint32_t defv) {__m128i i24;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3 18/18] lpm: choose vector path at runtime
Hi Ciara,
Quoted 77 lines · Ciara Power
When choosing the vector path, max SIMD bitwidth is now checked to ensure a vector path is allowable. To do this, rather than the vector lookup functions being called directly from apps, a generic lookup function is called which will call the vector functions if suitable.
Signed-off-by Ciara Power <[email protected]>--- lib/librte_lpm/rte_lpm.h | 57 ++++++++++++++++++++++++++------ lib/librte_lpm/rte_lpm_altivec.h | 2 +- lib/librte_lpm/rte_lpm_neon.h | 2 +- lib/librte_lpm/rte_lpm_sse.h | 2 +- 4 files changed, 50 insertions(+), 13 deletions(-)lib/librte_lpm/rte_lpm.h +37
-10@@ -397,8 +397,18 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,/* Mask four results. */ #define RTE_LPM_MASKX4_RES UINT64_C(0x00ffffff00ffffff) +#if defined(RTE_ARCH_ARM ) || defined(RTE_ARCH_ARM64 ) +#include "rte_lpm_neon.h" +#elif defined(RTE_ARCH_PPC_64 ) +#include "rte_lpm_altivec.h" +#else +#include "rte_lpm_sse.h" +#endif +/** -* Lookup four IP addresses in an LPM table. +* Lookup four IP addresses in an LPM table individually by calling the +* lookup function for each ip. This is used when lookupx4 is called but +* the vector path is not suitable. * * @param lpm * LPM object handle @@ -417,16 +427,43 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,* if lookup would fail. */ static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], -uint32_t defv); +rte_lpm_lookupx4_scalar (struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +uint32_t defv) +{ +int i; +for (i =0 ; i <4 ; i++) +if (rte_lpm_lookup (lpm, ((uint32_t *) &ip)[i], &hop[i]) <0 ) + hop[i] = defv;/* lookupx4 expected to set on failure */ +} -#if defined(RTE_ARCH_ARM ) || defined(RTE_ARCH_ARM64 ) -#include "rte_lpm_neon.h" -#elif defined(RTE_ARCH_PPC_64 ) -#include "rte_lpm_altivec.h" -#else -#include "rte_lpm_sse.h" -#endif +/** +* Lookup four IP addresses in an LPM table. +* +* @param lpm +* LPM object handle +* @param ip +* Four IPs to be looked up in the LPM table +* @param hop +* Next hop of the most specific rule found for IP (valid on lookup hit only). +* This is an 4 elements array of two byte values. +* If the lookup was successful for the given IP, then least significant byte +* of the corresponding element is the actual next hop and the most +* significant byte is zero. +* If the lookup for the given IP failed, then corresponding element would +* contain default value, see description of then next parameter. +* @param defv +* Default value to populate into corresponding element of hop[] array, +* if lookup would fail.
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips, · line 466
Quoted 10 lines
lib/librte_lpm/rte_lpm.h +10
-0+*/ +static inline void +rte_lpm_lookupx4 (struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +uint32_t defv) +{ +if (rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) +rte_lpm_lookupx4_vec (lpm, ip, hop, defv); +else +rte_lpm_lookupx4_scalar (lpm, ip, hop, defv); +}
I'm afraid this will lead to a drop in performance. rte_lpm_lookupx4 is used in the hot path, and a bulk size is too small to amortize the cost of adding this extra logic.
Quoted 43 lines
lib/librte_lpm/rte_lpm.h +0
-0#ifdef __cplusplus }lib/librte_lpm/rte_lpm_altivec.h +1
-1@@ -16,7 +16,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ],uint32_t defv) { vector signed int i24;lib/librte_lpm/rte_lpm_neon.h +1
-1@@ -16,7 +16,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ],uint32_t defv) {uint32x4_t i24;lib/librte_lpm/rte_lpm_sse.h +1
-1@@ -15,7 +15,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ],uint32_t defv) {__m128i i24;
Signature · 2 lines
Regards, Vladimir
Re: [dpdk-dev] [PATCH v3 18/18] lpm: choose vector path at runtime
Quoted 88 lines
Hi Ciara,
Quoted 83 lines · Ciara Power
When choosing the vector path, max SIMD bitwidth is now checked to ensure a vector path is allowable. To do this, rather than the vector lookup functions being called directly from apps, a generic lookup function is called which will call the vector functions if suitable.
Signed-off-by Ciara Power <[email protected]>--- lib/librte_lpm/rte_lpm.h | 57 ++++++++++++++++++++++++++------ lib/librte_lpm/rte_lpm_altivec.h | 2 +- lib/librte_lpm/rte_lpm_neon.h | 2 +- lib/librte_lpm/rte_lpm_sse.h | 2 +- 4 files changed, 50 insertions(+), 13 deletions(-)lib/librte_lpm/rte_lpm.h +43
-10@@ -397,8 +397,18 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,/* Mask four results. */ #define RTE_LPM_MASKX4_RES UINT64_C(0x00ffffff00ffffff) +#if defined(RTE_ARCH_ARM ) || defined(RTE_ARCH_ARM64 ) +#include "rte_lpm_neon.h" +#elif defined(RTE_ARCH_PPC_64 ) +#include "rte_lpm_altivec.h" +#else +#include "rte_lpm_sse.h" +#endif +/** -* Lookup four IP addresses in an LPM table. +* Lookup four IP addresses in an LPM table individually by calling the +* lookup function for each ip. This is used when lookupx4 is called but +* the vector path is not suitable. * * @param lpm * LPM object handle @@ -417,16 +427,43 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,* if lookup would fail. */ static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], -uint32_t defv); +rte_lpm_lookupx4_scalar (struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +uint32_t defv) +{ +int i; +for (i =0 ; i <4 ; i++) +if (rte_lpm_lookup (lpm, ((uint32_t *) &ip)[i], &hop[i]) <0 ) + hop[i] = defv;/* lookupx4 expected to set on failure */ +} -#if defined(RTE_ARCH_ARM ) || defined(RTE_ARCH_ARM64 ) -#include "rte_lpm_neon.h" -#elif defined(RTE_ARCH_PPC_64 ) -#include "rte_lpm_altivec.h" -#else -#include "rte_lpm_sse.h" -#endif +/** +* Lookup four IP addresses in an LPM table. +* +* @param lpm +* LPM object handle +* @param ip +* Four IPs to be looked up in the LPM table +* @param hop +* Next hop of the most specific rule found for IP (valid on lookup hit only). +* This is an 4 elements array of two byte values. +* If the lookup was successful for the given IP, then least significant byte +* of the corresponding element is the actual next hop and the most +* significant byte is zero. +* If the lookup for the given IP failed, then corresponding element would +* contain default value, see description of then next parameter. +* @param defv +* Default value to populate into corresponding element of hop[] array, +* if lookup would fail. +*/ +static inline void +rte_lpm_lookupx4 (struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +uint32_t defv) +{ +if (rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD )
Quoted 8 lines
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips, · line 466
Quoted 4 lines
lib/librte_lpm/rte_lpm.h +4
-0+rte_lpm_lookupx4_vec (lpm, ip, hop, defv); + else +rte_lpm_lookupx4_scalar (lpm ,ip ,hop ,defv ); +}I'm afraid this will lead to a drop in performance.
rte_lpm_lookupx4is used in the hot path, and a bulk size is too small to amortize the cost of adding this extra logic.
I do share Vladimir's concern regarding performance here. As I said in other mail - it seems not much point to insert these checks into inline SSE specific function, as SSE is enabled by default for all x86 builds.
As another more generic thought - might be better to avoid these checks in other public SIMD-specific inline functions (if any). If such function get called from some .c, then at least such SIMD ISA is already enabled for that .c file and I think this check should be left for caller to do.
Quoted 47 lines
Quoted 35 lines
lib/librte_lpm/rte_lpm.h +0
-0#ifdef __cplusplus }lib/librte_lpm/rte_lpm_altivec.h +1
-1@@ -16,7 +16,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ],uint32_t defv) { vector signed int i24;lib/librte_lpm/rte_lpm_neon.h +1
-1@@ -16,7 +16,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ],uint32_t defv) {uint32x4_t i24;lib/librte_lpm/rte_lpm_sse.h +0
-0lib/librte_lpm/rte_lpm_sse.h extern "C" { · line 21
Quoted 8 lines
lib/librte_lpm/rte_lpm_sse.h +1
-1@@ -15,7 +15,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ],uint32_t defv) {__m128i i24;--
Regards,
Vladimir
Re: [dpdk-dev] [PATCH v3 18/18] lpm: choose vector path at runtime
Hi Konstantin,
Quoted 113 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Thursday 8 October 2020 15:40
To: Medvedkin, Vladimir <[email protected]>; Power, Ciara <[email protected]>; [email protected]
Cc: Richardson, Bruce <[email protected]>; Jerin Jacob <[email protected]>; Ruifeng Wang <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 18/18] lpm: choose vector path at runtimeQuoted 18 lines
Hi Ciara,
Quoted 13 lines · Ciara Power
When choosing the vector path, max SIMD bitwidth is now checked to ensure a vector path is allowable. To do this, rather than the vector lookup functions being called directly from apps, a generic lookup function is called which will call the vector functions if suitable.
Signed-off-by Ciara Power <[email protected]>--- lib/librte_lpm/rte_lpm.h | 57 ++++++++++++++++++++++++++------ lib/librte_lpm/rte_lpm_altivec.h | 2 +- lib/librte_lpm/rte_lpm_neon.h | 2 +- lib/librte_lpm/rte_lpm_sse.h | 2 +- 4 files changed, 50 insertions(+), 13 deletions(-)Quoted 5 lines
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm
Quoted 5 lines
lib/librte_lpm/rte_lpm.h +0
-0@@ -397,8 +397,18 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm*lpm, const
uint32_t*ips,Quoted 14 lines
Quoted 14 lines
lib/librte_lpm/rte_lpm.h +9
-1/* Mask four results. */ #define RTE_LPM_MASKX4_RES UINT64_C(0x00ffffff00ffffff) +#if defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64) #include +"rte_lpm_neon.h" +#elif defined(RTE_ARCH_PPC_64) +#include "rte_lpm_altivec.h" +#else +#include "rte_lpm_sse.h" +#endif +/** -* Lookup four IP addresses in an LPM table. +* Lookup four IP addresses in an LPM table individually by calling Quoted 8 lines
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct
Quoted 8 lines
lib/librte_lpm/rte_lpm.h +4
-0+ the + * lookup function for each ip. This is used when lookupx4 is + called but + * the vector path is not suitable. * * @param lpm * LPM object handle@@ -417,16 +427,43 @@ rte_lpm_lookup_bulk_func(const struct
rte_lpm*lpm, constuint32_t*ips,Quoted 6 lines
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,
Quoted 6 lines
lib/librte_lpm/rte_lpm.h +1
-2* if lookup would fail. */ static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], -uint32_t defv); +rte_lpm_lookupx4_scalar(struct rte_lpm *lpm, xmm_t ip, uint32_thop[4],
Quoted 6 lines
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,
Quoted 6 lines
lib/librte_lpm/rte_lpm.h +6
-0+ uint32_t defv) +{ +int i; +for (i =0 ; i <4 ; i++) +if (rte_lpm_lookup (lpm, ((uint32_t *) &ip)[i], &hop[i]) <0 ) + hop[i] = defv;/* lookupx4 expected to set on failure */ }
Quoted 17 lines
Quoted 7 lines
lib/librte_lpm/rte_lpm.h +0
-1-#if defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64) -#include"
rte_lpm_neon.h"lib/librte_lpm/rte_lpm.h +0
-4-#elif defined(RTE_ARCH_PPC_64 ) -#include "rte_lpm_altivec.h" -#else -#include "rte_lpm_sse.h" lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,
Quoted 10 lines
lib/librte_lpm/rte_lpm.h +9
-1-#endif +/** +* Lookup four IP addresses in an LPM table. +* +* @param lpm +* LPM object handle +* @param ip +* Four IPs to be looked up in the LPM table +* @param hop +* Next hop of the most specific rule found for IP (valid on lookup hit only).
Quoted 2 lines
Quoted 2 lines
+ * This is an 4 elements array of two byte values.
+ * If the lookup was successful for the given IP, then least significantbyte
Quoted 3 lines
Quoted 3 lines
+ * of the corresponding element is the actual next hop and the most + * significant byte is zero. + * If the lookup for the given IP failed, then corresponding elementwould
Quoted 9 lines
Quoted 9 lines
+ * contain default value, see description of then next parameter.
+ * @param defv
+ * Default value to populate into corresponding element of hop[] array,
+ * if lookup would fail.
+ */lib/librte_lpm/rte_lpm.h +4
-0+static inline void +rte_lpm_lookupx4 (struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +uint32_t defv) +{Quoted 8 lines
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,
Quoted 4 lines
lib/librte_lpm/rte_lpm.h +4
-0+if (rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) +rte_lpm_lookupx4_vec (lpm, ip, hop, defv); +else +rte_lpm_lookupx4_scalar (lpm, ip, hop, defv); }I'm afraid this will lead to a drop in performance.
rte_lpm_lookupx4is used in the hot path, and a bulk size is too small to amortize the cost of adding this extra logic.
Quoted 4 lines
I do share Vladimir's concern regarding performance here.
As I said in other mail - it seems not much point to insert these checks into inline SSE specific function, as SSE is enabled by default for all x86 builds.
The performance impact is quite small, thanks Vladimir for providing these results:
before patches:
LPM LookupX4: 25.1 cycles (fails = 12.5%) LPM LookupX4: 25.2 cycles (fails = 12.5%) LPM LookupX4: 25.2 cycles (fails = 12.5%)
v3:
LPM LookupX4: 26.2 cycles (fails = 12.5%) LPM LookupX4: 26.2 cycles (fails = 12.5%) LPM LookupX4: 26.2 cycles (fails = 12.5%)
v4:
Note: I haven't sent this publicly yet, modified v3 slightly to check the bitwidth in LPM create and set a flag that is used in lookupx4 to choose either vector or scalar function.
LPM LookupX4: 25.5 cycles (fails = 12.5%) LPM LookupX4: 25.5 cycles (fails = 12.5%) LPM LookupX4: 25.5 cycles (fails = 12.5%)
Thanks,
Ciara
Quoted 60 lines
As another more generic thought - might be better to avoid these checks in other public SIMD-specific inline functions (if any).
If such function get called from some .c, then at least such SIMD ISA is already enabled for that .c file and I think this check should be left for caller to do.Quoted 54 lines
Quoted 40 lines
#ifdef __cplusplus }lib/librte_lpm/rte_lpm_altivec.h +2
-1@@ -16,7 +16,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec(const struct rte_lpm *lpm, xmm_t ip, uint32_t +hop[4], uint32_t defv) { vector signed int i24;(quoted diff) +0
-0
b/lib/librte_lpm/rte_lpm_neon.hindex6c131d3125..14b184515d100644lib/librte_lpm/rte_lpm_neon.h +2
-1@@ -16,7 +16,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec(const struct rte_lpm *lpm, xmm_t ip, uint32_t +hop[4], uint32_t defv) { uint32x4_t i24;(quoted diff) +0
-0
b/lib/librte_lpm/rte_lpm_sse.hindex44770b6ff8..cb5477c6cf100644lib/librte_lpm/rte_lpm_sse.h extern "C" { · line 21
Quoted 10 lines
lib/librte_lpm/rte_lpm_sse.h +2
-1@@ -15,7 +15,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec(const struct rte_lpm *lpm, xmm_t ip, uint32_t +hop[4], uint32_t defv) { __m128i i24;--
Regards,
Vladimir
Re: [dpdk-dev] [PATCH v3 18/18] lpm: choose vector path at runtime
Hi Ciara,
Quoted 124 lines
Hi Konstantin,
Quoted 113 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Thursday 8 October 2020 15:40
To: Medvedkin, Vladimir <[email protected]>; Power, Ciara <[email protected]>; [email protected]
Cc: Richardson, Bruce <[email protected]>; Jerin Jacob <[email protected]>; Ruifeng Wang <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v3 18/18] lpm: choose vector path at runtimeQuoted 18 lines
Hi Ciara,
Quoted 13 lines · Ciara Power
When choosing the vector path, max SIMD bitwidth is now checked to ensure a vector path is allowable. To do this, rather than the vector lookup functions being called directly from apps, a generic lookup function is called which will call the vector functions if suitable.
Signed-off-by Ciara Power <[email protected]>--- lib/librte_lpm/rte_lpm.h | 57 ++++++++++++++++++++++++++------ lib/librte_lpm/rte_lpm_altivec.h | 2 +- lib/librte_lpm/rte_lpm_neon.h | 2 +- lib/librte_lpm/rte_lpm_sse.h | 2 +- 4 files changed, 50 insertions(+), 13 deletions(-)Quoted 5 lines
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm
Quoted 5 lines
lib/librte_lpm/rte_lpm.h +0
-0@@ -397,8 +397,18 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm*lpm, const
uint32_t*ips,Quoted 14 lines
Quoted 14 lines
lib/librte_lpm/rte_lpm.h +9
-1/* Mask four results. */ #define RTE_LPM_MASKX4_RES UINT64_C(0x00ffffff00ffffff) +#if defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64) #include +"rte_lpm_neon.h" +#elif defined(RTE_ARCH_PPC_64) +#include "rte_lpm_altivec.h" +#else +#include "rte_lpm_sse.h" +#endif +/** -* Lookup four IP addresses in an LPM table. +* Lookup four IP addresses in an LPM table individually by calling Quoted 8 lines
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct
Quoted 8 lines
lib/librte_lpm/rte_lpm.h +4
-0+ the + * lookup function for each ip. This is used when lookupx4 is + called but + * the vector path is not suitable. * * @param lpm * LPM object handle@@ -417,16 +427,43 @@ rte_lpm_lookup_bulk_func(const struct
rte_lpm*lpm, constuint32_t*ips,Quoted 6 lines
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,
Quoted 6 lines
lib/librte_lpm/rte_lpm.h +1
-2* if lookup would fail. */ static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], -uint32_t defv); +rte_lpm_lookupx4_scalar(struct rte_lpm *lpm, xmm_t ip, uint32_thop[4],
Quoted 6 lines
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,
Quoted 6 lines
lib/librte_lpm/rte_lpm.h +6
-0+ uint32_t defv) +{ +int i; +for (i =0 ; i <4 ; i++) +if (rte_lpm_lookup (lpm, ((uint32_t *) &ip)[i], &hop[i]) <0 ) + hop[i] = defv;/* lookupx4 expected to set on failure */ }
Quoted 17 lines
Quoted 7 lines
lib/librte_lpm/rte_lpm.h +0
-1-#if defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64) -#include"
rte_lpm_neon.h"lib/librte_lpm/rte_lpm.h +0
-4-#elif defined(RTE_ARCH_PPC_64 ) -#include "rte_lpm_altivec.h" -#else -#include "rte_lpm_sse.h" lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,
Quoted 10 lines
lib/librte_lpm/rte_lpm.h +9
-1-#endif +/** +* Lookup four IP addresses in an LPM table. +* +* @param lpm +* LPM object handle +* @param ip +* Four IPs to be looked up in the LPM table +* @param hop +* Next hop of the most specific rule found for IP (valid on lookup hit only).
Quoted 2 lines
Quoted 2 lines
+ * This is an 4 elements array of two byte values.
+ * If the lookup was successful for the given IP, then least significantbyte
Quoted 3 lines
Quoted 3 lines
+ * of the corresponding element is the actual next hop and the most + * significant byte is zero. + * If the lookup for the given IP failed, then corresponding elementwould
Quoted 9 lines
Quoted 9 lines
+ * contain default value, see description of then next parameter.
+ * @param defv
+ * Default value to populate into corresponding element of hop[] array,
+ * if lookup would fail.
+ */lib/librte_lpm/rte_lpm.h +4
-0+static inline void +rte_lpm_lookupx4 (struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +uint32_t defv) +{Quoted 8 lines
lib/librte_lpm/rte_lpm.h rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,
Quoted 4 lines
lib/librte_lpm/rte_lpm.h +4
-0+if (rte_get_max_simd_bitwidth () >=RTE_MAX_128_SIMD ) +rte_lpm_lookupx4_vec (lpm, ip, hop, defv); +else +rte_lpm_lookupx4_scalar (lpm, ip, hop, defv); }I'm afraid this will lead to a drop in performance.
rte_lpm_lookupx4is used in the hot path, and a bulk size is too small to amortize the cost of adding this extra logic.Quoted 4 lines
I do share Vladimir's concern regarding performance here.
As I said in other mail - it seems not much point to insert these checks into inline SSE specific function, as SSE is enabled by default for all x86 builds.The performance impact is quite small, thanks Vladimir for providing these results:
before patches:
Quoted 8 lines
LPM LookupX4: 25.1 cycles (fails = 12.5%) LPM LookupX4: 25.2 cycles (fails = 12.5%) LPM LookupX4: 25.2 cycles (fails = 12.5%)v3:
LPM LookupX4: 26.2 cycles (fails = 12.5%) LPM LookupX4: 26.2 cycles (fails = 12.5%) LPM LookupX4: 26.2 cycles (fails = 12.5%)
Yes, perf difference is surprisingly small... Wonder what tests did you use for that?
I'd expect that on l3fwd it would be more noticeable, especially on machines with low-end cpus.
Quoted 3 lines
v4:
Note: I haven't sent this publicly yet, modified v3 slightly to check the bitwidth in LPM create and set a flag that is used in lookupx4 to choose either vector or scalar function.
Yes, avoiding function call will definitely help here.
Though I am sill not convinced we have to make such checks in that function at all (and other inline functions).
Inline functions will be compiled within user code and their behaviour should be controlled together with the rest of user code.
Let say in l3fwd for IA rte_lpm_lookupx4 is called from /l3fwd_lpm_sse.h, which as name implies is supposed to be build and used with SSE enabled.
If we'd like l3fwd to obey 'max-simd-width' parameter, then it needs to be done somewhere at startup, when behaviour is selected, not inside every possible inline function that does use SSE instrincts.
Quoted 68 lines
LPM LookupX4: 25.5 cycles (fails = 12.5%) LPM LookupX4: 25.5 cycles (fails = 12.5%) LPM LookupX4: 25.5 cycles (fails = 12.5%)Thanks,
CiaraQuoted 60 lines
As another more generic thought - might be better to avoid these checks in other public SIMD-specific inline functions (if any).
If such function get called from some .c, then at least such SIMD ISA is already enabled for that .c file and I think this check should be left for caller to do.Quoted 54 lines
Quoted 40 lines
#ifdef __cplusplus }lib/librte_lpm/rte_lpm_altivec.h +2
-1@@ -16,7 +16,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec(const struct rte_lpm *lpm, xmm_t ip, uint32_t +hop[4], uint32_t defv) { vector signed int i24;(quoted diff) +0
-0
b/lib/librte_lpm/rte_lpm_neon.hindex6c131d3125..14b184515d100644lib/librte_lpm/rte_lpm_neon.h +2
-1@@ -16,7 +16,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec(const struct rte_lpm *lpm, xmm_t ip, uint32_t +hop[4], uint32_t defv) { uint32x4_t i24;(quoted diff) +0
-0
b/lib/librte_lpm/rte_lpm_sse.hindex44770b6ff8..cb5477c6cf100644lib/librte_lpm/rte_lpm_sse.h extern "C" { · line 21
Quoted 10 lines
lib/librte_lpm/rte_lpm_sse.h +2
-1@@ -15,7 +15,7 @@ extern "C" {#endif static inline void -rte_lpm_lookupx4 (const struct rte_lpm *lpm,xmm_t ip,uint32_t hop[4 ], +rte_lpm_lookupx4_vec(const struct rte_lpm *lpm, xmm_t ip, uint32_t +hop[4], uint32_t defv) { __m128i i24;--
Regards,
Vladimir
Re: [dpdk-dev] [PATCH v3 18/18] lpm: choose vector path at runtime
In reply to Ciara PowerQuoted 7 lines · Ciara Power
When choosing the vector path, max SIMD bitwidth is now checked to ensure a vector path is allowable. To do this, rather than the vector lookup functions being called directly from apps, a generic lookup function is called which will call the vector functions if suitable.
Signed-off-by Ciara Power <[email protected]>
Got a build error on this patch with ./devtools/test-meson-builds.sh ("gcc-shared" target):
[2/3] Compiling C object 'examples/c590b3c@@dpdk-l3fwd-thread@exe/performance-thread_l3fwd-thread_main.c.o'.
FAILED: examples/c590b3c@@dpdk-l3fwd-thread@exe/performance-thread_l3fwd-thread_main.c.o ccache gcc -Iexamples/c590b3c@@dpdk-l3fwd-thread@exe -Iexamples -I../../dpdk/examples -Iexamples/performance-thread/l3fwd-thread -I../../dpdk/examples/performance-thread/l3fwd-thread -I../../dpdk/examples/performance-thread/l3fwd-thread/../common -I../../dpdk/examples/performance-thread/l3fwd-thread/../common/arch/x86 -I. -I../../dpdk/ -Iconfig -I../../dpdk/config
-Ilib/librte_eal/include -I../../dpdk/lib/librte_eal/include -Ilib/librte_eal/linux/include
-I../../dpdk/lib/librte_eal/linux/include -Ilib/librte_eal/x86/include -I../../dpdk/lib/librte_eal/x86/include -Ilib/librte_eal/common -I../../dpdk/lib/librte_eal/common -Ilib/librte_eal -I../../dpdk/lib/librte_eal -Ilib/librte_kvargs -I../../dpdk/lib/librte_kvargs
-Ilib/librte_telemetry/../librte_metrics -I../../dpdk/lib/librte_telemetry/../librte_metrics
-Ilib/librte_telemetry -I../../dpdk/lib/librte_telemetry -Ilib/librte_mempool -I../../dpdk/lib/librte_mempool -Ilib/librte_ring -I../../dpdk/lib/librte_ring -Ilib/librte_net
-I../../dpdk/lib/librte_net -Ilib/librte_mbuf
-I../../dpdk/lib/librte_mbuf -Ilib/librte_ethdev -I../../dpdk/lib/librte_ethdev -Ilib/librte_meter -I../../dpdk/lib/librte_meter -Ilib/librte_cmdline -I../../dpdk/lib/librte_cmdline -Ilib/librte_timer -I../../dpdk/lib/librte_timer -Ilib/librte_lpm
-I../../dpdk/lib/librte_lpm -Ilib/librte_hash
-I../../dpdk/lib/librte_hash -Ilib/librte_rcu
-I../../dpdk/lib/librte_rcu -I/home/dmarchan/intel-ipsec-mb/install/include
-fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O2 -g -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat-nonliteral -Wformat-security
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare
-Wstrict-prototypes -Wundef -Wwrite-strings
-Wno-address-of-packed-member -Wno-packed-not-aligned -Wno-missing-field-initializers -D_GNU_SOURCE -march=native -Wno-format-truncation -DALLOW_EXPERIMENTAL_API -MD -MQ 'examples/c590b3c@@dpdk-l3fwd-thread@exe/performance-thread_l3fwd-thread_main.c.o' -MF 'examples/c590b3c@@dpdk-l3fwd-thread@exe/performance-thread_l3fwd-thread_main.c.o.d' -o 'examples/c590b3c@@dpdk-l3fwd-thread@exe/performance-thread_l3fwd-thread_main.c.o' -c ../../dpdk/examples/performance-thread/l3fwd-thread/main.c #‘target_mem_ref’ not supported by expression#’In file included from ../../dpdk/examples/performance-thread/l3fwd-thread/main.c:133:../../dpdk/examples/performance-thread/l3fwd-thread/main.c: In
function ‘process_burst’:../../dpdk/lib/librte_lpm/rte_lpm.h:435:7: error: may be used uninitialized in this function [-Werror=maybe-uninitialized]
435 | if (rte_lpm_lookup(lpm, ((uint32_t *) &ip)[i], &hop[i]) < 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
Signature · 1 line
David Marchand
Re: [dpdk-dev] [PATCH v3 18/18] lpm: choose vector path at runtime
Quoted 64 lines · David Marchand
Quoted 7 lines · Ciara Power
When choosing the vector path, max SIMD bitwidth is now checked to ensure a vector path is allowable. To do this, rather than the vector lookup functions being called directly from apps, a generic lookup function is called which will call the vector functions if suitable.
Signed-off-by Ciara Power <[email protected]>Got a build error on this patch with
./devtools/test-meson-builds.sh("gcc-shared" target):[2/3] Compiling C object '
examples/c590b3c@@dpdk-l3fwd-thread@exe/performance-thread_l3fwd-thread_main.c.o'.
FAILED:examples/c590b3c@@dpdk-l3fwd-thread@exe/performance-thread_l3fwd-thread_main.c.occache gcc -Iexamples/c590b3c@@dpdk-l3fwd-thread@exe -Iexamples(quoted diff) +0
-36-I../../dpdk/examples -Iexamples/performance-thread/l3fwd-thread -I../../dpdk/examples/performance-thread/l3fwd-thread -I../../dpdk/examples/performance-thread/l3fwd-thread/../common -I../../dpdk/examples/performance-thread/l3fwd-thread/../common/arch/x86 -I. -I../../dpdk/ -Iconfig -I../../dpdk/config -Ilib/librte_eal/include -I../../dpdk/lib/librte_eal/include -Ilib/librte_eal/linux/include -I../../dpdk/lib/librte_eal/linux/include -Ilib/librte_eal/x86/include -I../../dpdk/lib/librte_eal/x86/include -Ilib/librte_eal/common -I../../dpdk/lib/librte_eal/common -Ilib/librte_eal -I../../dpdk/lib/librte_eal -Ilib/librte_kvargs -I../../dpdk/lib/librte_kvargs -Ilib/librte_telemetry/../librte_metrics -I../../dpdk/lib/librte_telemetry/../librte_metrics -Ilib/librte_telemetry -I../../dpdk/lib/librte_telemetry -Ilib/librte_mempool -I../../dpdk/lib/librte_mempool -Ilib/librte_ring -I../../dpdk/lib/librte_ring -Ilib/librte_net -I../../dpdk/lib/librte_net -Ilib/librte_mbuf -I../../dpdk/lib/librte_mbuf -Ilib/librte_ethdev -I../../dpdk/lib/librte_ethdev -Ilib/librte_meter -I../../dpdk/lib/librte_meter -Ilib/librte_cmdline -I../../dpdk/lib/librte_cmdline -Ilib/librte_timer -I../../dpdk/lib/librte_timer -Ilib/librte_lpm -I../../dpdk/lib/librte_lpm -Ilib/librte_hash -I../../dpdk/lib/librte_hash -Ilib/librte_rcu -I../../dpdk/lib/librte_rcu -I/home/dmarchan/intel-ipsec-mb/install/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O2 -g -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-packed-not-aligned -Wno-missing-field-initializers -D_GNU_SOURCE -march=native -Wno-format-truncation -DALLOW_EXPERIMENTAL_API -MD -MQ'
examples/c590b3c@@dpdk-l3fwd-thread@exe/performance-thread_l3fwd-thread_main.c.o'(quoted diff) +0
-3-MF 'examples/c590b3c@@dpdk-l3fwd-thread@exe/performance-thread_l3fwd-thread_main.c.o.d' -o 'examples/c590b3c@@dpdk-l3fwd-thread@exe/performance-thread_l3fwd-thread_main.c.o' -c ../../dpdk/examples/performance-thread/l3fwd-thread/main.c#‘target_mem_ref’ not supported by expression#’In file included from
../../dpdk/examples/performance-thread/l3fwd-thread/main.c:133:../../dpdk/examples/performance-thread/l3fwd-thread/main.c: In function ‘process_burst’:../../dpdk/lib/librte_lpm/rte_lpm.h:435:7: error: may be used uninitialized in this function [-Werror=maybe-uninitialized]
435 | if (rte_lpm_lookup(lpm, ((uint32_t *) &ip)[i], &hop[i])< 0)
Quoted 5 lines
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
On the build issue, I guess you can use a rte_xmm_t passe-plat.
lib/librte_lpm/rte_lpm.h +7 -3
@@ -430,10 +430,14 @@ static inline void rte_lpm_lookupx4_scalar(struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4], uint32_t defv) { - int i; -for (i =0 ; i <4 ; i++) -if (rte_lpm_lookup (lpm, ((uint32_t *) &ip)[i], &hop[i]) <0 ) + unsigned int i; +rte_xmm_t _ip; + + _ip.x = ip; +for (i =0 ; i <RTE_DIM (_ip.u32); i++) { +if (rte_lpm_lookup (lpm, _ip.u32[i], &hop[i]) <0 ) hop[i] = defv;/* lookupx4 expected to set on failure */ + } }/**
Signature · 1 line
David Marchand
v4 cover add max SIMD bitwidth to EAL
In reply to Ciara PowerA number of components in DPDK have optional AVX-512 or other vector code paths which can be selected at runtime. Rather than having each component provide its own mechanism to select a code path, this patchset adds support for a single setting to control what code paths are used. This can be used to enable some non-default code paths e.g. ones using AVX-512, but also to limit the code paths to certain vector widths, or to scalar code only, which is useful for testing.
The max SIMD bitwidth setting can be set by the app itself through use of the available API, or can be overriden by a commandline argument passed by the user.
v4:
- Dropped LPM patch as the lookupx4 function is called from SSE/NEON headers, so is already on a vectorised path. Given the performance impact for an unnecessary change, it was decided the check is not needed.
- Renamed enum values for readability.
- Added patch to add check for node library.
- Reworked net patch to choose default handlers rather than scalar by default.
- Updated some Doxygen comments.
- Fixed some other small comments on v3.
v3:
- Added patch to add check for LPM lib
- Modified default max bitwidth for Arm to disable max SIMD bitwidth, which will allow for SVE.
- Added "0" as an acceptable value for command-line flag, which internally is used as UINT16_MAX to essentially disable max SIMD bitwidth limits.
- Made suggested changes to net lib patch.
- Rebased onto main.
v2:
- Added some documentation.
- Modified default max bitwidth for Arm.
- Moved mlx5 condition check into existing check vec support function.
- Added max SIMD bitwidth checks to some libraries.
Ciara Power (17):
eal: add max SIMD bitwidth
doc: add detail on using max SIMD bitwidth
net/i40e: add checks for max SIMD bitwidth
net/axgbe: add checks for max SIMD bitwidth
net/bnxt: add checks for max SIMD bitwidth
net/enic: add checks for max SIMD bitwidth
net/fm10k: add checks for max SIMD bitwidth
net/iavf: add checks for max SIMD bitwidth
net/ice: add checks for max SIMD bitwidth
net/ixgbe: add checks for max SIMD bitwidth
net/mlx5: add checks for max SIMD bitwidth
net/virtio: add checks for max SIMD bitwidth
distributor: add checks for max SIMD bitwidth
member: add checks for max SIMD bitwidth
efd: add checks for max SIMD bitwidth
net: add checks for max SIMD bitwidth
node: choose vector path at runtime
doc/guides/howto/avx512.rst | 36 +++++++++ doc/guides/howto/index.rst | 1 + doc/guides/linux_gsg/eal_args.include.rst | 16 ++++ .../prog_guide/env_abstraction_layer.rst | 32 ++++++++ drivers/net/axgbe/axgbe_rxtx.c | 3 +- drivers/net/bnxt/bnxt_ethdev.c | 6 +- drivers/net/enic/enic_rxtx_vec_avx2.c | 3 +- drivers/net/fm10k/fm10k_ethdev.c | 11 ++- drivers/net/i40e/i40e_rxtx.c | 18 +++-- drivers/net/iavf/iavf_rxtx.c | 16 ++-- drivers/net/ice/ice_rxtx.c | 20 +++-- drivers/net/ixgbe/ixgbe_rxtx.c | 5 +- drivers/net/mlx5/mlx5_rxtx_vec.c | 2 + drivers/net/virtio/virtio_ethdev.c | 9 ++- lib/librte_distributor/rte_distributor.c | 3 +- lib/librte_eal/arm/include/rte_vect.h | 2 + lib/librte_eal/common/eal_common_options.c | 66 ++++++++++++++++ lib/librte_eal/common/eal_internal_cfg.h | 8 ++ lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/include/rte_eal.h | 40 ++++++++++ lib/librte_eal/ppc/include/rte_vect.h | 2 + lib/librte_eal/rte_eal_exports.def | 2 + lib/librte_eal/rte_eal_version.map | 2 + lib/librte_eal/x86/include/rte_vect.h | 2 + lib/librte_efd/rte_efd.c | 7 +- lib/librte_member/rte_member_ht.c | 3 +- lib/librte_net/rte_net_crc.c | 75 ++++++++++++++++--- lib/librte_net/rte_net_crc.h | 8 ++ lib/librte_node/ip4_lookup.c | 13 +++- lib/librte_node/ip4_lookup_neon.h | 2 +- lib/librte_node/ip4_lookup_sse.h | 2 +- 31 files changed, 371 insertions(+), 46 deletions(-) create mode 100644 doc/guides/howto/avx512.rst
Signature · 1 line
2.22.0