diff --git a/0001-Require-gcc-11-for-builtin_cpu_is-power10.patch b/0001-Require-gcc-11-for-builtin_cpu_is-power10.patch new file mode 100644 index 0000000..8e7c200 --- /dev/null +++ b/0001-Require-gcc-11-for-builtin_cpu_is-power10.patch @@ -0,0 +1,26 @@ +From 63fa3c3f8f869c585d8c5aef6f580a967b64405c Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Wed, 20 Jan 2021 15:41:04 +0100 +Subject: [PATCH 1/2] Require gcc 11 for builtin_cpu_is(power10) + +fixes #3074 +--- + driver/others/dynamic_power.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/driver/others/dynamic_power.c b/driver/others/dynamic_power.c +index f9feeb6e..18f16f83 100644 +--- a/driver/others/dynamic_power.c ++++ b/driver/others/dynamic_power.c +@@ -202,7 +202,7 @@ static gotoblas_t *get_coretype(void) { + return &gotoblas_POWER10; + #endif + /* Fall back to the POWER9 implementation if the toolchain is too old or the MMA feature is not set */ +-#if (!defined __GNUC__) || ( __GNUC__ >= 6) ++#if (!defined __GNUC__) || ( __GNUC__ >= 11) + if (__builtin_cpu_is("power10")) + return &gotoblas_POWER9; + #endif +-- +2.26.2 + diff --git a/0002-patch-to-support-power10-in-builtin_cpu_is-was-backp.patch b/0002-patch-to-support-power10-in-builtin_cpu_is-was-backp.patch new file mode 100644 index 0000000..bbeb11e --- /dev/null +++ b/0002-patch-to-support-power10-in-builtin_cpu_is-was-backp.patch @@ -0,0 +1,26 @@ +From b94dab5250469d4d30d1a21bf0e0b78eea3cf286 Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Wed, 20 Jan 2021 21:34:36 +0100 +Subject: [PATCH 2/2] patch to support power10 in builtin_cpu_is was backported + to gcc 10.2, so allow that as wel + +--- + driver/others/dynamic_power.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/driver/others/dynamic_power.c b/driver/others/dynamic_power.c +index 18f16f83..b8e5840a 100644 +--- a/driver/others/dynamic_power.c ++++ b/driver/others/dynamic_power.c +@@ -202,7 +202,7 @@ static gotoblas_t *get_coretype(void) { + return &gotoblas_POWER10; + #endif + /* Fall back to the POWER9 implementation if the toolchain is too old or the MMA feature is not set */ +-#if (!defined __GNUC__) || ( __GNUC__ >= 11) ++#if (!defined __GNUC__) || ( __GNUC__ >= 11) || (__GNUC__ == 10 && __GNUC_MINOR__ >= 2) + if (__builtin_cpu_is("power10")) + return &gotoblas_POWER9; + #endif +-- +2.26.2 + diff --git a/openblas-ppc64be_up2_p8.patch b/openblas-ppc64be_up2_p8.patch new file mode 100644 index 0000000..c3cc832 --- /dev/null +++ b/openblas-ppc64be_up2_p8.patch @@ -0,0 +1,108 @@ +From: Michel Normand +Subject: openblas ppc64be up2 p8 +Date: Wed, 03 Feb 2021 15:39:25 +0100 + +openblas ppc64be up2 p8 + +because: +* openblas build failed for ppc64 (BE) in openSUSE + since version 0.3.12 +* ppc64 (BE) not supported by IBM after P8. + +Signed-off-by: Michel Normand +--- + Makefile.system | 4 ++++ + driver/others/dynamic_power.c | 11 +++++++++++ + 2 files changed, 15 insertions(+) + +Index: OpenBLAS-0.3.13/Makefile.system +=================================================================== +--- OpenBLAS-0.3.13.orig/Makefile.system ++++ OpenBLAS-0.3.13/Makefile.system +@@ -665,6 +665,9 @@ endif # ARCH zarch + ifeq ($(ARCH), power) + DYNAMIC_CORE = POWER6 + DYNAMIC_CORE += POWER8 ++ifeq ($(__BYTE_ORDER__),__ORDER_BIG_ENDIAN__) ++$(info, OpenBLAS: for big endian limit to POWER8 kernels.) ++else + ifneq ($(C_COMPILER), GCC) + DYNAMIC_CORE += POWER9 + DYNAMIC_CORE += POWER10 +@@ -690,6 +693,7 @@ $(info, OpenBLAS: Your gcc version is to + endif + endif + endif ++endif + + # If DYNAMIC_CORE is not set, DYNAMIC_ARCH cannot do anything, so force it to empty + ifndef DYNAMIC_CORE +Index: OpenBLAS-0.3.13/driver/others/dynamic_power.c +=================================================================== +--- OpenBLAS-0.3.13.orig/driver/others/dynamic_power.c ++++ OpenBLAS-0.3.13/driver/others/dynamic_power.c +@@ -3,6 +3,7 @@ + + extern gotoblas_t gotoblas_POWER6; + extern gotoblas_t gotoblas_POWER8; ++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + #if (!defined __GNUC__) || ( __GNUC__ >= 6) + extern gotoblas_t gotoblas_POWER9; + #endif +@@ -13,6 +14,7 @@ extern gotoblas_t gotoblas_POWER9; + #ifdef HAVE_P10_SUPPORT + extern gotoblas_t gotoblas_POWER10; + #endif ++#endif + + extern void openblas_warning(int verbose, const char *msg); + +@@ -29,12 +31,14 @@ static char *corename[] = { + char *gotoblas_corename(void) { + if (gotoblas == &gotoblas_POWER6) return corename[1]; + if (gotoblas == &gotoblas_POWER8) return corename[2]; ++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + #if (!defined __GNUC__) || ( __GNUC__ >= 6) + if (gotoblas == &gotoblas_POWER9) return corename[3]; + #endif + #ifdef HAVE_P10_SUPPORT + if (gotoblas == &gotoblas_POWER10) return corename[4]; + #endif ++#endif + return corename[0]; + } + +@@ -44,6 +48,10 @@ static gotoblas_t *get_coretype(void) { + return &gotoblas_POWER6; + if (__builtin_cpu_is("power8")) + return &gotoblas_POWER8; ++ /* Fall back to the POWER8 implementation for big endian */ ++#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++ return &gotoblas_POWER8; ++#else + #if (!defined __GNUC__) || ( __GNUC__ >= 6) + if (__builtin_cpu_is("power9")) + return &gotoblas_POWER9; +@@ -57,6 +65,7 @@ static gotoblas_t *get_coretype(void) { + if (__builtin_cpu_is("power10")) + return &gotoblas_POWER9; + #endif ++#endif + return NULL; + } + +@@ -79,12 +88,14 @@ static gotoblas_t *force_coretype(char * + { + case 1: return (&gotoblas_POWER6); + case 2: return (&gotoblas_POWER8); ++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + #if (!defined __GNUC__) || ( __GNUC__ >= 6) + case 3: return (&gotoblas_POWER9); + #endif + #ifdef HAVE_P10_SUPPORT + case 4: return (&gotoblas_POWER10); + #endif ++#endif + default: return NULL; + } + snprintf(message, 128, "Core not found: %s\n", coretype); diff --git a/openblas.changes b/openblas.changes index 46d924a..6e3b973 100644 --- a/openblas.changes +++ b/openblas.changes @@ -1,3 +1,20 @@ +------------------------------------------------------------------- +Thu Feb 4 11:49:11 UTC 2021 - Michel Normand + +- Disable lto for ppc64le to avoid build failure (bsc#1181733) +- Add openblas-ppc64be_up2_p8.patch to avoid ppc64 (BE) build failure + Do not set BUILD_BFLOAT16 for ppc64 (BE) (same bug nb) + +------------------------------------------------------------------- +Tue Feb 2 21:30:18 UTC 2021 - Egbert Eich + +- BUILD_BFLOAT16=1 is not supported in s390(x) (bsc#1181522) +- Add: + * 0001-Require-gcc-11-for-builtin_cpu_is-power10.patch + * 0002-patch-to-support-power10-in-builtin_cpu_is-was-backp.patch: + Only gcc11 has builtin_cpu_is(power10) - fix build issue for ppc64 + (bsc#1181522). + ------------------------------------------------------------------- Thu Dec 17 07:12:02 UTC 2020 - Ismail Dönmez diff --git a/openblas.spec b/openblas.spec index 9edaa38..1cd4f6c 100644 --- a/openblas.spec +++ b/openblas.spec @@ -1,7 +1,7 @@ # # spec file for package openblas # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -167,10 +167,14 @@ URL: http://www.openblas.net Source0: https://github.com/xianyi/OpenBLAS/archive/v%{version}.tar.gz#/OpenBLAS-%{version}.tar.gz Source1: README.SUSE Source2: README.HPC.SUSE +# Temporarily - delete with next version update +Patch1: 0001-Require-gcc-11-for-builtin_cpu_is-power10.patch +Patch2: 0002-patch-to-support-power10-in-builtin_cpu_is-was-backp.patch # PATCH-FIX-UPSTREAM openblas-noexecstack.patch -Patch1: openblas-noexecstack.patch +Patch101: openblas-noexecstack.patch # PATCH port -Patch2: openblas-s390.patch +Patch102: openblas-s390.patch +Patch103: openblas-ppc64be_up2_p8.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -282,6 +286,9 @@ This package contains headers for OpenBLAS. %setup -q -n OpenBLAS-%{version} %patch1 -p1 %patch2 -p1 +%patch101 -p1 +%patch102 -p1 +%patch103 -p1 %ifarch s390 sed -i -e "s@m32@m31@" Makefile.system %endif @@ -294,6 +301,11 @@ cp %{SOURCE2} . %build +# disable lto for ppc64le, boo#1181733 +%ifarch ppc64le +%define _lto_cflags %{nil} +%endif + %if %{with hpc} %hpc_debug %hpc_setup_compiler @@ -304,14 +316,20 @@ cp %{SOURCE2} . # We specify TARGET= to avoid compile-time CPU-detection (boo#1100677) %ifarch %ix86 x86_64 %global openblas_target %openblas_target TARGET=CORE2 +%define openblas_opt BUILD_BFLOAT16=1 %endif %ifarch aarch64 %global openblas_target %openblas_target TARGET=ARMV8 +%define openblas_opt BUILD_BFLOAT16=1 %endif %ifarch s390 s390x %global openblas_target %openblas_target TARGET=ZARCH_GENERIC %endif -%ifarch ppc64 ppc64le +%ifarch ppc64le +%global openblas_target %openblas_target TARGET=POWER8 +%define openblas_opt BUILD_BFLOAT16=1 +%endif +%ifarch ppc64 %global openblas_target %openblas_target TARGET=POWER8 %endif # force -mvsx for ppc64 to avoid build failure: @@ -322,7 +340,7 @@ cp %{SOURCE2} . %endif # Make serial, threaded and OpenMP versions make %{?_smp_mflags} %{?openblas_target} %{?build_flags} \ - BUILD_BFLOAT16=1 COMMON_OPT="%{optflags} %{?addopt}" \ + %{?openblas_opt} COMMON_OPT="%{optflags} %{?addopt}" \ NUM_THREADS=%{num_threads} V=1 \ OPENBLAS_LIBRARY_DIR=%{p_libdir} \ OPENBLAS_INCLUDE_DIR=%{hpc_includedir} \