[20.11,02/12] eal: add default SIMD bitwidth values

Message ID 20200807155859.63888-3-ciara.power@intel.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series add max SIMD bitwidth to EAL |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Power, Ciara Aug. 7, 2020, 3:58 p.m. UTC
  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 <ruifeng.wang@arm.com>
Cc: Jerin Jacob <jerinj@marvell.com>
Cc: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Cc: David Christensen <drc@linux.vnet.ibm.com>

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 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(+)
  

Comments

David Christensen Aug. 7, 2020, 4:31 p.m. UTC | #1
On 8/7/20 8:58 AM, Ciara Power wrote:
> 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?

> 
> Cc: Ruifeng Wang <ruifeng.wang@arm.com>
> Cc: Jerin Jacob <jerinj@marvell.com>
> Cc: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Cc: David Christensen <drc@linux.vnet.ibm.com>
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
>   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(+)
> 
> diff --git a/lib/librte_eal/arm/include/rte_vect.h b/lib/librte_eal/arm/include/rte_vect.h
> index 01c51712a1..7487a53862 100644
> --- a/lib/librte_eal/arm/include/rte_vect.h
> +++ b/lib/librte_eal/arm/include/rte_vect.h
> @@ -14,6 +14,8 @@
>   extern "C" {
>   #endif
> 
> +#define RTE_DEFAULT_SIMD_BITWIDTH 256
> +
>   typedef int32x4_t xmm_t;
> 
>   #define	XMM_SIZE	(sizeof(xmm_t))
> diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
> index 90f4e8f5c3..c2a9624f89 100644
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> @@ -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;
>   }

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
  
David Christensen Aug. 7, 2020, 4:59 p.m. UTC | #2
On 8/7/20 9:31 AM, David Christensen wrote:
> On 8/7/20 8:58 AM, Ciara Power wrote:
>> 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?
> 
>>
>> Cc: Ruifeng Wang <ruifeng.wang@arm.com>
>> Cc: Jerin Jacob <jerinj@marvell.com>
>> Cc: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
>> Cc: David Christensen <drc@linux.vnet.ibm.com>
>>
>> Signed-off-by: Ciara Power <ciara.power@intel.com>
>> ---
>>   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(+)
>>
>> diff --git a/lib/librte_eal/arm/include/rte_vect.h 
>> b/lib/librte_eal/arm/include/rte_vect.h
>> index 01c51712a1..7487a53862 100644
>> --- a/lib/librte_eal/arm/include/rte_vect.h
>> +++ b/lib/librte_eal/arm/include/rte_vect.h
>> @@ -14,6 +14,8 @@
>>   extern "C" {
>>   #endif
>>
>> +#define RTE_DEFAULT_SIMD_BITWIDTH 256
>> +
>>   typedef int32x4_t xmm_t;
>>
>>   #define    XMM_SIZE    (sizeof(xmm_t))
>> diff --git a/lib/librte_eal/common/eal_common_options.c 
>> b/lib/librte_eal/common/eal_common_options.c
>> index 90f4e8f5c3..c2a9624f89 100644
>> --- a/lib/librte_eal/common/eal_common_options.c
>> +++ b/lib/librte_eal/common/eal_common_options.c
>> @@ -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;
>>   }
> 
> 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
  
Ruifeng Wang Aug. 10, 2020, 5:22 a.m. UTC | #3
> -----Original Message-----
> From: Ciara Power <ciara.power@intel.com>
> Sent: Friday, August 7, 2020 11:59 PM
> To: dev@dpdk.org
> Cc: bruce.richardson@intel.com; Ciara Power <ciara.power@intel.com>;
> Ruifeng Wang <Ruifeng.Wang@arm.com>; jerinj@marvell.com; Honnappa
> Nagarahalli <Honnappa.Nagarahalli@arm.com>; David Christensen
> <drc@linux.vnet.ibm.com>
> 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 <ruifeng.wang@arm.com>
> Cc: Jerin Jacob <jerinj@marvell.com>
> Cc: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Cc: David Christensen <drc@linux.vnet.ibm.com>
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
>  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(+)
> 
> diff --git a/lib/librte_eal/arm/include/rte_vect.h
> b/lib/librte_eal/arm/include/rte_vect.h
> index 01c51712a1..7487a53862 100644
> --- a/lib/librte_eal/arm/include/rte_vect.h
> +++ b/lib/librte_eal/arm/include/rte_vect.h
> @@ -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.

> +
>  typedef int32x4_t xmm_t;
> 
>  #define	XMM_SIZE	(sizeof(xmm_t))
> diff --git a/lib/librte_eal/common/eal_common_options.c
> b/lib/librte_eal/common/eal_common_options.c
> index 90f4e8f5c3..c2a9624f89 100644
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> @@ -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
> diff --git a/lib/librte_eal/include/generic/rte_vect.h
> b/lib/librte_eal/include/generic/rte_vect.h
> index 3fc47979f8..e98f184a97 100644
> --- a/lib/librte_eal/include/generic/rte_vect.h
> +++ b/lib/librte_eal/include/generic/rte_vect.h
> @@ -14,6 +14,8 @@
> 
>  #include <stdint.h>
> 
> +#define RTE_DEFAULT_SIMD_BITWIDTH 256
> +
>  /* Unsigned vector types */
> 
>  /**
> diff --git a/lib/librte_eal/ppc/include/rte_vect.h
> b/lib/librte_eal/ppc/include/rte_vect.h
> index b0545c878c..70fbd0c423 100644
> --- a/lib/librte_eal/ppc/include/rte_vect.h
> +++ b/lib/librte_eal/ppc/include/rte_vect.h
> @@ -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))
> diff --git a/lib/librte_eal/x86/include/rte_vect.h
> b/lib/librte_eal/x86/include/rte_vect.h
> index df5a607623..b1df75aca7 100644
> --- a/lib/librte_eal/x86/include/rte_vect.h
> +++ b/lib/librte_eal/x86/include/rte_vect.h
> @@ -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
  
Power, Ciara Aug. 12, 2020, 11:28 a.m. UTC | #4
Hi David,


>-----Original Message-----
>From: David Christensen <drc@linux.vnet.ibm.com>
>Sent: Friday 7 August 2020 17:32
>To: Power, Ciara <ciara.power@intel.com>; dev@dpdk.org
>Cc: Richardson, Bruce <bruce.richardson@intel.com>; Ruifeng Wang
><ruifeng.wang@arm.com>; Jerin Jacob <jerinj@marvell.com>; Honnappa
>Nagarahalli <honnappa.nagarahalli@arm.com>
>Subject: Re: [PATCH 20.11 02/12] eal: add default SIMD bitwidth values
>
>On 8/7/20 8:58 AM, Ciara Power wrote:
>> 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
  

Patch

diff --git a/lib/librte_eal/arm/include/rte_vect.h b/lib/librte_eal/arm/include/rte_vect.h
index 01c51712a1..7487a53862 100644
--- a/lib/librte_eal/arm/include/rte_vect.h
+++ b/lib/librte_eal/arm/include/rte_vect.h
@@ -14,6 +14,8 @@ 
 extern "C" {
 #endif
 
+#define RTE_DEFAULT_SIMD_BITWIDTH 256
+
 typedef int32x4_t xmm_t;
 
 #define	XMM_SIZE	(sizeof(xmm_t))
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 90f4e8f5c3..c2a9624f89 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -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
diff --git a/lib/librte_eal/include/generic/rte_vect.h b/lib/librte_eal/include/generic/rte_vect.h
index 3fc47979f8..e98f184a97 100644
--- a/lib/librte_eal/include/generic/rte_vect.h
+++ b/lib/librte_eal/include/generic/rte_vect.h
@@ -14,6 +14,8 @@ 
 
 #include <stdint.h>
 
+#define RTE_DEFAULT_SIMD_BITWIDTH 256
+
 /* Unsigned vector types */
 
 /**
diff --git a/lib/librte_eal/ppc/include/rte_vect.h b/lib/librte_eal/ppc/include/rte_vect.h
index b0545c878c..70fbd0c423 100644
--- a/lib/librte_eal/ppc/include/rte_vect.h
+++ b/lib/librte_eal/ppc/include/rte_vect.h
@@ -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))
diff --git a/lib/librte_eal/x86/include/rte_vect.h b/lib/librte_eal/x86/include/rte_vect.h
index df5a607623..b1df75aca7 100644
--- a/lib/librte_eal/x86/include/rte_vect.h
+++ b/lib/librte_eal/x86/include/rte_vect.h
@@ -35,6 +35,8 @@ 
 extern "C" {
 #endif
 
+#define RTE_DEFAULT_SIMD_BITWIDTH 256
+
 typedef __m128i xmm_t;
 
 #define	XMM_SIZE	(sizeof(xmm_t))