Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Nov 2021 16:32:11 GMT
From:      Piotr Kubaj <pkubaj@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 08c6efbca1c4 - main - math/libxsmm: fix build on non-amd64
Message-ID:  <202111251632.1APGWBY2054442@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=08c6efbca1c4266eb9403f366ddf0022268dd9b3

commit 08c6efbca1c4266eb9403f366ddf0022268dd9b3
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2021-11-25 16:25:59 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2021-11-25 16:25:59 +0000

    math/libxsmm: fix build on non-amd64
    
    On non-amd64, PLATFORM=1 needs to be passed to disable JIT.
    
    Also, add a way to read TBR that does not depend on glibc.
---
 math/libxsmm/Makefile                         |  8 ++++++--
 math/libxsmm/files/patch-src_libxsmm__timer.c | 25 +++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/math/libxsmm/Makefile b/math/libxsmm/Makefile
index b77c85163c2c..4aa8afb24c07 100644
--- a/math/libxsmm/Makefile
+++ b/math/libxsmm/Makefile
@@ -8,8 +8,6 @@ COMMENT=	Library for dense and sparse matrix operations and deep learning
 LICENSE=	BSD3CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE.md
 
-ONLY_FOR_ARCHS=		amd64
-ONLY_FOR_ARCHS_REASON=	relies on hard-coded x86 code, and is only supported on 64-bit
 
 BUILD_DEPENDS=	bash:shells/bash
 
@@ -27,6 +25,12 @@ TEST_TARGET=	tests
 
 BINARY_ALIAS=	python=${PYTHON_CMD}
 
+.include <bsd.port.options.mk>
+
+.if ${ARCH} != amd64
+MAKE_ARGS+=	PLATFORM=1
+.endif
+
 post-install: # https://github.com/hfp/libxsmm/issues/413
 	${RMDIR} ${STAGEDIR}${PREFIX}/share/modules
 
diff --git a/math/libxsmm/files/patch-src_libxsmm__timer.c b/math/libxsmm/files/patch-src_libxsmm__timer.c
new file mode 100644
index 000000000000..4eb0ad2ce785
--- /dev/null
+++ b/math/libxsmm/files/patch-src_libxsmm__timer.c
@@ -0,0 +1,25 @@
+--- src/libxsmm_timer.c.orig	2021-11-25 15:39:20 UTC
++++ src/libxsmm_timer.c
+@@ -24,7 +24,7 @@
+ # pragma offload_attribute(pop)
+ #endif
+ 
+-#if defined(__powerpc64__)
++#if defined(__powerpc64__) && defined(__GLIBC__)
+ # include <sys/platform/ppc.h>
+ #endif
+ 
+@@ -37,9 +37,13 @@
+ 
+ #if defined(LIBXSMM_TIMER_TSC)
+ # if defined(__powerpc64__)
++#  if defined(__GLIBC__)
+ #   define LIBXSMM_TIMER_RDTSC(CYCLE) { \
+       CYCLE = __ppc_get_timebase(); \
+     }
++#  else
++#   define LIBXSMM_TIMER_RDTSC(CYCLE) asm volatile("mfspr %%r3, 268": "=r" (CYCLE));
++#  endif
+ # elif ((defined(__GNUC__) || defined(LIBXSMM_INTEL_COMPILER) || defined(__PGI)) && (64 <= (LIBXSMM_BITS)))
+ #   define LIBXSMM_TIMER_RDTSC(CYCLE) { libxsmm_timer_tickint libxsmm_timer_rdtsc_hi_; \
+       __asm__ __volatile__ ("rdtsc" : "=a"(CYCLE), "=d"(libxsmm_timer_rdtsc_hi_)); \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111251632.1APGWBY2054442>