From 2e85347e594f43778532db641d727ef69f61ab4d Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Tue, 30 Jul 2019 12:11:21 +0000 Subject: [PATCH] math/openblas: fix build on powerpc64 with TARGET=PPC970 and switch to PPC970 This patch fixes build for PPC970 target. Since most people that run FreeBSD on powerpc64 use PowerPC 970 CPU's, switch to it by default and add non-default option to optimize for POWER6 (optimizing for newer POWER doesn't work on BE). Bump PORTREVISION because of package change. PR: 238868 Approved by: phd_kimberlite@yahoo.co.jp (maintainer), linimon (mentor) Differential Revision: https://reviews.freebsd.org/D21010 --- math/openblas/Makefile | 8 +++++++- math/openblas/files/patch-common__power.h | 11 ++++++++++- math/openblas/files/patch-param.h | 11 +++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 math/openblas/files/patch-param.h diff --git a/math/openblas/Makefile b/math/openblas/Makefile index 353f5cf2f11e..7ad26b93f06e 100644 --- a/math/openblas/Makefile +++ b/math/openblas/Makefile @@ -3,7 +3,7 @@ PORTNAME= openblas PORTVERSION= 0.2.20 -PORTREVISION= 9 +PORTREVISION= 10 DISTVERSIONPREFIX= v PORTEPOCH= 1 CATEGORIES= math @@ -40,6 +40,7 @@ BUILDFLAGS= FCOMMON_OPT=-frecursive MAKE_NB_JOBS=-1 OPTIONS_DEFINE= INTERFACE64 OPENMP OPTIONS_DEFINE_i386= DYNAMIC_ARCH AVX AVX2 OPTIONS_DEFINE_amd64= ${OPTIONS_DEFINE_i386} +OPTIONS_DEFINE_powerpc64= POWER6 .if defined(BATCH) || defined(PACKAGE_BUILDING) OPTIONS_DEFAULT_i386= DYNAMIC_ARCH @@ -51,11 +52,16 @@ INTERFACE64_DESC= Use 8 byte integers on 64-bit architectures OPENMP_DESC= Use OpenMP for threading AVX_DESC= Support Advanced Vector Extensions (AVX) AVX2_DESC= Support Advanced Vector Extensions 2 (AVX2) +POWER6_DESC= Optimize for POWER6, instead of the default PPC970 .include .if ${ARCH} == powerpc64 +. if ${PORT_OPTIONS:MPOWER6} TARGET_CPU_ARCH= POWER6 +.else +TARGET_CPU_ARCH= PPC970 +. endif .endif .if defined(TARGET_CPU_ARCH) diff --git a/math/openblas/files/patch-common__power.h b/math/openblas/files/patch-common__power.h index 928ca0b80012..cf1ac03278e5 100644 --- a/math/openblas/files/patch-common__power.h +++ b/math/openblas/files/patch-common__power.h @@ -1,5 +1,14 @@ ---- common_power.h.orig 2019-06-26 10:25:04 UTC +--- common_power.h.orig 2017-07-24 04:03:35 UTC +++ common_power.h +@@ -241,7 +241,7 @@ static inline int blas_quickdivide(blasint x, blasint + #define HAVE_PREFETCH + #endif + +-#if defined(POWER3) || defined(POWER6) || defined(PPCG4) || defined(CELL) || defined(POWER8) ++#if defined(POWER3) || defined(POWER6) || defined(PPCG4) || defined(CELL) || defined(POWER8) || defined(PPC970) + #define DCBT_ARG 0 + #else + #define DCBT_ARG 8 @@ -499,7 +499,7 @@ static inline int blas_quickdivide(blasint x, blasint #if defined(ASSEMBLER) && !defined(NEEDPARAM) diff --git a/math/openblas/files/patch-param.h b/math/openblas/files/patch-param.h new file mode 100644 index 000000000000..d5ccfefc9a5c --- /dev/null +++ b/math/openblas/files/patch-param.h @@ -0,0 +1,11 @@ +--- param.h.orig 2019-06-28 14:19:50 UTC ++++ param.h +@@ -1877,7 +1877,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILI + #define ZGEMM_DEFAULT_UNROLL_M 2 + #define ZGEMM_DEFAULT_UNROLL_N 2 + +-#ifdef OS_LINUX ++#if defined(OS_LINUX) || defined(OS_FREEBSD) + #if L2_SIZE == 1024976 + #define SGEMM_DEFAULT_P 320 + #define DGEMM_DEFAULT_P 256