From 1bfc85a688d4a86bc3767fc2b746c9585ecdc7b7 Mon Sep 17 00:00:00 2001 From: James Hilliard Date: Tue, 28 Jan 2025 10:01:50 -0700 Subject: [PATCH] package/xnnpack: new package This package is required by tensorflow-lite. Signed-off-by: James Hilliard Signed-off-by: Julien Olivain --- DEVELOPERS | 1 + package/Config.in | 1 + package/xnnpack/Config.in | 25 +++++++++++++++++++++++++ package/xnnpack/xnnpack.hash | 4 ++++ package/xnnpack/xnnpack.mk | 21 +++++++++++++++++++++ 5 files changed, 52 insertions(+) create mode 100644 package/xnnpack/Config.in create mode 100644 package/xnnpack/xnnpack.hash create mode 100644 package/xnnpack/xnnpack.mk diff --git a/DEVELOPERS b/DEVELOPERS index a5d0b2ddb3..2be4990676 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -3039,6 +3039,7 @@ F: package/gemmlowp/ F: package/psimd/ F: package/pthreadpool/ F: package/ruy/ +F: package/xnnpack/ N: Stefan Nickl F: board/freescale/imx8dxlevk/ diff --git a/package/Config.in b/package/Config.in index cccb95b869..74cd3e9815 100644 --- a/package/Config.in +++ b/package/Config.in @@ -2318,6 +2318,7 @@ endif source "package/uvw/Config.in" source "package/volk/Config.in" source "package/xapian/Config.in" + source "package/xnnpack/Config.in" endmenu menu "Security" diff --git a/package/xnnpack/Config.in b/package/xnnpack/Config.in new file mode 100644 index 0000000000..e4b92f61e8 --- /dev/null +++ b/package/xnnpack/Config.in @@ -0,0 +1,25 @@ +config BR2_PACKAGE_XNNPACK_ARCH_SUPPORTS + bool + default y if BR2_i386 + default y if BR2_x86_64 + depends on BR2_PACKAGE_CPUINFO_ARCH_SUPPORTS + +config BR2_PACKAGE_XNNPACK + bool "xnnpack" + depends on BR2_PACKAGE_XNNPACK_ARCH_SUPPORTS + depends on BR2_INSTALL_LIBSTDCPP + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++14 + depends on BR2_TOOLCHAIN_HAS_THREADS # cpuinfo + select BR2_PACKAGE_CPUINFO + select BR2_PACKAGE_FP16 + select BR2_PACKAGE_FXDIV + select BR2_PACKAGE_PTHREADPOOL + help + XNNPACK is a highly optimized solution for neural network + inference on ARM, x86, WebAssembly, and RISC-V platforms. + + https://github.com/google/XNNPACK + +comment "xnnpack needs a toolchain w/ C++14, threads" + depends on !BR2_INSTALL_LIBSTDCPP || \ + !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || !BR2_TOOLCHAIN_HAS_THREADS diff --git a/package/xnnpack/xnnpack.hash b/package/xnnpack/xnnpack.hash new file mode 100644 index 0000000000..576b73aec0 --- /dev/null +++ b/package/xnnpack/xnnpack.hash @@ -0,0 +1,4 @@ +# Locally calculated +sha256 0ed35a104a697abbae72b02b967e057883ff57b388178649c453b68cffb81f72 xnnpack-d7f398ee5e135ef4f7045802eea973cc6cb26c6c.tar.gz +# License files, locally calculated +sha256 63f519e15726f4c4f830bd958f694c84fecb4e0a4cacc527d2696bb71ef95ada LICENSE diff --git a/package/xnnpack/xnnpack.mk b/package/xnnpack/xnnpack.mk new file mode 100644 index 0000000000..bb53188f9e --- /dev/null +++ b/package/xnnpack/xnnpack.mk @@ -0,0 +1,21 @@ +################################################################################ +# +# xnnpack +# +################################################################################ + +XNNPACK_VERSION = d7f398ee5e135ef4f7045802eea973cc6cb26c6c +XNNPACK_SITE = $(call github,google,XNNPACK,$(XNNPACK_VERSION)) +XNNPACK_LICENSE = BSD-3-Clause +XNNPACK_LICENSE_FILES = LICENSE +XNNPACK_INSTALL_STAGING = YES +XNNPACK_DEPENDENCIES = cpuinfo fp16 fxdiv pthreadpool +XNNPACK_CONF_OPTS = \ + -DCPUINFO_SOURCE_DIR=$(STAGING_DIR)/usr \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DXNNPACK_BUILD_TESTS=OFF \ + -DXNNPACK_BUILD_BENCHMARKS=OFF \ + -DXNNPACK_ENABLE_KLEIDIAI=OFF \ + -DXNNPACK_USE_SYSTEM_LIBS=ON + +$(eval $(cmake-package))