math/openblas: fix build on powerpc64

This port needs a patch (modified for kernel/power/*.S which differ) from https://github.com/xianyi/OpenBLAS/pull/2169 to build on powerpc64.

Since optimizing for PPC970 ends with an error, optimize for POWER6 on powerpc64.

PR:		238825
Approved by:	phd_kimberlite@yahoo.co.jp (maintainer), mat (mentor)
Differential Revision:	https://reviews.freebsd.org/D20777
This commit is contained in:
Piotr Kubaj 2019-06-27 17:18:17 +00:00
parent 81705df5d7
commit 338b22a658
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=505212
2 changed files with 39 additions and 2 deletions

View file

@ -17,8 +17,6 @@ COMMENT= Optimized BLAS library based on GotoBLAS2
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
BROKEN_powerpc64= fails to compile: gemm.c:403: 'SGEMM_DEFAULT_Q' undeclared (first use in this function)
USES= fortran gmake perl5
USE_GITHUB= yes
@ -56,6 +54,10 @@ AVX2_DESC= Support Advanced Vector Extensions 2 (AVX2)
.include <bsd.port.options.mk>
.if ${ARCH} == powerpc64
TARGET_CPU_ARCH= POWER6
.endif
.if defined(TARGET_CPU_ARCH)
BUILDFLAGS+= TARGET=${TARGET_CPU_ARCH}
.endif
@ -84,6 +86,8 @@ BUILDFLAGS+= INTERFACE64=1
.if ${PORT_OPTIONS:MOPENMP}
USES+= compiler:openmp
BUILDFLAGS_THREAD+= USE_OPENMP=1
.else
USES+= compiler:c11
.endif
.if ! ${PORT_OPTIONS:MAVX}
@ -131,6 +135,10 @@ post-patch:
-e 's+$${CROSS_SUFFIX}+${LOCALBASE}/bin/+' \
-e '/Clang.*OpenMP/g' \
${WRKSRC}/Makefile.system
${REINPLACE_CMD} \
-e 's/defined(linux)/(defined(linux) || defined(__FreeBSD__))/g' \
-e 's/ifdef linux/if defined(linux) || defined(__FreeBSD__)/g' \
${WRKSRC}/kernel/power/*.S
post-patch-OPENMP-on:
${REINPLACE_CMD} -e "s+OPENBLAS_NUM_THREADS+OMP_NUM_THREADS+g" \

View file

@ -0,0 +1,29 @@
--- common_power.h.orig 2019-06-26 10:25:04 UTC
+++ common_power.h
@@ -499,7 +499,7 @@ static inline int blas_quickdivide(blasint x, blasint
#if defined(ASSEMBLER) && !defined(NEEDPARAM)
-#ifdef OS_LINUX
+#if defined(OS_LINUX) || defined(OS_FREEBSD)
#ifndef __64BIT__
#define PROLOGUE \
.section .text;\
@@ -774,7 +774,7 @@ Lmcount$lazy_ptr:
#define HALT mfspr r0, 1023
-#ifdef OS_LINUX
+#if defined(OS_LINUX) || defined(OS_FREEBSD)
#if defined(PPC440) || defined(PPC440FP2)
#undef MAX_CPU_NUMBER
#define MAX_CPU_NUMBER 1
@@ -819,7 +819,7 @@ Lmcount$lazy_ptr:
#define MAP_ANONYMOUS MAP_ANON
#endif
-#ifdef OS_LINUX
+#if defined(OS_LINUX) || defined(OS_FREEBSD)
#ifndef __64BIT__
#define FRAMESLOT(X) (((X) * 4) + 8)
#else