From: Ciara Power <hidden> Date: 2020-08-07 16:06:30
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(-)
--
2.17.1
From: Ciara Power <hidden> Date: 2020-08-07 16:06:39
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 <redacted>
---
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(+)
@@ -1707,6 +1734,13 @@ eal_parse_common_option(int opt, const char *optarg,caseOPT_NO_TELEMETRY_NUM:conf->no_telemetry=1;break;+caseOPT_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)return0;}+uint16_t+rte_get_max_simd_bitwidth(void)+{+conststructinternal_config*internal_conf=+eal_get_internal_configuration();+returninternal_conf->max_simd_bitwidth.bitwidth;+}++int+rte_set_max_simd_bitwidth(uint16_tbitwidth)+{+structinternal_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;+return0;+}+voideal_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"
@@ -33,6 +33,12 @@ struct hugepage_info {intlock_descriptor;/**< file descriptor for hugepage dir */};+structsimd_bitwidth{+/**< flag indicating if bitwidth is locked from further modification */+boollocked;+uint16_tbitwidth;/**< bitwidth value */+};+/***internalconfiguration*/
@@ -85,6 +91,8 @@ struct internal_config {volatileunsignedintinit_complete;/**< indicates whether EAL has completed initialization */unsignedintno_telemetry;/**< true to disable Telemetry */+/** max simd bitwidth path to use */+structsimd_bitwidthmax_simd_bitwidth;};voideal_reset_internal_config(structinternal_config*internal_cfg);
From: Ciara Power <hidden> Date: 2020-08-07 16:06:51
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 <redacted>
Cc: Jerin Jacob <redacted>
Cc: Honnappa Nagarahalli <redacted>
Cc: David Christensen <redacted>
Signed-off-by: Ciara Power <redacted>
---
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(+)
From: Ciara Power <hidden> Date: 2020-08-07 16:07:01
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 <redacted>
Cc: Jeff Guo <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
@@ -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);
From: Ciara Power <hidden> Date: 2020-08-07 16:07:11
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: Somalapuram Amaranath <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/axgbe/axgbe_rxtx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ciara Power <hidden> Date: 2020-08-07 16:07:21
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: Ajit Khaparde <ajit.khaparde@broadcom.com>
Cc: Somnath Kotur <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/bnxt/bnxt_ethdev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
From: Ciara Power <hidden> Date: 2020-08-07 16:07:33
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: John Daley <redacted>
Cc: Hyong Youb Kim <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/enic/enic_rxtx_vec_avx2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ciara Power <hidden> Date: 2020-08-07 16:07:46
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 <redacted>
Cc: Xiao Wang <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/fm10k/fm10k_ethdev.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
@@ -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;}
From: Ciara Power <hidden> Date: 2020-08-07 16:07:56
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: Jingjing Wu <redacted>
Cc: Beilei Xing <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/iavf/iavf_rxtx.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
From: Ciara Power <hidden> Date: 2020-08-07 16:08:10
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 <redacted>
Cc: Qi Zhang <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/ice/ice_rxtx.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
From: Ciara Power <hidden> Date: 2020-08-07 16:08:19
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 <redacted>
Cc: Jeff Guo <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
From: Ciara Power <hidden> Date: 2020-08-07 16:08:33
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 <redacted>
Cc: Shahaf Shuler <redacted>
Cc: Viacheslav Ovsiienko <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/mlx5/mlx5_ethdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ciara Power <hidden> Date: 2020-08-07 16:08:45
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: Maxime Coquelin <redacted>
Cc: Chenbo Xia <redacted>
Cc: Zhihong Wang <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/virtio/virtio_ethdev.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
@@ -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;elseeth_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;
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2020-08-07 16:19:29
On Fri, 7 Aug 2020 16:58:47 +0100
Ciara Power [off-list ref] 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 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(-)
This looks useful, could you add some documentation on rationale
and how you expect application to set it.
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
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;
^~
Sorry, jumped the gun when testing the patch, missed the preceeding patch.
Dave
[AMD Official Use Only - Internal Distribution Only]
++selwin
Please check.
Get Outlook for Android<https://aka.ms/ghei36>
________________________________
From: Ciara Power <redacted>
Sent: Friday, August 7, 2020 9:28:51 PM
To: dev@dpdk.org <redacted>
Cc: bruce.richardson@intel.com <redacted>; Ciara Power <redacted>; Somalapuram, Amaranath <redacted>
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.
Cc: Somalapuram Amaranath <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/axgbe/axgbe_rxtx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Hyong Youb Kim (hyonkim) <hidden> Date: 2020-08-10 04:50:17
quoted hunk
-----Original Message-----
From: Ciara Power <redacted>
Sent: Saturday, August 8, 2020 12:59 AM
To: dev@dpdk.org
Cc: bruce.richardson@intel.com; Ciara Power <redacted>;
John Daley (johndale) [off-list ref]; Hyong Youb Kim (hyonkim)
[off-list ref]
Subject: [PATCH 20.11 06/12] net/enic: add checks for max SIMD bitwidth
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: John Daley <redacted>
Cc: Hyong Youb Kim <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/enic/enic_rxtx_vec_avx2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ruifeng Wang <hidden> Date: 2020-08-10 05:22:31
quoted hunk
-----Original Message-----
From: Ciara Power <redacted>
Sent: Friday, August 7, 2020 11:59 PM
To: dev@dpdk.org
Cc: bruce.richardson@intel.com; Ciara Power <redacted>;
Ruifeng Wang [off-list ref]; jerinj@marvell.com; Honnappa
Nagarahalli [off-list ref]; David Christensen
[off-list ref]
Subject: [PATCH 20.11 02/12] eal: add default SIMD bitwidth values
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 <redacted>
Cc: Jerin Jacob <redacted>
Cc: Honnappa Nagarahalli <redacted>
Cc: David Christensen <redacted>
Signed-off-by: Ciara Power <redacted>
---
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(+)
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
-----Original Message-----
From: Stephen Hemminger <stephen@networkplumber.org>
Sent: Friday 7 August 2020 17:19
To: Power, Ciara <redacted>
Cc: dev@dpdk.org; Richardson, Bruce <redacted>
Subject: Re: [dpdk-dev] [PATCH 20.11 00/12] add max SIMD bitwidth to EAL
On Fri, 7 Aug 2020 16:58:47 +0100
Ciara Power [off-list ref] wrote:
quoted
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
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
From: Alexander Kozyrev <hidden> Date: 2020-08-10 17:27:21
quoted hunk
-----Original Message-----
From: dev <redacted> On Behalf Of Ciara Power
Sent: Friday, August 7, 2020 11:59
To: dev@dpdk.org
Cc: bruce.richardson@intel.com; Ciara Power <redacted>; Matan
Azrad [off-list ref]; Shahaf Shuler [off-list ref];
Viacheslav Ovsiienko [off-list ref]
Subject: [dpdk-dev] [PATCH 20.11 11/12] net/mlx5: add checks for max SIMD
bitwidth
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 <redacted>
Cc: Shahaf Shuler <redacted>
Cc: Viacheslav Ovsiienko <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/mlx5/mlx5_ethdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Hi Ciara,
I have not reviewed other patches in this series yet. Few questions inline.
-----Original Message-----
From: dev <redacted> On Behalf Of Ciara Power
Sent: Friday, August 7, 2020 10:59 AM
To: dev@dpdk.org
Cc: bruce.richardson@intel.com; Ciara Power <redacted>
Subject: [dpdk-dev] [PATCH 20.11 00/12] 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.
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.
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..
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(-)
--
2.17.1
-----Original Message-----
From: David Christensen <redacted>
Sent: Friday 7 August 2020 17:32
To: Power, Ciara <redacted>; dev@dpdk.org
Cc: Richardson, Bruce <redacted>; Ruifeng Wang
[off-list ref]; Jerin Jacob [off-list ref]; Honnappa
Nagarahalli [off-list ref]
Subject: Re: [PATCH 20.11 02/12] eal: add default SIMD bitwidth values
On 8/7/20 8:58 AM, Ciara Power wrote:
quoted
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
-----Original Message-----
From: Honnappa Nagarahalli <redacted>
Sent: Tuesday 11 August 2020 06:37
To: Power, Ciara <redacted>; dev@dpdk.org
Cc: Richardson, Bruce <redacted>; nd <redacted>;
Honnappa Nagarahalli [off-list ref]; nd
[off-list ref]
Subject: RE: [dpdk-dev] [PATCH 20.11 00/12] add max SIMD bitwidth to EAL
Hi Ciara,
I have not reviewed other patches in this series yet. Few questions
inline.
quoted
-----Original Message-----
From: dev <redacted> On Behalf Of Ciara Power
Sent: Friday, August 7, 2020 10:59 AM
To: dev@dpdk.org
Cc: bruce.richardson@intel.com; Ciara Power <redacted>
Subject: [dpdk-dev] [PATCH 20.11 00/12] 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.
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
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..
Do you have any suggestions how this could be handled?
<snip>
Thanks,
Ciara
From: Ciara Power <hidden> Date: 2020-08-27 16:13:19
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.
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
--
2.17.1
From: Ciara Power <hidden> Date: 2020-08-27 16:13:37
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 <redacted>
---
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(+)
@@ -1707,6 +1734,13 @@ eal_parse_common_option(int opt, const char *optarg,caseOPT_NO_TELEMETRY_NUM:conf->no_telemetry=1;break;+caseOPT_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)return0;}+uint16_t+rte_get_max_simd_bitwidth(void)+{+conststructinternal_config*internal_conf=+eal_get_internal_configuration();+returninternal_conf->max_simd_bitwidth.bitwidth;+}++int+rte_set_max_simd_bitwidth(uint16_tbitwidth)+{+structinternal_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;+return0;+}+voideal_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"
@@ -33,6 +33,12 @@ struct hugepage_info {intlock_descriptor;/**< file descriptor for hugepage dir */};+structsimd_bitwidth{+/**< flag indicating if bitwidth is locked from further modification */+boollocked;+uint16_tbitwidth;/**< bitwidth value */+};+/***internalconfiguration*/
@@ -85,6 +91,8 @@ struct internal_config {volatileunsignedintinit_complete;/**< indicates whether EAL has completed initialization */unsignedintno_telemetry;/**< true to disable Telemetry */+/** max simd bitwidth path to use */+structsimd_bitwidthmax_simd_bitwidth;};voideal_reset_internal_config(structinternal_config*internal_cfg);
From: Ciara Power <hidden> Date: 2020-08-27 16:13:44
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 <redacted>
Cc: Jerin Jacob <redacted>
Cc: Honnappa Nagarahalli <redacted>
Cc: David Christensen <redacted>
Signed-off-by: Ciara Power <redacted>
---
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(+)
From: Ciara Power <hidden> Date: 2020-08-27 16:13:54
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 <redacted>
Cc: John McNamara <redacted>
Cc: Marko Kovacevic <redacted>
Signed-off-by: Ciara Power <redacted>
---
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
@@ -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.
@@ -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
@@ -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) ------------------------------------------
From: Ciara Power <hidden> Date: 2020-08-27 16:14:06
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 <redacted>
Cc: Jeff Guo <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
@@ -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);
From: Ciara Power <hidden> Date: 2020-08-27 16:14:16
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: Somalapuram Amaranath <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/axgbe/axgbe_rxtx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ciara Power <hidden> Date: 2020-08-27 16:14:26
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: Ajit Khaparde <ajit.khaparde@broadcom.com>
Cc: Somnath Kotur <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/bnxt/bnxt_ethdev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
From: Ciara Power <hidden> Date: 2020-08-27 16:14:39
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: John Daley <redacted>
Cc: Hyong Youb Kim <redacted>
Acked-by: Hyong Youb Kim <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/enic/enic_rxtx_vec_avx2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ciara Power <hidden> Date: 2020-08-27 16:14:48
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 <redacted>
Cc: Xiao Wang <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/fm10k/fm10k_ethdev.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
@@ -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;}
From: Ciara Power <hidden> Date: 2020-08-27 16:15:04
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: Jingjing Wu <redacted>
Cc: Beilei Xing <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/iavf/iavf_rxtx.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
From: Ciara Power <hidden> Date: 2020-08-27 16:15:15
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 <redacted>
Cc: Qi Zhang <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/ice/ice_rxtx.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
From: Ciara Power <hidden> Date: 2020-08-27 16:15:25
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 <redacted>
Cc: Jeff Guo <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
From: Ciara Power <hidden> Date: 2020-08-27 16:15:37
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 <redacted>
Cc: Shahaf Shuler <redacted>
Cc: Viacheslav Ovsiienko <redacted>
Signed-off-by: Ciara Power <redacted>
---
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(+)
From: Ciara Power <hidden> Date: 2020-08-27 16:15:49
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: Maxime Coquelin <redacted>
Cc: Chenbo Xia <redacted>
Cc: Zhihong Wang <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/virtio/virtio_ethdev.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
@@ -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;elseeth_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;
From: Ciara Power <hidden> Date: 2020-08-27 16:15:59
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 <redacted>
Signed-off-by: Ciara Power <redacted>
---
lib/librte_distributor/rte_distributor.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ciara Power <hidden> Date: 2020-08-27 16:16:14
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: Yipeng Wang <redacted>
Cc: Sameh Gobriel <redacted>
Signed-off-by: Ciara Power <redacted>
---
lib/librte_member/rte_member_ht.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ciara Power <hidden> Date: 2020-08-27 16:16:24
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: Byron Marohn <redacted>
Cc: Yipeng Wang <redacted>
Signed-off-by: Ciara Power <redacted>
---
lib/librte_efd/rte_efd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
From: Ciara Power <hidden> Date: 2020-08-27 16:16:42
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. 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 <redacted>
Signed-off-by: Ciara Power <redacted>
---
lib/librte_net/rte_net_crc.c | 8 ++++++++
1 file changed, 8 insertions(+)
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 hunk
-----Original Message-----
From: Power, Ciara <redacted>
Sent: Friday, August 28, 2020 12:13 AM
To: dev@dpdk.org
Cc: Power, Ciara <redacted>; Maxime Coquelin
[off-list ref]; Xia, Chenbo [off-list ref]; Wang,
Zhihong [off-list ref]
Subject: [PATCH v2 13/17] net/virtio: add checks for max SIMD bitwidth
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: Maxime Coquelin <redacted>
Cc: Chenbo Xia <redacted>
Cc: Zhihong Wang <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/virtio/virtio_ethdev.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c
b/drivers/net/virtio/virtio_ethdev.c
index dc0093bdf0..f779ce8396 100644
@@ -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;elseeth_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;
--
2.17.1
-----Original Message-----
From: Power, Ciara <redacted>
Sent: Thursday, August 27, 2020 5:13 PM
To: dev@dpdk.org
Cc: Power, Ciara <redacted>; Singh, Jasvinder
[off-list ref]; Olivier Matz [off-list ref]
Subject: [PATCH v2 17/17] net: add checks for max SIMD bitwidth
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. 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 <redacted>
Signed-off-by: Ciara Power <redacted>
---
lib/librte_net/rte_net_crc.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/librte_net/rte_net_crc.c b/lib/librte_net/rte_net_crc.c index
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.
f_handle = handlers[type];
ret = f_handle(data, data_len);
--
2.17.1
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 <redacted>
Cc: Jerin Jacob <redacted>
Cc: Honnappa Nagarahalli <redacted>
Cc: David Christensen <redacted>
Signed-off-by: Ciara Power <redacted>
---
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.
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 <redacted>
---
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(+)
@@ -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"
@@ -33,6 +33,12 @@ struct hugepage_info {intlock_descriptor;/**< file descriptor for hugepage dir */};+structsimd_bitwidth{+/**< flag indicating if bitwidth is locked from further modification */+boollocked;+uint16_tbitwidth;/**< bitwidth value */};+/***internalconfiguration*/
@@ -85,6 +91,8 @@ struct internal_config {volatileunsignedintinit_complete;/**< indicates whether EAL has completed initialization */unsignedintno_telemetry;/**< true to disable Telemetry */+/** max simd bitwidth path to use */+structsimd_bitwidthmax_simd_bitwidth;};voideal_reset_internal_config(structinternal_config*internal_cfg);diff--git
a/lib/librte_eal/common/eal_options.h
b/lib/librte_eal/common/eal_options.h
index 89769d48b4..ef33979664 100644
We could add a RTE_MAX_SIMD = 0. Arm platforms can use this to choose SVE.
quoted hunk
+ 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. *
diff --git a/lib/librte_eal/rte_eal_version.map
b/lib/librte_eal/rte_eal_version.map
index bf0c17c233..8059ea76b6 100644
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?
From: Ananyev, Konstantin <hidden> Date: 2020-09-06 22:01:55
quoted hunk
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 <redacted>
---
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(+)
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);
+
+ /* 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;
+}
+
From: Ananyev, Konstantin <hidden> Date: 2020-09-06 22:20:40
quoted hunk
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 <redacted>
Cc: John McNamara <redacted>
Cc: Marko Kovacevic <redacted>
Signed-off-by: Ciara Power <redacted>
---
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
@@ -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).
+
+
+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.
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 hunk
+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.
@@ -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
@@ -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) --------------------------------------------
From: Bruce Richardson <hidden> Date: 2020-09-07 08:44:38
On Sun, Sep 06, 2020 at 10:20:30PM +0000, Ananyev, Konstantin wrote:
quoted
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 <redacted>
Cc: John McNamara <redacted>
Cc: Marko Kovacevic <redacted>
Signed-off-by: Ciara Power <redacted>
---
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
@@ -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).
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
+
+
+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.
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
From: Ananyev, Konstantin <hidden> Date: 2020-09-07 12:01:54
On Sun, Sep 06, 2020 at 10:20:30PM +0000, Ananyev, Konstantin wrote:
quoted
quoted
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 <redacted>
Cc: John McNamara <redacted>
Cc: Marko Kovacevic <redacted>
Signed-off-by: Ciara Power <redacted>
---
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
@@ -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).
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.
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.
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.
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
quoted
+
+
+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.
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.
Unfortunately, I don't think programmer also has all information to make such decisions.
A lot depends on deployment scenarios, see above.
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.
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
We could add a RTE_MAX_SIMD = 0. Arm platforms can use this to choose
SVE.
quoted
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?
I suggested zero as the bitwidth can be specified from the command line. It would be much easier to input zero vs other number.
We could add a RTE_MAX_SIMD = 0. Arm platforms can use this to choose
SVE.
quoted
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?
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?
We could add a RTE_MAX_SIMD = 0. Arm platforms can use this to choose
SVE.
quoted
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?
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.
We could add a RTE_MAX_SIMD = 0. Arm platforms can use this to
choose
SVE.
quoted
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?
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).
We could add a RTE_MAX_SIMD = 0. Arm platforms can use this to
choose
SVE.
quoted
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?
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).
Make sense. That all is perfectly doable because the initial default value
is set per architecture.
From: Ciara Power <hidden> Date: 2020-09-30 13:08:08
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.
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
--
2.17.1
From: Ciara Power <hidden> Date: 2020-09-30 13:08:27
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 <redacted>
---
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(+)
@@ -1707,6 +1736,13 @@ eal_parse_common_option(int opt, const char *optarg,caseOPT_NO_TELEMETRY_NUM:conf->no_telemetry=1;break;+caseOPT_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)return0;}+uint16_t+rte_get_max_simd_bitwidth(void)+{+conststructinternal_config*internal_conf=+eal_get_internal_configuration();+returninternal_conf->max_simd_bitwidth.bitwidth;+}++int+rte_set_max_simd_bitwidth(uint16_tbitwidth)+{+structinternal_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;+return0;+}+voideal_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"
@@ -33,6 +33,12 @@ struct hugepage_info {intlock_descriptor;/**< file descriptor for hugepage dir */};+structsimd_bitwidth{+/**< flag indicating if bitwidth is locked from further modification */+boollocked;+uint16_tbitwidth;/**< bitwidth value */+};+/***internalconfiguration*/
@@ -85,6 +91,8 @@ struct internal_config {volatileunsignedintinit_complete;/**< indicates whether EAL has completed initialization */unsignedintno_telemetry;/**< true to disable Telemetry */+/** max simd bitwidth path to use */+structsimd_bitwidthmax_simd_bitwidth;};voideal_reset_internal_config(structinternal_config*internal_cfg);
From: Ciara Power <hidden> Date: 2020-09-30 13:08:45
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 <redacted>
Cc: Jerin Jacob <redacted>
Cc: Honnappa Nagarahalli <redacted>
Cc: David Christensen <redacted>
Signed-off-by: Ciara Power <redacted>
---
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(+)
From: Ciara Power <hidden> Date: 2020-09-30 13:09:10
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 <redacted>
Cc: John McNamara <redacted>
Cc: Marko Kovacevic <redacted>
Signed-off-by: Ciara Power <redacted>
---
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
@@ -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.
@@ -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
@@ -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) ------------------------------------------
From: Ciara Power <hidden> Date: 2020-09-30 13:09:30
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 <redacted>
Cc: Jeff Guo <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/i40e/i40e_rxtx.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
@@ -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);
From: Ciara Power <hidden> Date: 2020-09-30 13:09:46
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: Somalapuram Amaranath <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/axgbe/axgbe_rxtx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ciara Power <hidden> Date: 2020-09-30 13:10:13
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: Ajit Khaparde <ajit.khaparde@broadcom.com>
Cc: Somnath Kotur <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/bnxt/bnxt_ethdev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
From: Ciara Power <hidden> Date: 2020-09-30 13:10:29
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: John Daley <redacted>
Cc: Hyong Youb Kim <redacted>
Acked-by: Hyong Youb Kim <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/enic/enic_rxtx_vec_avx2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ciara Power <hidden> Date: 2020-09-30 13:10:54
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: Jingjing Wu <redacted>
Cc: Beilei Xing <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/iavf/iavf_rxtx.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
From: Ciara Power <hidden> Date: 2020-09-30 13:11:12
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 <redacted>
Cc: Xiao Wang <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/fm10k/fm10k_ethdev.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
@@ -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;}
From: Ciara Power <hidden> Date: 2020-09-30 13:11:33
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 <redacted>
Cc: Qi Zhang <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/ice/ice_rxtx.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
From: Ciara Power <hidden> Date: 2020-09-30 13:11:48
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 <redacted>
Cc: Jeff Guo <redacted>
Signed-off-by: Ciara Power <redacted>
---
drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
From: Ciara Power <hidden> Date: 2020-09-30 13:12:13
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 <redacted>
Cc: Shahaf Shuler <redacted>
Cc: Viacheslav Ovsiienko <redacted>
Signed-off-by: Ciara Power <redacted>
---
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(+)
From: Ciara Power <hidden> Date: 2020-09-30 13:12:37
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: Maxime Coquelin <redacted>
Cc: Chenbo Xia <redacted>
Cc: Zhihong Wang <redacted>
Signed-off-by: Ciara Power <redacted>
---
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(-)
@@ -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;+}}}
From: Ciara Power <hidden> Date: 2020-09-30 13:12:58
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 <redacted>
Signed-off-by: Ciara Power <redacted>
---
lib/librte_distributor/rte_distributor.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ciara Power <hidden> Date: 2020-09-30 13:13:19
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: Yipeng Wang <redacted>
Cc: Sameh Gobriel <redacted>
Signed-off-by: Ciara Power <redacted>
---
lib/librte_member/rte_member_ht.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Ciara Power <hidden> Date: 2020-09-30 13:13:35
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: Byron Marohn <redacted>
Cc: Yipeng Wang <redacted>
Signed-off-by: Ciara Power <redacted>
---
lib/librte_efd/rte_efd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
From: Ciara Power <hidden> Date: 2020-09-30 13:13:57
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 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.
Suggested-by: Jasvinder Singh <redacted>
Signed-off-by: Ciara Power <redacted>
---
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(-)
@@ -145,18 +149,26 @@ rte_crc32_eth_handler(const uint8_t *data, uint32_t data_len)voidrte_net_crc_set_alg(enumrte_net_crc_algalg){+if(max_simd_bitwidth==0)+max_simd_bitwidth=rte_get_max_simd_bitwidth();+switch(alg){#ifdef X86_64_SSE42_PCLMULQDQcaseRTE_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 defined ARM64_NEON_PMULL/* fall-through */caseRTE_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 */caseRTE_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){-enumrte_net_crc_algalg=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 defined ARM64_NEON_PMULLif(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);}
From: Ciara Power <hidden> Date: 2020-09-30 13:14:20
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 <redacted>
---
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(-)