Add build option to enable/disable AVX2 support

Message ID 20201026143027.15246-1-felix.moessbauer@siemens.com (mailing list archive)
State Not Applicable, archived
Headers
Series Add build option to enable/disable AVX2 support |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Moessbauer, Felix Oct. 26, 2020, 2:30 p.m. UTC
  This patch introduces a meson option to disable the AVX2 support.
If the build should be for a target without AVX2 support, the
know can be turned to false, even if the compiler supports AVX2.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meson.build       | 3 ++-
 meson_options.txt | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
  

Comments

Bruce Richardson Oct. 27, 2020, 11:47 a.m. UTC | #1
On Mon, Oct 26, 2020 at 03:30:27PM +0100, Felix Moessbauer wrote:
> This patch introduces a meson option to disable the AVX2 support.
> If the build should be for a target without AVX2 support, the
> know can be turned to false, even if the compiler supports AVX2.
> 
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meson.build       | 3 ++-
>  meson_options.txt | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 0ee98be..2e2380c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -18,7 +18,8 @@ pktgen_conf = configuration_data()
>  cc = meson.get_compiler('c')
>  
>  add_project_arguments('-march=native', language: 'c')
> -if cc.has_argument('-mavx2')
> +
> +if get_option('enable-avx2') and cc.has_argument('-mavx2')
>  	add_project_arguments('-mavx2', language: 'c')
>  endif
>  add_project_arguments('-DALLOW_EXPERIMENTAL_API', language: 'c')

Hi,

This code does not appear in the upstream DPDK project [1]. This looks like
a pktgen patch instead, is this the case? If so, please put pktgen
somewhere in the patch title to make it easier to disposition.

Thanks,
/Bruce

[1] http://git.dpdk.org/dpdk/tree/meson.build
  
Wiles, Keith Oct. 29, 2020, 1:36 p.m. UTC | #2
From: Felix Moessbauer <felix.moessbauer@siemens.com>
Date: Monday, October 26, 2020 at 9:31 AM
To: Wiles, Keith <keith.wiles@intel.com>
Cc: dev@dpdk.org <dev@dpdk.org>, henning.schild@siemens.com <henning.schild@siemens.com>, Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH] Add build option to enable/disable AVX2 support
This patch introduces a meson option to disable the AVX2 support.
If the build should be for a target without AVX2 support, the
know can be turned to false, even if the compiler supports AVX2.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meson.build       | 3 ++-
 meson_options.txt | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 0ee98be..2e2380c 100644
--- a/meson.build
+++ b/meson.build
@@ -18,7 +18,8 @@ pktgen_conf = configuration_data()
 cc = meson.get_compiler('c')

 add_project_arguments('-march=native', language: 'c')
-if cc.has_argument('-mavx2')
+
+if get_option('enable-avx2') and cc.has_argument('-mavx2')
         add_project_arguments('-mavx2', language: 'c')
 endif
 add_project_arguments('-DALLOW_EXPERIMENTAL_API', language: 'c')
diff --git a/meson_options.txt b/meson_options.txt
index 7b42577..c419517 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,4 @@
 option('enable_lua', type: 'boolean', value: false, description: 'Enable Lua support')
 option('enable_gui', type: 'boolean', value: false, description: 'build the gui')
 option('enable_docs', type: 'boolean', value: false, description: 'build documentation')
+option('enable-avx2', type: 'boolean', value: true, description: 'compile with AVX2 support')
--
2.20.1

Merged into pktgen-dpdk and new version pushed to repo pktgen-20.10.1, thanks
  

Patch

diff --git a/meson.build b/meson.build
index 0ee98be..2e2380c 100644
--- a/meson.build
+++ b/meson.build
@@ -18,7 +18,8 @@  pktgen_conf = configuration_data()
 cc = meson.get_compiler('c')
 
 add_project_arguments('-march=native', language: 'c')
-if cc.has_argument('-mavx2')
+
+if get_option('enable-avx2') and cc.has_argument('-mavx2')
 	add_project_arguments('-mavx2', language: 'c')
 endif
 add_project_arguments('-DALLOW_EXPERIMENTAL_API', language: 'c')
diff --git a/meson_options.txt b/meson_options.txt
index 7b42577..c419517 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,4 @@ 
 option('enable_lua', type: 'boolean', value: false, description: 'Enable Lua support')
 option('enable_gui', type: 'boolean', value: false, description: 'build the gui')
 option('enable_docs', type: 'boolean', value: false, description: 'build documentation')
+option('enable-avx2', type: 'boolean', value: true, description: 'compile with AVX2 support')