From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id ADDFDA0C4A
	for <public@inbox.dpdk.org>; Tue, 20 Jul 2021 13:21:13 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id A171C40DFB;
	Tue, 20 Jul 2021 13:21:13 +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 D9C1540140;
 Tue, 20 Jul 2021 13:21:10 +0200 (CEST)
ARC-Seal: i=1; a=rsa-sha256; t=1626780068; cv=none; d=zohomail.eu; s=zohoarc; 
 b=cMvFyWBTd8Hgs11QoPTe3yj+j3Rnc3Qy2QCMrCKu+k1wEVN4EPcTM1spdsE9uDwbjkbR5TMFrCSNNs0GK17tmscwqf5K6XMvA0MRUIQvvCepjrtZQAobfsKhV7gD6KZ0WP36wgITKR1m14WBHqjwq4SgSiSPNAE9cur8pwnh8SU=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu;
 s=zohoarc; 
 t=1626780068; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To; 
 bh=pCz/N/g5QrUdnPrlt5Lrt3ATPrMpn3s4TLyF0ZwBujs=; 
 b=gXgAQlGCTTgNZUz3v+30eMAzHNbl0k5Y5H3xWd06UecT3oQlfSfTyOcDAZQ0ZdUgkajvQkf3lKN9OmPLZiPj7yYJDmcc4akZpTBG27LQmkO+YrvKbc9MEdFbT12i8ibW1vJmSbxLrqM5D42W1lur4NYpeuNL9Pt0MqsplDuUdjA=
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 1626780066537247.396178968772;
 Tue, 20 Jul 2021 13:21:06 +0200 (CEST)
From: Liang Ma <liangma@liangbit.com>
To: dev@dpdk.org
Cc: leyi.rong@intel.com, Liang Ma <liangma@bytedance.com>, stable@dpdk.org,
 Bruce Richardson <bruce.richardson@intel.com>,
 Konstantin Ananyev <konstantin.ananyev@intel.com>
Date: Tue, 20 Jul 2021 12:20:59 +0100
Message-Id: <20210720112059.2547-1-liangma@liangbit.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20210717170830.1736-1-liangma@liangbit.com>
References: <20210717170830.1736-1-liangma@liangbit.com>
X-ZohoMailClient: External
Subject: [dpdk-stable] [PATCH v3] build: check AVX512 rather than compiler
 version
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

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