From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 5B52DA0C49;
	Tue, 20 Jul 2021 13:24:39 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 2DE5F40689;
	Tue, 20 Jul 2021 13:24:39 +0200 (CEST)
Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu
 [31.186.226.237])
 by mails.dpdk.org (Postfix) with ESMTP id 7EF8C40140;
 Tue, 20 Jul 2021 13:24:37 +0200 (CEST)
ARC-Seal: i=1; a=rsa-sha256; t=1626780275; cv=none; d=zohomail.eu; s=zohoarc; 
 b=hmm6cBX2pCLu/sVMRSdUalw7cpvJHaCNN3ccwTuqf8DtfpXoNwLKbNxRYEvWh/h0Gt/zSe4nIsUpdypVVMvNLPP5P/IjfaQyNsAo9ep4vxpm3Y4CS7ZPxK6JwLnb3FudWAPvioUR72aWUQc+qowZwcDsGMZjVCnRJtrdGXTl5O8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu;
 s=zohoarc; t=1626780275;
 h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To;
 bh=cav/EfpjAYGe4zMi6EXZuwb2kjOQ8hMFebu4MPl+Zjs=; 
 b=abYuFkDOYHhDlYpDYXId4re9QGzkktjovLMI5uxz/wszE+oyFx4M3Vzsw6Mm2Kws1UCy5a1/aDb6zA6X4NCf138uR3fXYZzJShOp2P/25vOtwqLgU6IP4toKCYbFlWGwdHs8vpScvRK87JngcEQCokdcfCbZ2BuGI7YY3shvaOI=
ARC-Authentication-Results: i=1; mx.zohomail.eu;
 spf=pass  smtp.mailfrom=liangma@liangbit.com;
 dmarc=pass header.from=<liangma@liangbit.com>
Received: from DESKTOP-POQV63C.localdomain (51.37.210.143 [51.37.210.143]) by
 mx.zoho.eu with SMTPS id 1626780274307126.98324271789352;
 Tue, 20 Jul 2021 13:24:34 +0200 (CEST)
Date: Tue, 20 Jul 2021 12:24:31 +0100
From: Liang Ma <liangma@liangbit.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, leyi.rong@intel.com, Liang Ma <liangma@bytedance.com>,
 stable@dpdk.org, Konstantin Ananyev <konstantin.ananyev@intel.com>
Message-ID: <20210720112431.GA2625@DESKTOP-POQV63C.localdomain>
References: <20210717170830.1736-1-liangma@liangbit.com>
 <20210719223433.2109-1-liangma@liangbit.com>
 <YPajRB2/eDIC2W3g@bricha3-MOBL.ger.corp.intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <YPajRB2/eDIC2W3g@bricha3-MOBL.ger.corp.intel.com>
User-Agent: Mutt/1.9.4 (2018-02-28)
X-ZohoMailClient: External
Subject: Re: [dpdk-dev] [PATCH v2] build: check AVX512 rather than compiler
 version
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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