DPDK patches and discussions
 help / color / mirror / Atom feed
* [RFC PATCH] drivers: add generic build of SVE files
@ 2025-04-07 15:28 Bruce Richardson
  2025-04-07 15:35 ` Bruce Richardson
  2025-04-07 15:49 ` David Marchand
  0 siblings, 2 replies; 4+ messages in thread
From: Bruce Richardson @ 2025-04-07 15:28 UTC (permalink / raw)
  To: dev; +Cc: david.marchand, Bruce Richardson, Jie Hai

For SVE, as for AVX2 and AVX-512, support building files for these ISAs
from the top-level drivers/meson.build file, rather than having each
driver re-implement it.

This removes the remaining build task for drivers in DPDK which is
being done by a driver itself, rather than in the generic drivers'
build rules.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/meson.build          | 27 +++++++++++++++++++++++++++
 drivers/net/hns3/meson.build | 22 +---------------------
 2 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/drivers/meson.build b/drivers/meson.build
index b2d2537dc8..a6f0670a2f 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -128,6 +128,7 @@ foreach subpath:subdirs
         sources = []
         sources_avx2 = []
         sources_avx512 = []
+        sources_sve = []
         headers = []
         driver_sdk_headers = [] # public headers included by drivers
         objs = []
@@ -285,6 +286,32 @@ foreach subpath:subdirs
             endif
         endif

+        if (arch_subdir == 'arm' and sources_sve.length() > 0
+                and cc.has_argument('-march=armv8.2-a+sve')
+                and cc.check_header('arm_sve.h'))
+
+            if dpdk_conf.has('RTE_HAS_SVE_ACLE')
+                sources += sources_sve
+            else
+                cflags += ['-DRTE_HAS_SVE_ACLE=1']
+                sve_cflags = ['-march=armv8.2-a+sve']
+                foreach flag: cflags
+                    if (flag.startswith('-march=')
+                            or flag.startswith('-mcpu=')
+                            or flag.startswith('-mtune='))
+                        continue
+                    endif
+                    sve_cflags += flag
+                endforeach
+                sve_lib = static_library(libname + '_sve_lib',
+                        sources_sve,
+                        dependencies: static_deps,
+                        include_directories: includes,
+                        c_args: sve_cflags)
+                objs += sve_lib.extract_objects(sources_sve)
+            endif
+        endif
+
         # generate pmdinfo sources by building a temporary
         # lib and then running pmdinfogen on the contents of
         # that lib. The final lib reuses the object files and
diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build
index 53a9dd6f39..87f04aa440 100644
--- a/drivers/net/hns3/meson.build
+++ b/drivers/net/hns3/meson.build
@@ -43,25 +43,5 @@ cflags += no_wvla_cflag

 if arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64')
     sources += files('hns3_rxtx_vec.c')
-
-    # compile SVE when:
-    # a. support SVE in minimum instruction set baseline
-    # b. it's not minimum instruction set, but compiler support
-    if dpdk_conf.has('RTE_HAS_SVE_ACLE')
-        sources += files('hns3_rxtx_vec_sve.c')
-    elif cc.has_argument('-march=armv8.2-a+sve') and cc.check_header('arm_sve.h')
-        cflags += ['-DRTE_HAS_SVE_ACLE=1']
-        sve_cflags = []
-        foreach flag: cflags
-            if not (flag.startswith('-march=') or flag.startswith('-mcpu=') or flag.startswith('-mtune='))
-                sve_cflags += flag
-            endif
-        endforeach
-        hns3_sve_lib = static_library('hns3_sve_lib',
-                        'hns3_rxtx_vec_sve.c',
-                        dependencies: [static_rte_ethdev],
-                        include_directories: includes,
-                        c_args: [sve_cflags, '-march=armv8.2-a+sve'])
-        objs += hns3_sve_lib.extract_objects('hns3_rxtx_vec_sve.c')
-    endif
+    sources_sve += files('hns3_rxtx_vec_sve.c')
 endif
--
2.45.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-07 16:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-07 15:28 [RFC PATCH] drivers: add generic build of SVE files Bruce Richardson
2025-04-07 15:35 ` Bruce Richardson
2025-04-07 15:49 ` David Marchand
2025-04-07 16:10   ` Bruce Richardson

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