diff --git a/math/libxsmm/Makefile b/math/libxsmm/Makefile index b77c85163c2c..4aa8afb24c07 100644 --- a/math/libxsmm/Makefile +++ b/math/libxsmm/Makefile @@ -1,33 +1,37 @@ PORTNAME= libxsmm DISTVERSION= 1.16.3 CATEGORIES= math science MAINTAINER= yuri@FreeBSD.org 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 USES= cpe fortran gmake localbase:ldflags python:build shebangfix CPE_VENDOR= ${PORTNAME}_project SHEBANG_GLOB= *.sh USE_GITHUB= yes GH_ACCOUNT= hfp USE_LDCONFIG= yes MAKE_ARGS= STATIC=0 DEPSTATIC=0 MAKE_PARALLEL=1 LDFLAGS+= -lm TEST_TARGET= tests BINARY_ALIAS= python=${PYTHON_CMD} +.include + +.if ${ARCH} != amd64 +MAKE_ARGS+= PLATFORM=1 +.endif + post-install: # https://github.com/hfp/libxsmm/issues/413 ${RMDIR} ${STAGEDIR}${PREFIX}/share/modules .include 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 + #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_)); \