1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-28 05:29:48 +00:00

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.
This commit is contained in:
Piotr Kubaj 2021-11-25 16:25:59 +00:00
parent 55da4c82c9
commit 08c6efbca1
2 changed files with 31 additions and 2 deletions

View File

@ -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

View File

@ -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_)); \