DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug
@ 2021-07-17 17:08 Liang Ma
  2021-07-17 17:48 ` Stephen Hemminger
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Liang Ma @ 2021-07-17 17:08 UTC (permalink / raw)
  To: dev; +Cc: yi.rong, Liang Ma, stable, Bruce Richardson, Konstantin Ananyev

From: Liang Ma <liangma@bytedance.com>

GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887

Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
which casue building failure with debug buildtype.

Therefore, it's helpful to disable avx512 for GCC 6.3.0

Bugzilla ID: 717
Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
Cc: stable@dpdk.org

Reported-by: Liang Ma <liangma@liangbit.com>
Signed-off-by: Liang Ma <liangma@bytedance.com>
---
 buildtools/binutils-avx512-check.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/buildtools/binutils-avx512-check.sh b/buildtools/binutils-avx512-check.sh
index 2a833b64b7..b86d0b179e 100755
--- a/buildtools/binutils-avx512-check.sh
+++ b/buildtools/binutils-avx512-check.sh
@@ -5,6 +5,13 @@
 AS=${AS:-as}
 OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX)
 trap 'rm -f "$OBJFILE"' EXIT
+
+# from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
+GCC_VER=6.3.0
+gcc --version|grep $GCC_VER && {
+    echo "GCC 6.3.0 is broken with  _mm512_extracti64x4_epi64"
+    exit 1
+}
 # from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
 GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}'
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug
  2021-07-17 17:08 [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug Liang Ma
@ 2021-07-17 17:48 ` Stephen Hemminger
  2021-07-17 22:13   ` Liang Ma
  2021-07-19 22:34 ` [dpdk-dev] [PATCH v2] build: check AVX512 rather than compiler version Liang Ma
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 15+ messages in thread
From: Stephen Hemminger @ 2021-07-17 17:48 UTC (permalink / raw)
  To: Liang Ma
  Cc: dev, yi.rong, Liang Ma, stable, Bruce Richardson, Konstantin Ananyev

On Sat, 17 Jul 2021 18:08:30 +0100
Liang Ma <liangma@liangbit.com> wrote:

> From: Liang Ma <liangma@bytedance.com>
> 
> GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
> Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> 
> Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
> which casue building failure with debug buildtype.
> 
> Therefore, it's helpful to disable avx512 for GCC 6.3.0
> 
> Bugzilla ID: 717
> Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
> Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
> Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
> Cc: stable@dpdk.org
> 
> Reported-by: Liang Ma <liangma@liangbit.com>
> Signed-off-by: Liang Ma <liangma@bytedance.com>

What distro still has GCC 6.3.0?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug
  2021-07-17 17:48 ` Stephen Hemminger
@ 2021-07-17 22:13   ` Liang Ma
  2021-07-18  1:08     ` Stephen Hemminger
  0 siblings, 1 reply; 15+ messages in thread
From: Liang Ma @ 2021-07-17 22:13 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: dev, yi.rong, Liang Ma, stable, Bruce Richardson, Konstantin Ananyev

On Sat, Jul 17, 2021 at 10:48:49AM -0700, Stephen Hemminger wrote:
> On Sat, 17 Jul 2021 18:08:30 +0100
> Liang Ma <liangma@liangbit.com> wrote:
> 
> > From: Liang Ma <liangma@bytedance.com>
> > 
> > GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
> > Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> > 
> > Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
> > which casue building failure with debug buildtype.
> > 
> > Therefore, it's helpful to disable avx512 for GCC 6.3.0
> > 
> > Bugzilla ID: 717
> > Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
> > Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
> > Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
> > Cc: stable@dpdk.org
> > 
> > Reported-by: Liang Ma <liangma@liangbit.com>
> > Signed-off-by: Liang Ma <liangma@bytedance.com>
> 
> What distro still has GCC 6.3.0?
For example  Debian 9.x

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug
  2021-07-17 22:13   ` Liang Ma
@ 2021-07-18  1:08     ` Stephen Hemminger
  2021-07-18  9:33       ` Liang Ma
  0 siblings, 1 reply; 15+ messages in thread
From: Stephen Hemminger @ 2021-07-18  1:08 UTC (permalink / raw)
  To: Liang Ma
  Cc: dev, yi.rong, Liang Ma, stable, Bruce Richardson, Konstantin Ananyev

On Sat, 17 Jul 2021 23:13:04 +0100
Liang Ma <liangma@liangbit.com> wrote:

> On Sat, Jul 17, 2021 at 10:48:49AM -0700, Stephen Hemminger wrote:
> > On Sat, 17 Jul 2021 18:08:30 +0100
> > Liang Ma <liangma@liangbit.com> wrote:
> >   
> > > From: Liang Ma <liangma@bytedance.com>
> > > 
> > > GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
> > > Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> > > 
> > > Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
> > > which casue building failure with debug buildtype.
> > > 
> > > Therefore, it's helpful to disable avx512 for GCC 6.3.0
> > > 
> > > Bugzilla ID: 717
> > > Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
> > > Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
> > > Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
> > > Cc: stable@dpdk.org
> > > 
> > > Reported-by: Liang Ma <liangma@liangbit.com>
> > > Signed-off-by: Liang Ma <liangma@bytedance.com>  
> > 
> > What distro still has GCC 6.3.0?  
> For example  Debian 9.x

Ok, thanks. Is there a bug fix in Debian LTS yet?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug
  2021-07-18  1:08     ` Stephen Hemminger
@ 2021-07-18  9:33       ` Liang Ma
  2021-07-19  8:38         ` Bruce Richardson
  0 siblings, 1 reply; 15+ messages in thread
From: Liang Ma @ 2021-07-18  9:33 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: dev, leyi.rong, Liang Ma, stable, Bruce Richardson, Konstantin Ananyev

On Sat, Jul 17, 2021 at 06:08:04PM -0700, Stephen Hemminger wrote:
> On Sat, 17 Jul 2021 23:13:04 +0100
> Liang Ma <liangma@liangbit.com> wrote:
> 
> > On Sat, Jul 17, 2021 at 10:48:49AM -0700, Stephen Hemminger wrote:
> > > On Sat, 17 Jul 2021 18:08:30 +0100
> > > Liang Ma <liangma@liangbit.com> wrote:
> > >   
> > > > From: Liang Ma <liangma@bytedance.com>
> > > > 
> > > > GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
> > > > Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> > > > 
> > > > Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
> > > > which casue building failure with debug buildtype.
> > > > 
> > > > Therefore, it's helpful to disable avx512 for GCC 6.3.0
> > > > 
> > > > Bugzilla ID: 717
> > > > Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
> > > > Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
> > > > Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
> > > > Cc: stable@dpdk.org
> > > > 
> > > > Reported-by: Liang Ma <liangma@liangbit.com>
> > > > Signed-off-by: Liang Ma <liangma@bytedance.com>  
> > > 
> > > What distro still has GCC 6.3.0?  
> > For example  Debian 9.x
> 
> Ok, thanks. Is there a bug fix in Debian LTS yet?
I look into  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887, and
find gcc community has no plan to backport fix. Hence, I don't think
Debian LTS will have any fix for this. That's why I send out this patch.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug
  2021-07-18  9:33       ` Liang Ma
@ 2021-07-19  8:38         ` Bruce Richardson
  2021-07-19 10:04           ` Liang Ma
  0 siblings, 1 reply; 15+ messages in thread
From: Bruce Richardson @ 2021-07-19  8:38 UTC (permalink / raw)
  To: Liang Ma
  Cc: Stephen Hemminger, dev, leyi.rong, Liang Ma, stable, Konstantin Ananyev

On Sun, Jul 18, 2021 at 10:33:15AM +0100, Liang Ma wrote:
> On Sat, Jul 17, 2021 at 06:08:04PM -0700, Stephen Hemminger wrote:
> > On Sat, 17 Jul 2021 23:13:04 +0100
> > Liang Ma <liangma@liangbit.com> wrote:
> > 
> > > On Sat, Jul 17, 2021 at 10:48:49AM -0700, Stephen Hemminger wrote:
> > > > On Sat, 17 Jul 2021 18:08:30 +0100
> > > > Liang Ma <liangma@liangbit.com> wrote:
> > > >   
> > > > > From: Liang Ma <liangma@bytedance.com>
> > > > > 
> > > > > GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
> > > > > Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> > > > > 
> > > > > Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
> > > > > which casue building failure with debug buildtype.
> > > > > 
> > > > > Therefore, it's helpful to disable avx512 for GCC 6.3.0
> > > > > 
> > > > > Bugzilla ID: 717
> > > > > Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
> > > > > Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
> > > > > Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
> > > > > Cc: stable@dpdk.org
> > > > > 
> > > > > Reported-by: Liang Ma <liangma@liangbit.com>
> > > > > Signed-off-by: Liang Ma <liangma@bytedance.com>  
> > > > 
> > > > What distro still has GCC 6.3.0?  
> > > For example  Debian 9.x
> > 
> > Ok, thanks. Is there a bug fix in Debian LTS yet?
> I look into  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887, and
> find gcc community has no plan to backport fix. Hence, I don't think
> Debian LTS will have any fix for this. That's why I send out this patch.
>
Thanks for the report. However, rather than just disabling based on version
number, can we instead use a compile-time check for broken compiler. This
is what we did previously for other similar issues and it works better
because:
* removes the possibility of us missing a broken compiler version
* takes account of the possibility of a fix backport (even if we don't
  expect one, it's best not to count it out)

Looking at the bug report, it seems this issue could be detected directly
in meson using "cc.compiles" and the code snippet from the report.

Regards,
/Bruce

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug
  2021-07-19  8:38         ` Bruce Richardson
@ 2021-07-19 10:04           ` Liang Ma
  0 siblings, 0 replies; 15+ messages in thread
From: Liang Ma @ 2021-07-19 10:04 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Stephen Hemminger, dev, leyi.rong, Liang Ma, stable, Konstantin Ananyev

On Mon, Jul 19, 2021 at 09:38:14AM +0100, Bruce Richardson wrote:
> On Sun, Jul 18, 2021 at 10:33:15AM +0100, Liang Ma wrote:
> > On Sat, Jul 17, 2021 at 06:08:04PM -0700, Stephen Hemminger wrote:
> > > On Sat, 17 Jul 2021 23:13:04 +0100
> > > Liang Ma <liangma@liangbit.com> wrote:
> > > 
> > > > On Sat, Jul 17, 2021 at 10:48:49AM -0700, Stephen Hemminger wrote:
> > > > > On Sat, 17 Jul 2021 18:08:30 +0100
> > > > > Liang Ma <liangma@liangbit.com> wrote:
> > > > >   
> > > > > > From: Liang Ma <liangma@bytedance.com>
> > > > > > 
> > > > > > GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
> > > > > > Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> > > > > > 
> > > > > > Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
> > > > > > which casue building failure with debug buildtype.
> > > > > > 
> > > > > > Therefore, it's helpful to disable avx512 for GCC 6.3.0
> > > > > > 
> > > > > > Bugzilla ID: 717
> > > > > > Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
> > > > > > Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
> > > > > > Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
> > > > > > Cc: stable@dpdk.org
> > > > > > 
> > > > > > Reported-by: Liang Ma <liangma@liangbit.com>
> > > > > > Signed-off-by: Liang Ma <liangma@bytedance.com>  
> > > > > 
> > > > > What distro still has GCC 6.3.0?  
> > > > For example  Debian 9.x
> > > 
> > > Ok, thanks. Is there a bug fix in Debian LTS yet?
> > I look into  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887, and
> > find gcc community has no plan to backport fix. Hence, I don't think
> > Debian LTS will have any fix for this. That's why I send out this patch.
> >
> Thanks for the report. However, rather than just disabling based on version
> number, can we instead use a compile-time check for broken compiler. This
> is what we did previously for other similar issues and it works better
> because:
> * removes the possibility of us missing a broken compiler version
> * takes account of the possibility of a fix backport (even if we don't
>   expect one, it's best not to count it out)
> 
> Looking at the bug report, it seems this issue could be detected directly
> in meson using "cc.compiles" and the code snippet from the report.
> 
> Regards,
> /Bruce
Many thanks for the suggestion. I will rework the patch with the
suggested solution.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [dpdk-dev] [PATCH v2] build: check AVX512 rather than compiler version
  2021-07-17 17:08 [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug Liang Ma
  2021-07-17 17:48 ` Stephen Hemminger
@ 2021-07-19 22:34 ` Liang Ma
  2021-07-20 10:19   ` Bruce Richardson
  2021-07-20 11:20 ` [dpdk-dev] [PATCH v3] " Liang Ma
  2021-07-20 13:36 ` [dpdk-dev] [PATCH v4] build: check for broken AVX-512 compiler support Liang Ma
  3 siblings, 1 reply; 15+ messages in thread
From: Liang Ma @ 2021-07-19 22:34 UTC (permalink / raw)
  To: dev; +Cc: leyi.rong, Liang Ma, stable, Bruce Richardson, Konstantin Ananyev

From: Liang Ma <liangma@bytedance.com>

GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887

Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
which cause building failure with debug buildtype.

Therefore, it's helpful to check if compiler work with
_mm512_extracti64x4_epi6.

This patch check the compiler compile result against the test code
snippet. If the checking is failed then disable avx512.

Bugzilla ID: 717
Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
Cc: stable@dpdk.org

Reported-by: Liang Ma <liangma@liangbit.com>
Signed-off-by: Liang Ma <liangma@bytedance.com>
---
 config/x86/meson.build | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/config/x86/meson.build b/config/x86/meson.build
index b9348c44de..77370a91f7 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -10,6 +10,19 @@ if not is_windows
     endif
 endif
 
+#check if compiler is working with _mm512_extracti64x4_epi64
+#Ref https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
+if not is_windows
+    code = '''#include <immintrin.h>
+    void test(__m512i zmm){
+        __m256i ymm = _mm512_extracti64x4_epi64(zmm, 0);}'''
+    result = cc.compiles(code, args : '-mavx512f', name : 'avx512 checking')
+    if result == false and cc.has_argument('-mno-avx512f')
+        machine_args += '-mno-avx512f'
+        warning('Broken _mm512_extracti64x4_epi64, disabling AVX512 support')
+    endif
+endif
+
 # we require SSE4.2 for DPDK
 if cc.get_define('__SSE4_2__', args: machine_args) == ''
     message('SSE 4.2 not enabled by default, explicitly enabling')
-- 
2.17.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH v2] build: check AVX512 rather than compiler version
  2021-07-19 22:34 ` [dpdk-dev] [PATCH v2] build: check AVX512 rather than compiler version Liang Ma
@ 2021-07-20 10:19   ` Bruce Richardson
  2021-07-20 11:24     ` Liang Ma
  0 siblings, 1 reply; 15+ messages in thread
From: Bruce Richardson @ 2021-07-20 10:19 UTC (permalink / raw)
  To: Liang Ma; +Cc: dev, leyi.rong, Liang Ma, stable, Konstantin Ananyev

On Mon, Jul 19, 2021 at 11:34:33PM +0100, Liang Ma wrote:
> From: Liang Ma <liangma@bytedance.com>
> 
> GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
> Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> 
> Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
> which cause building failure with debug buildtype.
> 
> Therefore, it's helpful to check if compiler work with
> _mm512_extracti64x4_epi6.
> 
> This patch check the compiler compile result against the test code
> snippet. If the checking is failed then disable avx512.
> 
> Bugzilla ID: 717
> Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
> Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
> Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
> Cc: stable@dpdk.org
> 
> Reported-by: Liang Ma <liangma@liangbit.com>
> Signed-off-by: Liang Ma <liangma@bytedance.com>
> ---

Looks generally ok, but some comments below.

>  config/x86/meson.build | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/config/x86/meson.build b/config/x86/meson.build
> index b9348c44de..77370a91f7 100644
> --- a/config/x86/meson.build
> +++ b/config/x86/meson.build
> @@ -10,6 +10,19 @@ if not is_windows
>      endif
>  endif
>  
> +#check if compiler is working with _mm512_extracti64x4_epi64
> +#Ref https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> +if not is_windows

Don't think this is needed here. The reason for it in the previous check
for avx512 is because that check is done by a shell script which won't work
on windows. Since we use meson functions for this check, it will work
anywhere.

> +    code = '''#include <immintrin.h>
> +    void test(__m512i zmm){
> +        __m256i ymm = _mm512_extracti64x4_epi64(zmm, 0);}'''
> +    result = cc.compiles(code, args : '-mavx512f', name : 'avx512 checking')
> +    if result == false and cc.has_argument('-mno-avx512f')

Rather than checking for -mno-avx512f here, the whole block should probably
be in an avx512 block itself. If the compiler doesn't have the "-mavx512f"
flag, there may be problems with the "cc.compiles" command (or maybe it
just counts as an error case?).

I'd suggest changing the "is_windows" condition to a cc.has_argument() one
for avx512.

> +        machine_args += '-mno-avx512f'
> +        warning('Broken _mm512_extracti64x4_epi64, disabling AVX512 support')
> +    endif
> +endif
> +
>  # we require SSE4.2 for DPDK
>  if cc.get_define('__SSE4_2__', args: machine_args) == ''
>      message('SSE 4.2 not enabled by default, explicitly enabling')
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [dpdk-dev] [PATCH v3] build: check AVX512 rather than compiler version
  2021-07-17 17:08 [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug Liang Ma
  2021-07-17 17:48 ` Stephen Hemminger
  2021-07-19 22:34 ` [dpdk-dev] [PATCH v2] build: check AVX512 rather than compiler version Liang Ma
@ 2021-07-20 11:20 ` Liang Ma
  2021-07-20 11:58   ` Bruce Richardson
  2021-07-20 13:36 ` [dpdk-dev] [PATCH v4] build: check for broken AVX-512 compiler support Liang Ma
  3 siblings, 1 reply; 15+ messages in thread
From: Liang Ma @ 2021-07-20 11:20 UTC (permalink / raw)
  To: dev; +Cc: leyi.rong, Liang Ma, stable, Bruce Richardson, Konstantin Ananyev

From: Liang Ma <liangma@bytedance.com>

GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887

Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
which cause building failure with debug buildtype.

Therefore, it's helpful to check if compiler work with
_mm512_extracti64x4_epi6.

This patch check the compiler compile result against the test code
snippet. If the checking is failed then disable avx512.

Bugzilla ID: 717
Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
Cc: stable@dpdk.org

Reported-by: Liang Ma <liangma@liangbit.com>
Signed-off-by: Liang Ma <liangma@bytedance.com>
---
 config/x86/meson.build | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/config/x86/meson.build b/config/x86/meson.build
index b9348c44de..87b051cd2d 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -10,6 +10,19 @@ if not is_windows
     endif
 endif
 
+#check if compiler is working with _mm512_extracti64x4_epi64
+#Ref https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
+if cc.has_argument('-mavx512f')
+    code = '''#include <immintrin.h>
+    void test(__m512i zmm){
+        __m256i ymm = _mm512_extracti64x4_epi64(zmm, 0);}'''
+    result = cc.compiles(code, args : '-mavx512f', name : 'avx512 checking')
+    if result == false
+        machine_args += '-mno-avx512f'
+        warning('Broken _mm512_extracti64x4_epi64, disabling AVX512 support')
+    endif
+endif
+
 # we require SSE4.2 for DPDK
 if cc.get_define('__SSE4_2__', args: machine_args) == ''
     message('SSE 4.2 not enabled by default, explicitly enabling')
-- 
2.17.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH v2] build: check AVX512 rather than compiler version
  2021-07-20 10:19   ` Bruce Richardson
@ 2021-07-20 11:24     ` Liang Ma
  0 siblings, 0 replies; 15+ messages in thread
From: Liang Ma @ 2021-07-20 11:24 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, leyi.rong, Liang Ma, stable, Konstantin Ananyev

On Tue, Jul 20, 2021 at 11:19:48AM +0100, Bruce Richardson wrote:
> On Mon, Jul 19, 2021 at 11:34:33PM +0100, Liang Ma wrote:
> > From: Liang Ma <liangma@bytedance.com>
> > 
> > GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
> > Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> > 
> > Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
> > which cause building failure with debug buildtype.
> > 
> > Therefore, it's helpful to check if compiler work with
> > _mm512_extracti64x4_epi6.
> > 
> > This patch check the compiler compile result against the test code
> > snippet. If the checking is failed then disable avx512.
> > 
> > Bugzilla ID: 717
> > Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
> > Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
> > Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
> > Cc: stable@dpdk.org
> > 
> > Reported-by: Liang Ma <liangma@liangbit.com>
> > Signed-off-by: Liang Ma <liangma@bytedance.com>
> > ---
> 
> Looks generally ok, but some comments below.
> 
> >  config/x86/meson.build | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> > 
> > diff --git a/config/x86/meson.build b/config/x86/meson.build
> > index b9348c44de..77370a91f7 100644
> > --- a/config/x86/meson.build
> > +++ b/config/x86/meson.build
> > @@ -10,6 +10,19 @@ if not is_windows
> >      endif
> >  endif
> >  
> > +#check if compiler is working with _mm512_extracti64x4_epi64
> > +#Ref https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> > +if not is_windows
> 
> Don't think this is needed here. The reason for it in the previous check
> for avx512 is because that check is done by a shell script which won't work
> on windows. Since we use meson functions for this check, it will work
> anywhere.
> 
> > +    code = '''#include <immintrin.h>
> > +    void test(__m512i zmm){
> > +        __m256i ymm = _mm512_extracti64x4_epi64(zmm, 0);}'''
> > +    result = cc.compiles(code, args : '-mavx512f', name : 'avx512 checking')
> > +    if result == false and cc.has_argument('-mno-avx512f')
> 
> Rather than checking for -mno-avx512f here, the whole block should probably
> be in an avx512 block itself. If the compiler doesn't have the "-mavx512f"
> flag, there may be problems with the "cc.compiles" command (or maybe it
> just counts as an error case?).
> 
> I'd suggest changing the "is_windows" condition to a cc.has_argument() one
> for avx512.
agree, I will fix that on v3.
> 
> > +        machine_args += '-mno-avx512f'
> > +        warning('Broken _mm512_extracti64x4_epi64, disabling AVX512 support')
> > +    endif
> > +endif
> > +
> >  # we require SSE4.2 for DPDK
> >  if cc.get_define('__SSE4_2__', args: machine_args) == ''
> >      message('SSE 4.2 not enabled by default, explicitly enabling')
> > -- 
> > 2.17.1
> > 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH v3] build: check AVX512 rather than compiler version
  2021-07-20 11:20 ` [dpdk-dev] [PATCH v3] " Liang Ma
@ 2021-07-20 11:58   ` Bruce Richardson
  2021-07-20 13:25     ` Liang Ma
  0 siblings, 1 reply; 15+ messages in thread
From: Bruce Richardson @ 2021-07-20 11:58 UTC (permalink / raw)
  To: Liang Ma; +Cc: dev, leyi.rong, Liang Ma, stable, Konstantin Ananyev

On Tue, Jul 20, 2021 at 12:20:59PM +0100, Liang Ma wrote:
> From: Liang Ma <liangma@bytedance.com>
> 
> GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
> Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> 
> Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
> which cause building failure with debug buildtype.
> 
> Therefore, it's helpful to check if compiler work with
> _mm512_extracti64x4_epi6.
> 
> This patch check the compiler compile result against the test code
> snippet. If the checking is failed then disable avx512.
> 
> Bugzilla ID: 717
> Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
> Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
> Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
> Cc: stable@dpdk.org
> 
> Reported-by: Liang Ma <liangma@liangbit.com>
> Signed-off-by: Liang Ma <liangma@bytedance.com>
> ---

One minor comment below. Also the commit title needs rewording, since the
current title is based on the changes from V1->V2 of your patch. I'd
suggest something like:
"build: check for broken AVX-512 compiler support"

With fixed title:
Acked-by: Bruce richardson <bruce.richardson@intel.com>

>  config/x86/meson.build | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/config/x86/meson.build b/config/x86/meson.build
> index b9348c44de..87b051cd2d 100644
> --- a/config/x86/meson.build
> +++ b/config/x86/meson.build
> @@ -10,6 +10,19 @@ if not is_windows
>      endif
>  endif
>  
> +#check if compiler is working with _mm512_extracti64x4_epi64
> +#Ref https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> +if cc.has_argument('-mavx512f')
> +    code = '''#include <immintrin.h>
> +    void test(__m512i zmm){
> +        __m256i ymm = _mm512_extracti64x4_epi64(zmm, 0);}'''
> +    result = cc.compiles(code, args : '-mavx512f', name : 'avx512 checking')
> +    if result == false

You can get rid of the "result" variable and just do
	if not cc.compiles(...)
It might be a little more readable.

> +        machine_args += '-mno-avx512f'
> +        warning('Broken _mm512_extracti64x4_epi64, disabling AVX512 support')
> +    endif
> +endif
> +
>  # we require SSE4.2 for DPDK
>  if cc.get_define('__SSE4_2__', args: machine_args) == ''
>      message('SSE 4.2 not enabled by default, explicitly enabling')
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH v3] build: check AVX512 rather than compiler version
  2021-07-20 11:58   ` Bruce Richardson
@ 2021-07-20 13:25     ` Liang Ma
  0 siblings, 0 replies; 15+ messages in thread
From: Liang Ma @ 2021-07-20 13:25 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, leyi.rong, Liang Ma, stable, Konstantin Ananyev

On Tue, Jul 20, 2021 at 12:58:13PM +0100, Bruce Richardson wrote:
 
> One minor comment below. Also the commit title needs rewording, since the
> current title is based on the changes from V1->V2 of your patch. I'd
> suggest something like:
> "build: check for broken AVX-512 compiler support"
> 
> With fixed title:
> Acked-by: Bruce richardson <bruce.richardson@intel.com>
>
Thanks. I will send out V4 to address that.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [dpdk-dev] [PATCH v4] build: check for broken AVX-512 compiler support
  2021-07-17 17:08 [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug Liang Ma
                   ` (2 preceding siblings ...)
  2021-07-20 11:20 ` [dpdk-dev] [PATCH v3] " Liang Ma
@ 2021-07-20 13:36 ` Liang Ma
  2021-07-22 17:58   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  3 siblings, 1 reply; 15+ messages in thread
From: Liang Ma @ 2021-07-20 13:36 UTC (permalink / raw)
  To: dev; +Cc: leyi.rong, Liang Ma, stable, Bruce Richardson, Konstantin Ananyev

From: Liang Ma <liangma@bytedance.com>

GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887

Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
which cause building failure with debug buildtype.

Therefore, it's helpful to check if compiler work with
_mm512_extracti64x4_epi6.

This patch check the compiler compile result against the test code
snippet. If the checking is failed then disable avx512.

Bugzilla ID: 717
Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
Cc: stable@dpdk.org

Reported-by: Liang Ma <liangma@liangbit.com>
Signed-off-by: Liang Ma <liangma@bytedance.com>
Acked-by: Bruce richardson <bruce.richardson@intel.com>
---
 config/x86/meson.build | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/config/x86/meson.build b/config/x86/meson.build
index b9348c44de..87b051cd2d 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -10,6 +10,19 @@ if not is_windows
     endif
 endif
 
+#check if compiler is working with _mm512_extracti64x4_epi64
+#Ref https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
+if cc.has_argument('-mavx512f')
+    code = '''#include <immintrin.h>
+    void test(__m512i zmm){
+        __m256i ymm = _mm512_extracti64x4_epi64(zmm, 0);}'''
+    result = cc.compiles(code, args : '-mavx512f', name : 'AVX512 checking')
+    if result == false
+        machine_args += '-mno-avx512f'
+        warning('Broken _mm512_extracti64x4_epi64, disabling AVX512 support')
+    endif
+endif
+
 # we require SSE4.2 for DPDK
 if cc.get_define('__SSE4_2__', args: machine_args) == ''
     message('SSE 4.2 not enabled by default, explicitly enabling')
-- 
2.17.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v4] build: check for broken AVX-512 compiler support
  2021-07-20 13:36 ` [dpdk-dev] [PATCH v4] build: check for broken AVX-512 compiler support Liang Ma
@ 2021-07-22 17:58   ` Thomas Monjalon
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Monjalon @ 2021-07-22 17:58 UTC (permalink / raw)
  To: Liang Ma
  Cc: dev, stable, leyi.rong, stable, Bruce Richardson,
	Konstantin Ananyev, Liang Ma

20/07/2021 15:36, Liang Ma:
> From: Liang Ma <liangma@bytedance.com>
> 
> GCC 6.3.0 has a known bug which related to _mm512_extracti64x4_epi64.
> Please reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82887
> 
> Some DPDK PMD avx512 version heavily use _mm512_extracti64x4_epi6,
> which cause building failure with debug buildtype.
> 
> Therefore, it's helpful to check if compiler work with
> _mm512_extracti64x4_epi6.
> 
> This patch check the compiler compile result against the test code
> snippet. If the checking is failed then disable avx512.
> 
> Bugzilla ID: 717
> Fixes: e6a6a138919f (net/i40e: add AVX512 vector path)
> Fixes: 808a17b3c1e6 (net/ice: add Rx AVX512 offload path)
> Fixes: 4b64ccb328c9 (net/iavf: fix VLAN extraction in AVX512 path)
> Cc: stable@dpdk.org
> 
> Reported-by: Liang Ma <liangma@liangbit.com>
> Signed-off-by: Liang Ma <liangma@bytedance.com>
> Acked-by: Bruce richardson <bruce.richardson@intel.com>

Applied, thanks.




^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-07-22 17:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-17 17:08 [dpdk-dev] [PATCH] buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug Liang Ma
2021-07-17 17:48 ` Stephen Hemminger
2021-07-17 22:13   ` Liang Ma
2021-07-18  1:08     ` Stephen Hemminger
2021-07-18  9:33       ` Liang Ma
2021-07-19  8:38         ` Bruce Richardson
2021-07-19 10:04           ` Liang Ma
2021-07-19 22:34 ` [dpdk-dev] [PATCH v2] build: check AVX512 rather than compiler version Liang Ma
2021-07-20 10:19   ` Bruce Richardson
2021-07-20 11:24     ` Liang Ma
2021-07-20 11:20 ` [dpdk-dev] [PATCH v3] " Liang Ma
2021-07-20 11:58   ` Bruce Richardson
2021-07-20 13:25     ` Liang Ma
2021-07-20 13:36 ` [dpdk-dev] [PATCH v4] build: check for broken AVX-512 compiler support Liang Ma
2021-07-22 17:58   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).