From 0f558761aa2dee1017b4751e4017205e015a9560 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 29 Jun 2022 12:04:12 +0100 Subject: gentoo resync : 29.12.2022 --- sci-libs/openblas/Manifest | 9 +- .../openblas/files/openblas-0.3.20-fix-loong.patch | 178 +++++++++++++++++++++ .../openblas/files/openblas-0.3.20-fix-riscv.patch | 17 -- sci-libs/openblas/openblas-0.3.18.ebuild | 4 +- sci-libs/openblas/openblas-0.3.19.ebuild | 4 +- sci-libs/openblas/openblas-0.3.20.ebuild | 7 +- 6 files changed, 194 insertions(+), 25 deletions(-) create mode 100644 sci-libs/openblas/files/openblas-0.3.20-fix-loong.patch (limited to 'sci-libs/openblas') diff --git a/sci-libs/openblas/Manifest b/sci-libs/openblas/Manifest index b2968054a629..333d1056cb60 100644 --- a/sci-libs/openblas/Manifest +++ b/sci-libs/openblas/Manifest @@ -1,9 +1,10 @@ AUX openblas-0.3.12-shared-blas-lapack.patch 2008 BLAKE2B 2d3a4a90d8144cbf149b7711b67364176a94287f26448930b5a4fd29fe761fb250e9007c580fb1ffa8148c477e2f4057f9cd8d7aa07efeb85caa842802d358fd SHA512 3f0d4b480549565c838eba6371e0990c162f56a226f9d26e1639e012ae3f39809f8c6badcf8fdfbb1258f45367dbaff9c4c611b8b44bac27d341aea954f0133e -AUX openblas-0.3.20-fix-riscv.patch 4366 BLAKE2B bc1fb4c9e5445e208c6bc5ba9ffd7da6ed482c5e5f6e37de32bfff20fe777a1ba542dbb66db25429a3434ee5341bdf21ca999477d195c5663c69c0d711ab067f SHA512 b24555203b5514f1ceb13b69c671a8004def1f60746474b5677ffdfad2b8c556d574bc121ecfadf4c585ad21f6874bee3438676cf19a841828e70128d8df5ebe +AUX openblas-0.3.20-fix-loong.patch 5694 BLAKE2B 0d4eb185ead0a47855e411670816aaf52e22530160cc2b29c7eca8a077d7bfb49a501d154c7492a259287efbd6dd24496f53d91cb834a97b2fec441d3dd06cf1 SHA512 1e90165549bc0a441003cf7bc0b1fa3e2af6eaaaad92ab5aca0d3f9569976184cbe653a049c26e81f016cf66152ac9903f619a990f54613fe3f091eb94fd742f +AUX openblas-0.3.20-fix-riscv.patch 3786 BLAKE2B 5ba65c1f44aa8cd8f1b88458dfe16ef32bfd92260bed2b3b60596a16c9778a94b7c03752f41ad649ba1742c72b7528768fa51fcf30639c2bc0064ad132b0d747 SHA512 aec236b9d6fa9c80cef6401cf43e594cb17c73137cfcc17286046d8d85bb6a5bb6367b808a8b85152313cb596919de0173812832037ba88e4e39b722e4a8d2e1 DIST openblas-0.3.18.tar.gz 12619822 BLAKE2B 38a5e7b861eb0063a4494c1cfb6f7f5723741437ecdd5cb1fb42645eb73bceb472b3a8c11eec3d0ba4f676981ac89de4ff1ee0d7ea42d1e234746f34ce8fb6b8 SHA512 df9a14026a61bdc5285636bfd7a52dce244d24fcf4a0c870ef4e58b8b50e412849828ca5aeac2a2435f635e78e60559762e8bae22ea7bc5dff2e865a96d81152 DIST openblas-0.3.19.tar.gz 12706050 BLAKE2B c29aa27faaf18e3330087f8d2ebed733f53878266d6865239dfbb1624a113f3cabc988bbfcc18a0aa5d971697bc68bb267795ef24e2d8e0e8d50f802cb817b57 SHA512 1fcbcfefb7744894b0b0c83c6071b342086ca311dc67f5c2745812d61dcc9d31ef7dd5e1215dfb2731ae7197d497dbdf8f8b26a432eb07d41a7db0983eb86a33 DIST openblas-0.3.20.tar.gz 12742441 BLAKE2B 9ae808e2a7da39e28dbe26c7feb5da3c70275f3b48bd68455c22e3b16fc1f2d10b9d84c9593acff2c837fc1514f21f2bbc0e87708075c5fe13514d0d47cf0b5a SHA512 0742d40b74b11b781021280fd627fa5798e6856b49f2ba1111a5927aac1a7823bcb8162187555f4cf3a4dd7eadf5b1f2a4685c0b5e189847b2869166d1bc7391 -EBUILD openblas-0.3.18.ebuild 5681 BLAKE2B 49f6b69e5f76fd8139792c985587ab8ff9745a443c2cb2917b94d8ccdc808f1e96064ad2c022a6a38f174777ea40c4abe6c30584721278687806ab19535a44f0 SHA512 49a892293df5d3b521d9a6d385c646be61a20f748f373c32e5ddf9645a6d2d73cd8b726c80d776bc1ab98b3bbef64294013aa0e3b855fee57dcadc305fffdc4f -EBUILD openblas-0.3.19.ebuild 5681 BLAKE2B 49f6b69e5f76fd8139792c985587ab8ff9745a443c2cb2917b94d8ccdc808f1e96064ad2c022a6a38f174777ea40c4abe6c30584721278687806ab19535a44f0 SHA512 49a892293df5d3b521d9a6d385c646be61a20f748f373c32e5ddf9645a6d2d73cd8b726c80d776bc1ab98b3bbef64294013aa0e3b855fee57dcadc305fffdc4f -EBUILD openblas-0.3.20.ebuild 5733 BLAKE2B 5ec06e96b7a7d2ac7d8cf695380373cc72f041467e3db7af95b89d5102370175e6751b0b78177c80885c453e31b0e1bcc54d6f58c62a2aeb682001c7dc8be433 SHA512 94e07466dcc89cdae7010bf8c643773d80e4393fd106e1dacdae05d907deebd24f877fe9dfb77601a8b32b1b83105031ebea123107010f1d0db32d110e545c5e +EBUILD openblas-0.3.18.ebuild 5779 BLAKE2B 851a9cb092537a519d15db945762b876d698bbf4bee13cccc1a4fd33daaf22713f36b22c0308340f8355bc0f765661554e1aff4184fbffc0045847972e1ad41d SHA512 0b3cebbd102011506335d5b76becadb5bae701442e3cf3aa13670f775a113c16c998e12d9088ebcff01798e4386fe4c21384d173bf86c29ebc949bc7df5d7f0f +EBUILD openblas-0.3.19.ebuild 5779 BLAKE2B 851a9cb092537a519d15db945762b876d698bbf4bee13cccc1a4fd33daaf22713f36b22c0308340f8355bc0f765661554e1aff4184fbffc0045847972e1ad41d SHA512 0b3cebbd102011506335d5b76becadb5bae701442e3cf3aa13670f775a113c16c998e12d9088ebcff01798e4386fe4c21384d173bf86c29ebc949bc7df5d7f0f +EBUILD openblas-0.3.20.ebuild 5882 BLAKE2B 84a0e9f32f6a529ca73a3385914de515ee6cad9def3d54013f08aeb13a6900c4918e0e383fbe6f5e7979370a643287daf405b2fb94101327219d955a5072af62 SHA512 75298d119f27a89c64fbace665917d54838bb27f7bea5aa6e51713b59c1be872f1c970045890cf6a1dbfdc273488264aa1d2b864d227d1031c8f0a81d207fc4b MISC metadata.xml 1561 BLAKE2B 5ba7ec66dd8ba7ca8bc29bc0193b48b6a82b4949bb79bab461400040667aa66aac3cfd2ad9c7323798048fd43d18ac96a562d53b68f3f7ae8bf8505ac7a04691 SHA512 05272eb56480ff82b240d0f430df3df03981e24b971dbd37c13d464f4f4b334bac19b54915446a09326a334aa76249bb79a4fa389d26150365f21389992f9a48 diff --git a/sci-libs/openblas/files/openblas-0.3.20-fix-loong.patch b/sci-libs/openblas/files/openblas-0.3.20-fix-loong.patch new file mode 100644 index 000000000000..2745d26cb3a5 --- /dev/null +++ b/sci-libs/openblas/files/openblas-0.3.20-fix-loong.patch @@ -0,0 +1,178 @@ +https://github.com/xianyi/OpenBLAS/pull/3626, rebased on top of v0.3.20. + +From: WANG Xuerui +Date: Fri, 13 May 2022 15:26:33 +0800 +Subject: [PATCH 1/3] Move LoongArch make rules to Makefile.loongarch64 + +--- a/Makefile.loongarch64 ++++ b/Makefile.loongarch64 +@@ -1,3 +1,4 @@ +-ifdef BINARY64 +-else ++ifeq ($(CORE), LOONGSON3R5) ++CCOMMON_OPT += -march=loongarch64 -mabi=lp64 ++FCOMMON_OPT += -march=loongarch64 -mabi=lp64 + endif +--- a/Makefile.system ++++ b/Makefile.system +@@ -886,13 +886,6 @@ ifeq ($(OSNAME), AIX) + BINARY_DEFINED = 1 + endif + +-ifeq ($(ARCH), loongarch64) +-ifeq ($(CORE), LOONGSON3R5) +-CCOMMON_OPT += -march=loongarch64 -mabi=lp64 +-FCOMMON_OPT += -march=loongarch64 -mabi=lp64 +-endif +-endif +- + endif + + ifndef BINARY_DEFINED +From: WANG Xuerui +Date: Fri, 13 May 2022 15:53:22 +0800 +Subject: [PATCH 2/3] Probe for old-world LASX flavor on LoongArch and use + generic DGEMM kernel otherwise + +See: https://bugs.gentoo.org/844013 +--- a/Makefile.system ++++ b/Makefile.system +@@ -1683,6 +1683,7 @@ export TARGET_CORE + export NO_AVX512 + export NO_AVX2 + export BUILD_BFLOAT16 ++export NO_LASX + + export SBGEMM_UNROLL_M + export SBGEMM_UNROLL_N +--- a/c_check ++++ b/c_check +@@ -270,6 +270,37 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) { + } + } + ++$no_lasx = 0; ++if (($architecture eq "loongarch64")) { ++ eval "use File::Temp qw(tempfile)"; ++ if ($@){ ++ warn "could not load PERL module File::Temp, so could not check compiler compatibility with the LoongArch LASX extension"; ++ # Assume no LASX, because currently LASX is only present in vendor ++ # toolchains, undocumented nor upstreamed. ++ $no_lasx = 1; ++ } else { ++ # Old-world assembly flavor: LASX registers named "$xrNN", different ++ # from the ISA manual which suggests "$xNN". This is the flavor we ++ # currently support. ++ # ++ # As the LASX ISA manual is not out yet, we cannot predict what the ++ # new-world flavor would look like, so do not probe flavor for now. ++ # The compiler flags are also unsuitable for new-world gcc. ++ ($fh,$tmpf) = tempfile( SUFFIX => '.c' , UNLINK => 1 ); ++ $code = '"xvld $xr0, $a0, 0\n"'; ++ print $fh "int main(void){ __asm__ volatile($code); }\n"; ++ $args = " -march=loongarch64 -mabi=lp64 -mlasx -c -o $tmpf.o $tmpf"; ++ my @cmd = ("$compiler_name $flags $args >/dev/null 2>/dev/null"); ++ system(@cmd) == 0; ++ if ($? != 0) { ++ $no_lasx = 1; ++ } else { ++ $no_lasx = 0; ++ } ++ unlink("$tmpf.o"); ++ } ++} ++ + $c11_atomics = 0; + if ($data =~ /HAVE_C11/) { + eval "use File::Temp qw(tempfile)"; +@@ -393,6 +424,7 @@ print MAKEFILE "HAVE_MSA=1\n" if $have_msa eq 1; + print MAKEFILE "MSA_FLAGS=$msa_flags\n" if $have_msa eq 1; + print MAKEFILE "NO_AVX512=1\n" if $no_avx512 eq 1; + print MAKEFILE "NO_AVX2=1\n" if $no_avx2 eq 1; ++print MAKEFILE "NO_LASX=1\n" if $no_lasx eq 1; + print MAKEFILE "OLDGCC=1\n" if $oldgcc eq 1; + + $os =~ tr/[a-z]/[A-Z]/; +--- a/kernel/loongarch64/KERNEL.LOONGSON3R5 ++++ b/kernel/loongarch64/KERNEL.LOONGSON3R5 +@@ -1,3 +1,7 @@ ++ifeq ($(NO_LASX), 1) ++# No LASX support in compiler, unable to consume the optimized version ++# leave out DGEMMKERNEL to pull in the generic version ++else + DGEMMKERNEL = dgemm_kernel_16x4.S + DGEMMINCOPY = dgemm_ncopy_16.S + DGEMMITCOPY = dgemm_tcopy_16.S +@@ -7,6 +11,7 @@ DGEMMINCOPYOBJ = dgemm_incopy.o + DGEMMITCOPYOBJ = dgemm_itcopy.o + DGEMMONCOPYOBJ = dgemm_oncopy.o + DGEMMOTCOPYOBJ = dgemm_otcopy.o ++endif + + DTRSMKERNEL_LN = ../generic/trsm_kernel_LN.c + DTRSMKERNEL_LT = ../generic/trsm_kernel_LT.c +From: WANG Xuerui +Date: Fri, 13 May 2022 16:23:46 +0800 +Subject: [PATCH 3/3] Fix ABI CFLAGS setting on new-world LoongArch + +See: https://bugs.gentoo.org/844013 +--- a/Makefile.loongarch64 ++++ b/Makefile.loongarch64 +@@ -1,4 +1,13 @@ + ifeq ($(CORE), LOONGSON3R5) +-CCOMMON_OPT += -march=loongarch64 -mabi=lp64 +-FCOMMON_OPT += -march=loongarch64 -mabi=lp64 ++CCOMMON_OPT += -march=loongarch64 ++FCOMMON_OPT += -march=loongarch64 ++ ++ifeq ($(LOONGARCH_CC_FLAVOR), NEW) ++CCOMMON_OPT += -mabi=lp64d ++FCOMMON_OPT += -mabi=lp64d ++endif ++ifeq ($(LOONGARCH_CC_FLAVOR), OLD) ++CCOMMON_OPT += -mabi=lp64 ++FCOMMON_OPT += -mabi=lp64 ++endif + endif +--- a/Makefile.system ++++ b/Makefile.system +@@ -1683,6 +1683,7 @@ export TARGET_CORE + export NO_AVX512 + export NO_AVX2 + export BUILD_BFLOAT16 ++export LOONGARCH_CC_FLAVOR + export NO_LASX + + export SBGEMM_UNROLL_M +--- a/c_check ++++ b/c_check +@@ -270,6 +270,21 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) { + } + } + ++$loongarch_cc_flavor = ""; ++if (($architecture eq "loongarch64")) { ++ # Currently there are only 2 flavors: new-world and old-world. ++ # They differ in ABI names accepted, so check it to avoid creating temp ++ # files. ++ $args = " -mabi=lp64d -E -o - /dev/null"; ++ my @cmd = ("$compiler_name $flags $args >/dev/null 2>/dev/null"); ++ system(@cmd) == 0; ++ if ($? != 0) { ++ $loongarch_cc_flavor = "OLD"; ++ } else { ++ $loongarch_cc_flavor = "NEW"; ++ } ++} ++ + $no_lasx = 0; + if (($architecture eq "loongarch64")) { + eval "use File::Temp qw(tempfile)"; +@@ -424,6 +439,7 @@ print MAKEFILE "HAVE_MSA=1\n" if $have_msa eq 1; + print MAKEFILE "MSA_FLAGS=$msa_flags\n" if $have_msa eq 1; + print MAKEFILE "NO_AVX512=1\n" if $no_avx512 eq 1; + print MAKEFILE "NO_AVX2=1\n" if $no_avx2 eq 1; ++print MAKEFILE "LOONGARCH_CC_FLAVOR=$loongarch_cc_flavor\n" if $architecture eq "loongarch64"; + print MAKEFILE "NO_LASX=1\n" if $no_lasx eq 1; + print MAKEFILE "OLDGCC=1\n" if $oldgcc eq 1; + diff --git a/sci-libs/openblas/files/openblas-0.3.20-fix-riscv.patch b/sci-libs/openblas/files/openblas-0.3.20-fix-riscv.patch index 9a14180cb85d..a386a0b38467 100644 --- a/sci-libs/openblas/files/openblas-0.3.20-fix-riscv.patch +++ b/sci-libs/openblas/files/openblas-0.3.20-fix-riscv.patch @@ -1,7 +1,6 @@ Bug: https://bugs.gentoo.org/837806 From https://github.com/xianyi/OpenBLAS/pull/3613 -From 3fc52ebcfb80e01f753938fd314ca07b2c085767 Mon Sep 17 00:00:00 2001 From: Han Gao Date: Wed, 27 Apr 2022 01:34:55 +0800 Subject: [PATCH 1/2] Fix other arch build in detect. @@ -9,12 +8,6 @@ Subject: [PATCH 1/2] Fix other arch build in detect. When CORE is empty, use -march=loongson3a. Fix it. Signed-off-by: Han Gao ---- - Makefile.system | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.system b/Makefile.system -index ac60eae5b6..1104893b55 100644 --- a/Makefile.system +++ b/Makefile.system @@ -847,7 +847,7 @@ CCOMMON_OPT += -mabi=32 @@ -27,19 +20,11 @@ index ac60eae5b6..1104893b55 100644 FCOMMON_OPT += -march=loongson3a endif -From 8123324c99ba69ce23b4028468313663001a76c6 Mon Sep 17 00:00:00 2001 From: Han Gao Date: Wed, 27 Apr 2022 02:29:43 +0800 Subject: [PATCH 2/2] Fix riscv64 arch detect Signed-off-by: Han Gao ---- - cpuid_riscv64.c | 18 +++++++++--------- - getarch.c | 4 ++-- - 2 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/cpuid_riscv64.c b/cpuid_riscv64.c -index 0eb50e0018..2aa4217816 100644 --- a/cpuid_riscv64.c +++ b/cpuid_riscv64.c @@ -1,5 +1,5 @@ @@ -92,8 +77,6 @@ index 0eb50e0018..2aa4217816 100644 printf("#define L1_DATA_SIZE 65536\n"); printf("#define L1_DATA_LINESIZE 32\n"); printf("#define L2_SIZE 512488\n"); -diff --git a/getarch.c b/getarch.c -index 4af986fb3b..f4590769d9 100644 --- a/getarch.c +++ b/getarch.c @@ -1731,7 +1731,7 @@ int main(int argc, char *argv[]){ diff --git a/sci-libs/openblas/openblas-0.3.18.ebuild b/sci-libs/openblas/openblas-0.3.18.ebuild index 3ac219fa41cf..ec15a244d0b8 100644 --- a/sci-libs/openblas/openblas-0.3.18.ebuild +++ b/sci-libs/openblas/openblas-0.3.18.ebuild @@ -30,6 +30,8 @@ PATCHES=( ) pkg_pretend() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp + elog "This software has a massive number of options that" elog "are configurable and it is *impossible* for all of" elog "those to fit inside any manageable ebuild." @@ -57,7 +59,7 @@ pkg_setup() { export HOSTCC="$(tc-getBUILD_CC)" # threading options - use openmp && tc-check-openmp + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp USE_THREAD=0 if use openmp; then USE_THREAD=1; USE_OPENMP=1; diff --git a/sci-libs/openblas/openblas-0.3.19.ebuild b/sci-libs/openblas/openblas-0.3.19.ebuild index 3ac219fa41cf..ec15a244d0b8 100644 --- a/sci-libs/openblas/openblas-0.3.19.ebuild +++ b/sci-libs/openblas/openblas-0.3.19.ebuild @@ -30,6 +30,8 @@ PATCHES=( ) pkg_pretend() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp + elog "This software has a massive number of options that" elog "are configurable and it is *impossible* for all of" elog "those to fit inside any manageable ebuild." @@ -57,7 +59,7 @@ pkg_setup() { export HOSTCC="$(tc-getBUILD_CC)" # threading options - use openmp && tc-check-openmp + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp USE_THREAD=0 if use openmp; then USE_THREAD=1; USE_OPENMP=1; diff --git a/sci-libs/openblas/openblas-0.3.20.ebuild b/sci-libs/openblas/openblas-0.3.20.ebuild index 5d2349e6998f..01fd54d252c4 100644 --- a/sci-libs/openblas/openblas-0.3.20.ebuild +++ b/sci-libs/openblas/openblas-0.3.20.ebuild @@ -12,7 +12,7 @@ S="${WORKDIR}"/OpenBLAS-${PV} LICENSE="BSD" SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86 ~amd64-linux ~x86-linux ~x64-macos" +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~riscv ~x86 ~amd64-linux ~x86-linux ~x64-macos" IUSE="dynamic eselect-ldso index-64bit openmp pthread relapack test" REQUIRED_USE="?? ( openmp pthread )" RESTRICT="!test? ( test )" @@ -28,9 +28,12 @@ BDEPEND="virtual/pkgconfig" PATCHES=( "${FILESDIR}/${PN}-0.3.12-shared-blas-lapack.patch" "${FILESDIR}/${PN}-0.3.20-fix-riscv.patch" + "${FILESDIR}/${PN}-0.3.20-fix-loong.patch" ) pkg_pretend() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp + elog "This software has a massive number of options that" elog "are configurable and it is *impossible* for all of" elog "those to fit inside any manageable ebuild." @@ -58,7 +61,7 @@ pkg_setup() { export HOSTCC="$(tc-getBUILD_CC)" # threading options - use openmp && tc-check-openmp + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp USE_THREAD=0 if use openmp; then USE_THREAD=1; USE_OPENMP=1; -- cgit v1.2.3