DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Subject: [PATCH v1 1/8] config/x86: add global defines for checking AVX-512
Date: Mon, 30 Sep 2024 18:50:25 +0100	[thread overview]
Message-ID: <20240930175033.2283861-2-bruce.richardson@intel.com> (raw)
In-Reply-To: <20240930175033.2283861-1-bruce.richardson@intel.com>

Rather than having each driver do its own checking for AVX-512 support,
let's do it once in config/x86/meson.build and let all drivers re-use
that result.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 config/x86/meson.build | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/config/x86/meson.build b/config/x86/meson.build
index 8087b9ae91..f973878371 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -16,7 +16,8 @@ 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')
+cc_has_avx512 = false
+if binutils_ok and cc.has_argument('-mavx512f')
     code = '''#include <immintrin.h>
     void test(__m512i zmm){
         __m256i ymm = _mm512_extracti64x4_epi64(zmm, 0);}'''
@@ -24,6 +25,15 @@ if cc.has_argument('-mavx512f')
     if result == false
         machine_args += '-mno-avx512f'
         warning('Broken _mm512_extracti64x4_epi64, disabling AVX512 support')
+    else
+        cc_avx512_flags = ['-mavx512f', '-mavx512vl', '-mavx512dq', '-mavx512bw']
+        cc_has_avx512 = cc.has_multi_arguments(cc_avx512_flags)
+        target_has_avx512 = (
+                cc.get_define('__AVX512F__', args: machine_args) != '' and
+                cc.get_define('__AVX512BW__', args: machine_args) != '' and
+                cc.get_define('__AVX512DQ__', args: machine_args) != '' and
+                cc.get_define('__AVX512VL__', args: machine_args) != ''
+            )
     endif
 endif
 
-- 
2.43.0


  reply	other threads:[~2024-09-30 17:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 17:50 [PATCH v1 0/8] centralize AVX-512 feature detection Bruce Richardson
2024-09-30 17:50 ` Bruce Richardson [this message]
2024-09-30 17:50 ` [PATCH v1 2/8] event/dlb2: use global AVX-512 variables Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 3/8] common/idpf: " Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 4/8] net/cpfl: " Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 5/8] net/i40e: " Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 6/8] net/iavf: " Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 7/8] net/ice: " Bruce Richardson
2024-09-30 17:50 ` [PATCH v1 8/8] net/idpf: " Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240930175033.2283861-2-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.v.ananyev@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).