buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug

Message ID 20210717170830.1736-1-liangma@liangbit.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series buildtools: Check GCC version to avoid GCC 6.3.0 avx512 bug |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/github-robot success github build: passed
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance fail Performance Testing issues
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-testing fail Testing issues
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Liang Ma July 17, 2021, 5:08 p.m. UTC
  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(+)
  

Comments

Stephen Hemminger July 17, 2021, 5:48 p.m. UTC | #1
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?
  
Liang Ma July 17, 2021, 10:13 p.m. UTC | #2
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
  
Stephen Hemminger July 18, 2021, 1:08 a.m. UTC | #3
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?
  
Liang Ma July 18, 2021, 9:33 a.m. UTC | #4
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.
  
Bruce Richardson July 19, 2021, 8:38 a.m. UTC | #5
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
  
Liang Ma July 19, 2021, 10:04 a.m. UTC | #6
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.
  

Patch

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}'