[dpdk-dev] [PATCH v2] build: check AVX512 rather than compiler version

Bruce Richardson bruce.richardson at intel.com
Tue Jul 20 12:19:48 CEST 2021


On Mon, Jul 19, 2021 at 11:34:33PM +0100, Liang Ma wrote:
> From: Liang Ma <liangma at 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 at dpdk.org
> 
> Reported-by: Liang Ma <liangma at liangbit.com>
> Signed-off-by: Liang Ma <liangma at 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
> 


More information about the dev mailing list