From 70dc364be042e1aef24c5a21796afe477ea15b8d Mon Sep 17 00:00:00 2001 From: wangguokun Date: Mon, 8 Jul 2024 02:13:43 +0000 Subject: [PATCH] lib/eigen: port lib-eigen to tenonos Signed-off-by: wangguokun --- CONTRIBUTING.md | 2 +- Config.uk | 2 +- Makefile.uk | 19 ++++++++++---- include/__unikraft_eigen_config.h | 1 - ...-Add-header-config-file-for-Unikraft.patch | 26 ------------------- ...02-prevent-barrier-macro-code-kludge.patch | 10 ------- 6 files changed, 16 insertions(+), 44 deletions(-) delete mode 100644 patches/0001-Add-header-config-file-for-Unikraft.patch delete mode 100644 patches/0002-prevent-barrier-macro-code-kludge.patch diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 14f6ac6..2bdc1c0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ Contributing to Unikraft -======================== +======= Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository. diff --git a/Config.uk b/Config.uk index e224b69..5bf182f 100644 --- a/Config.uk +++ b/Config.uk @@ -2,7 +2,7 @@ menuconfig LIBEIGEN bool "eigen - C++ template library for linear algebra" select LIBCXX select LIBCXXABI - select LIBNEWLIBC + select LIBMUSL select LIBUNWIND select LIBPOSIX_SYSINFO select LIBCOMPILER_RT diff --git a/Makefile.uk b/Makefile.uk index 163306c..3d5461b 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -37,17 +37,18 @@ $(eval $(call addlib_s,libeigen,$(CONFIG_LIBEIGEN))) ################################################################################ # Sources ################################################################################ -LIBEIGEN_COMMIT=049af2f56331 -LIBEIGEN_PATCHDIR=$(LIBEIGEN_BASE)/patches +LIBEIGEN_COMMIT=34780d8bd13d0af0cf17a22789ef286e8512594d +LIBEIGEN_URL=https://gitlab.com/libeigen/eigen/-/archive/$(LIBEIGEN_COMMIT)/eigen-$(LIBEIGEN_COMMIT).tar.gz -LIBEIGEN_URL=https://bitbucket.org/eigen/eigen/get/${LIBEIGEN_COMMIT}.tar.gz +ifeq ($(CONFIG_LIBEIGEN), y) $(eval $(call fetch,libeigen,$(LIBEIGEN_URL))) -$(eval $(call patch,libeigen,$(LIBEIGEN_PATCHDIR),eigen-eigen-$(LIBEIGEN_COMMIT))) +endif ################################################################################ # Helpers ################################################################################ -LIBEIGEN_SUBDIR=eigen-eigen-$(LIBEIGEN_COMMIT) + +LIBEIGEN_SUBDIR=eigen-$(LIBEIGEN_COMMIT) LIBEIGEN_SRC=$(LIBEIGEN_ORIGIN)/$(LIBEIGEN_SUBDIR) ################################################################################ @@ -71,5 +72,13 @@ SUPPRESS_FLAGS += -Wno-unused-parameter -Wno-unused-variable -Wno-nonnull \ -Wno-missing-braces -Wno-endif-labels -Wno-unused-but-set-variable \ -Wno-implicit-function-declaration -Wno-type-limits -Wno-sign-compare +GCC_INSTALLDIR_FLAGS := -idirafter $(shell LC_ALL=C $(CC) -v 2>&1 | \ + $(SED) -e '/^COLLECT_LTO_WRAPPER=\(.*\)\/lto-wrapper/!d' -e 's//\1/')/include + +ifdef CONFIG_ARCH_ARM_64 +LIBEIGEN_CFLAGS-$(CONFIG_ARCH_ARM_64) += $(GCC_INSTALLDIR_FLAGS) +LIBEIGEN_CXXFLAGS-$(CONFIG_ARCH_ARM_64) += $(GCC_INSTALLDIR_FLAGS) +endif + LIBEIGEN_CFLAGS-y += $(SUPPRESS_FLAGS) LIBEIGEN_CXXFLAGS-y += $(SUPPRESS_FLAGS) diff --git a/include/__unikraft_eigen_config.h b/include/__unikraft_eigen_config.h index ca0dd91..8ead830 100644 --- a/include/__unikraft_eigen_config.h +++ b/include/__unikraft_eigen_config.h @@ -28,6 +28,5 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - */ #define EIGEN_DONT_VECTORIZE diff --git a/patches/0001-Add-header-config-file-for-Unikraft.patch b/patches/0001-Add-header-config-file-for-Unikraft.patch deleted file mode 100644 index 9259de8..0000000 --- a/patches/0001-Add-header-config-file-for-Unikraft.patch +++ /dev/null @@ -1,26 +0,0 @@ -From a42a344157b73cd2562259358136a1c72b02f4c1 Mon Sep 17 00:00:00 2001 -From: Vlad-Andrei Badoiu -Date: Thu, 2 May 2019 18:53:22 +0300 -Subject: [PATCH 1/1] Add header config file for Unikraft - -Signed-off-by: Vlad-Andrei Badoiu ---- - Eigen/Core | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/Eigen/Core b/Eigen/Core -index b923b8c..dc531cb 100644 ---- a/Eigen/Core -+++ b/Eigen/Core -@@ -11,6 +11,8 @@ - #ifndef EIGEN_CORE_H - #define EIGEN_CORE_H - -+#include <__unikraft_eigen_config.h> -+ - // first thing Eigen does: stop the compiler from committing suicide - #include "src/Core/util/DisableStupidWarnings.h" - --- -2.21.0 - diff --git a/patches/0002-prevent-barrier-macro-code-kludge.patch b/patches/0002-prevent-barrier-macro-code-kludge.patch deleted file mode 100644 index 0b3fe78..0000000 --- a/patches/0002-prevent-barrier-macro-code-kludge.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h 2020-04-17 17:13:19.072796790 +0200 -+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h 2021-04-17 17:13:41.800543414 +0200 -@@ -98,6 +98,7 @@ - const char* src_ptr = static_cast(src); - char* dst_ptr = static_cast(dst); - const size_t blocksize = (n + (num_threads - 1)) / num_threads; -+#undef barrier - Barrier barrier(static_cast(num_threads - 1)); - // Launch the last 3 blocks on worker threads. - for (size_t i = 1; i < num_threads; ++i) { -- Gitee