Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jun 2019 17:18:17 +0000 (UTC)
From:      Piotr Kubaj <pkubaj@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r505212 - in head/math/openblas: . files
Message-ID:  <201906271718.x5RHIHKC038374@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pkubaj
Date: Thu Jun 27 17:18:17 2019
New Revision: 505212
URL: https://svnweb.freebsd.org/changeset/ports/505212

Log:
  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

Added:
  head/math/openblas/files/patch-common__power.h   (contents, props changed)
Modified:
  head/math/openblas/Makefile

Modified: head/math/openblas/Makefile
==============================================================================
--- head/math/openblas/Makefile	Thu Jun 27 17:17:36 2019	(r505211)
+++ head/math/openblas/Makefile	Thu Jun 27 17:18:17 2019	(r505212)
@@ -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" \

Added: head/math/openblas/files/patch-common__power.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/openblas/files/patch-common__power.h	Thu Jun 27 17:18:17 2019	(r505212)
@@ -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



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