From 3b08f674e3f771b49370edb144dab0958c8cf721 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 31 Aug 2021 08:59:54 +0100 Subject: gentoo resync : 31.08.2021 --- sci-libs/rocBLAS/Manifest | 9 ++ ...ensile-4.3.0-hsaco-compile-specified-arch.patch | 96 ++++++++++++++ .../files/Tensile-4.3.0-output-commands.patch | 23 ++++ ...-4.3.0-change-default-Tensile-library-dir.patch | 39 ++++++ .../rocBLAS-4.3.0-fix-glibc-2.32-and-above.patch | 25 ++++ .../files/rocBLAS-4.3.0-link-system-blas.patch | 24 ++++ sci-libs/rocBLAS/metadata.xml | 19 +++ sci-libs/rocBLAS/rocBLAS-4.3.0.ebuild | 139 +++++++++++++++++++++ 8 files changed, 374 insertions(+) create mode 100644 sci-libs/rocBLAS/Manifest create mode 100644 sci-libs/rocBLAS/files/Tensile-4.3.0-hsaco-compile-specified-arch.patch create mode 100644 sci-libs/rocBLAS/files/Tensile-4.3.0-output-commands.patch create mode 100644 sci-libs/rocBLAS/files/rocBLAS-4.3.0-change-default-Tensile-library-dir.patch create mode 100644 sci-libs/rocBLAS/files/rocBLAS-4.3.0-fix-glibc-2.32-and-above.patch create mode 100644 sci-libs/rocBLAS/files/rocBLAS-4.3.0-link-system-blas.patch create mode 100644 sci-libs/rocBLAS/metadata.xml create mode 100644 sci-libs/rocBLAS/rocBLAS-4.3.0.ebuild (limited to 'sci-libs/rocBLAS') diff --git a/sci-libs/rocBLAS/Manifest b/sci-libs/rocBLAS/Manifest new file mode 100644 index 000000000000..2d0d9ddcedeb --- /dev/null +++ b/sci-libs/rocBLAS/Manifest @@ -0,0 +1,9 @@ +AUX Tensile-4.3.0-hsaco-compile-specified-arch.patch 3859 BLAKE2B 4590978cff0fdb0501ba2405615775cb3f8900ce164c3d57cc59dfe82e1adc25376b6463855a045f5e0652cc985b0015566b95ff28327c59f2db875a84cb49b3 SHA512 57520f1d46f46c7cfd5b8c3ae307da07695c19479b687ce994ad9fba2e755ed7c776c3d8bee8e0642c7613a5d53d8469f329b1eb07563c13d2f7bda8b3d36687 +AUX Tensile-4.3.0-output-commands.patch 1629 BLAKE2B c43395d8e8aeb956d5eb84c8a34ad4b995ed32499ceababeb22d5ca3ac5ee6e8ef353a1467a77943a441f0840b9a6ad1f53202ec8673ef3753aa2bec1395fec4 SHA512 45bdae1d87f6e31d337b22f146b9dee25f4f87357c6ac52bd843556dd742431db10efb55fb8ef815cc9941b5b9f05970d43a6fec0f2d9195c30c633e33d138bf +AUX rocBLAS-4.3.0-change-default-Tensile-library-dir.patch 1533 BLAKE2B d6b48397b1df8da0325590b79fdd351bf7db39fee662dc8809da03cff1715f5b952b7dbebb6889a08ca8b67067ca0626fc6350a825433eaf1e4747eee5f8d70e SHA512 318a00649aa80771722c1128b619320d03fd66fd9375f065e2c2f69cc2353261fa104fb1a5d0991490c92cb9e3a0c78b4232764e43d262f83738663621560f8f +AUX rocBLAS-4.3.0-fix-glibc-2.32-and-above.patch 1254 BLAKE2B d3bcf526f374065ed0615c89ab74cbc203d2d6b6d0a1c49072f3328aaa40aa52f0fa155b23a936a865d353db32f48f348a64f05f157eb6bb2d55c93f9da364d1 SHA512 e899b26e3dc4717cb7854c16d104b9e070067f49e308fe6a38f1be5735a83a814da46ab41752cf4431b4c378d29f31c6082e1fe63e1bf5ae72a55b54a9017c15 +AUX rocBLAS-4.3.0-link-system-blas.patch 1106 BLAKE2B 83f525072dc34edec01c56353d8c87f0f967c9cf07d054da8c1f4af632e095cd2af9562dea8eab8a2ddc7a71a9570e654b4a6b0f68c95508e92cc743350c8129 SHA512 94efab3d507fc90bd0d0b2cd0096e68b7669d1de2faf73fe0bfbc8c26c83db88596664bd61f394863194ad3108985b6206c4408c6d2ec93cd30ccec13b3b37f1 +DIST rocm-Tensile-4.3.0.tar.gz 14250149 BLAKE2B 030138eaca2a0aadd96801e6dbd72e510716dd90553ef3795c5e04e00a34a05ecae82b24f755e4033a4acfcdb1cf26291da1e7902bb090f89a010d403e832beb SHA512 126db0b413c716fba8d5be9bff7a44fd1badacbf32f3db8d0db649819177db37ebd56fd22dd3c809655f5d29675be115e698cd10bc3d0b4b23878ae3726fce47 +DIST rocm-rocBLAS-4.3.0.tar.gz 11569970 BLAKE2B f11b0acf2bbd5737b036142d3b2cc1e18c38e088a8b7db58156d478dd6718befbb82bb7fd43a38fe64a5427124c5ad5241fa37977f094e6efd195d168d3e5f65 SHA512 490ab1c1e98a8b311ad5630515c448d9bb0a2bf588a08bcbebee345e2954d616b4ffe7c2e03dadca82c590438c42afccb98fe8ba00856aece101b5ffe62ef1e0 +EBUILD rocBLAS-4.3.0.ebuild 4140 BLAKE2B ea0a89cf0ecb6429874400661c1b43ce351b12f652b3d2880be9d8a79cd0c50dee2b0beba44fc50d6ab2f5e2da2262d3b4d8f9fe9ca7d8ca326f894f4a901c0c SHA512 ef6f442920694b5d250b2d548e49c891339b4c89802d2ea377bbcd42ac7b306753d154cae638878b03face948fafacaadc5dbb603f19fe94ca61a59dd233e80f +MISC metadata.xml 653 BLAKE2B b64c73fae3f09612e75407ca7d54fd2fb0a6d90bb9697623ae774f652fe0b06c4f74bf6b9fd4b2acf5f1e5e661ffdbf09b7c3f44e011adb4cd9d92e168ab64b0 SHA512 007d91b1ff3743757940b38feca5c0333d4e92325fafe02a0de8fb3230f39fe3dd295168f45822098c6e1a64e8a99fd6b6a98402a7a8c8d5e8f700881d37db26 diff --git a/sci-libs/rocBLAS/files/Tensile-4.3.0-hsaco-compile-specified-arch.patch b/sci-libs/rocBLAS/files/Tensile-4.3.0-hsaco-compile-specified-arch.patch new file mode 100644 index 000000000000..8e6753781a2a --- /dev/null +++ b/sci-libs/rocBLAS/files/Tensile-4.3.0-hsaco-compile-specified-arch.patch @@ -0,0 +1,96 @@ +https://github.com/ROCmSoftwarePlatform/Tensile/issues/1395 +https://github.com/ROCmSoftwarePlatform/Tensile/pull/1398 + +--- a/Tensile/TensileCreateLibrary.py ++++ b/Tensile/TensileCreateLibrary.py +@@ -136,6 +136,35 @@ def which(p): + return candidate + return None + ++def splitArchs(): ++ # Helper for architecture ++ def isSupported(arch): ++ return globalParameters["AsmCaps"][arch]["SupportedISA"] and \ ++ globalParameters["AsmCaps"][arch]["SupportedSource"] ++ ++ if ";" in globalParameters["Architecture"]: ++ wantedArchs = globalParameters["Architecture"].split(";") ++ else: ++ wantedArchs = globalParameters["Architecture"].split("_") ++ archs = [] ++ cmdlineArchs = [] ++ if "all" in wantedArchs: ++ for arch in globalParameters['SupportedISA']: ++ if isSupported(arch): ++ if (arch == (9,0,6) or arch == (9,0,8) or arch == (9,0,10)): ++ if (arch == (9,0,10)): ++ archs += [gfxName(arch) + '-xnack+'] ++ cmdlineArchs += [gfxName(arch) + ':xnack+'] ++ archs += [gfxName(arch) + '-xnack-'] ++ cmdlineArchs += [gfxName(arch) + ':xnack-'] ++ else: ++ archs += [gfxName(arch)] ++ cmdlineArchs += [gfxName(arch)] ++ else: ++ for arch in wantedArchs: ++ archs += [re.sub(":", "-", arch)] ++ cmdlineArchs += [arch] ++ return archs, cmdlineArchs + + def buildSourceCodeObjectFile(CxxCompiler, outputPath, kernelFile): + buildPath = ensurePath(os.path.join(globalParameters['WorkingPath'], 'code_object_tmp')) +@@ -149,24 +178,8 @@ def buildSourceCodeObjectFile(CxxCompiler, outputPath, kernelFile): + objectFilename = base + '.o' + soFilename = base + '.so' + +- def isSupported(arch): +- return globalParameters["AsmCaps"][arch]["SupportedISA"] and \ +- globalParameters["AsmCaps"][arch]["SupportedSource"] +- + if (CxxCompiler == "hipcc"): +- archs = [] +- cmdlineArchs = [] +- for arch in globalParameters['SupportedISA']: +- if isSupported(arch): +- if (arch == (9,0,6) or arch == (9,0,8) or arch == (9,0,10)): +- if (arch == (9,0,10)): +- archs += [gfxName(arch) + '-xnack+'] +- cmdlineArchs += [gfxName(arch) + ':xnack+'] +- archs += [gfxName(arch) + '-xnack-'] +- cmdlineArchs += [gfxName(arch) + ':xnack-'] +- else: +- archs += [gfxName(arch)] +- cmdlineArchs += [gfxName(arch)] ++ archs, cmdlineArchs = splitArchs() + + archFlags = ['--offload-arch=' + arch for arch in cmdlineArchs] + +@@ -1063,11 +1076,6 @@ def buildObjectFileNames(solutionWriter, kernelWriterSource, kernelWriterAssembl + sourceKernels = list([k for k in kernels if k['KernelLanguage'] == 'Source']) + asmKernels = list([k for k in kernels if k['KernelLanguage'] == 'Assembly']) + +- # Helper for architecture +- def isSupported(arch): +- return globalParameters["AsmCaps"][arch]["SupportedISA"] and \ +- globalParameters["AsmCaps"][arch]["SupportedSource"] +- + # Build a list of kernel object names. + for kernel in sourceKernels: + sourceKernelNames += [kernelWriterSource.getKernelFileBase(kernel)] +@@ -1081,15 +1089,7 @@ def buildObjectFileNames(solutionWriter, kernelWriterSource, kernelWriterAssembl + + # Source based kernels are built for all supported architectures + if (cxxCompiler == 'hipcc'): +- sourceArchs = [] +- for arch in globalParameters['SupportedISA']: +- if isSupported(arch): +- if (arch == (9,0,6) or arch == (9,0,8) or arch == (9,0,10)): +- if (arch == (9,0,10)): +- sourceArchs += [gfxName(arch) + '-xnack+'] +- sourceArchs += [gfxName(arch) + '-xnack-'] +- else: +- sourceArchs += [gfxName(arch)] ++ sourceArchs, _ = splitArchs() + else: + raise RuntimeError("Unknown compiler %s" % cxxCompiler) + diff --git a/sci-libs/rocBLAS/files/Tensile-4.3.0-output-commands.patch b/sci-libs/rocBLAS/files/Tensile-4.3.0-output-commands.patch new file mode 100644 index 000000000000..be5a4db21429 --- /dev/null +++ b/sci-libs/rocBLAS/files/Tensile-4.3.0-output-commands.patch @@ -0,0 +1,23 @@ +diff --color -uprN orig/Tensile/cmake/TensileConfig.cmake Tensile-rocm-4.3.0/Tensile/cmake/TensileConfig.cmake +--- orig/Tensile/cmake/TensileConfig.cmake 2021-08-18 17:48:00.115478470 +0800 ++++ Tensile-rocm-4.3.0/Tensile/cmake/TensileConfig.cmake 2021-08-18 17:48:49.963478801 +0800 +@@ -234,6 +234,7 @@ function(TensileCreateLibraryFiles + COMMENT "Generating Tensile Libraries" + OUTPUT ${Tensile_EMBED_LIBRARY_SOURCE};${Tensile_MANIFEST_CONTENTS} + COMMAND ${CommandLine} ++ USES_TERMINAL + ) + + set("${Tensile_VAR_PREFIX}_ALL_FILES" ${Tensile_MANIFEST_CONTENTS} PARENT_SCOPE) +diff --color -uprN orig/Tensile/Common.py Tensile-rocm-4.3.0/Tensile/Common.py +--- orig/Tensile/Common.py 2021-08-18 17:48:00.075478470 +0800 ++++ Tensile-rocm-4.3.0/Tensile/Common.py 2021-08-18 17:48:23.287478624 +0800 +@@ -179,7 +179,7 @@ globalParameters["PrintTensorD"] = 0 + globalParameters["PrintTensorRef"] = 0 # Print reference tensor. 0x1=after init; 0x2=after copy-back; 0x3=both + globalParameters["PrintIndexAssignments"] = 0 # Print the tensor index assignment info + globalParameters["PrintWinnersOnly"] = False # Only print the solutions which become the fastest +-globalParameters["PrintCodeCommands"] = False # print the commands used to generate the code objects (asm,link,hip-clang, etc) ++globalParameters["PrintCodeCommands"] = True # print the commands used to generate the code objects (asm,link,hip-clang, etc) + globalParameters["DumpTensors"] = False # If True, dump tensors to binary files instead of printing them. + + # TODO - remove this when NewClient is mainstream diff --git a/sci-libs/rocBLAS/files/rocBLAS-4.3.0-change-default-Tensile-library-dir.patch b/sci-libs/rocBLAS/files/rocBLAS-4.3.0-change-default-Tensile-library-dir.patch new file mode 100644 index 000000000000..1841424c6e56 --- /dev/null +++ b/sci-libs/rocBLAS/files/rocBLAS-4.3.0-change-default-Tensile-library-dir.patch @@ -0,0 +1,39 @@ +change the default rocm tensile library search path +--- orig/library/src/tensile_host.cpp 2021-08-21 17:56:47.040481580 +0800 ++++ rocBLAS-rocm-4.3.0/library/src/tensile_host.cpp 2021-08-21 17:58:46.360482372 +0800 +@@ -489,34 +489,7 @@ namespace + } + else + { +-#ifndef ROCBLAS_STATIC_LIB +- Dl_info info; +- +- // Find the location of librocblas.so +- // Fall back on hard-coded path if static library or not found +- // [Use a C API (rocblas_sccal) *not* defined in this file to +- // avoid compile-time resolution of the function pointer; cf. +- // https://man7.org/linux/man-pages/man3/dladdr.3.html "BUGS"] +- +- if(dladdr((void*)rocblas_sscal, &info)) +- { +- path = info.dli_fname; +- path = std::string{dirname(&path[0])}; +- } +- else +-#endif +- { +- path = "/opt/rocm/rocblas/lib"; +- } +- +- // Find the location of the libraries +- if(TestPath(path + "/../../Tensile/library")) +- path += "/../../Tensile/library"; +- else +- path += "/library"; +- +- if(TestPath(path + "/" + processor)) +- path += "/" + processor; ++ path="@GENTOO_PORTAGE_EPREFIX@/usr/lib64/rocblas/library"; + } + + // only load modules for the current architecture diff --git a/sci-libs/rocBLAS/files/rocBLAS-4.3.0-fix-glibc-2.32-and-above.patch b/sci-libs/rocBLAS/files/rocBLAS-4.3.0-fix-glibc-2.32-and-above.patch new file mode 100644 index 000000000000..a4d9f0bab344 --- /dev/null +++ b/sci-libs/rocBLAS/files/rocBLAS-4.3.0-fix-glibc-2.32-and-above.patch @@ -0,0 +1,25 @@ +https://sourceware.org/glibc/wiki/Release/2.32#Deprectation_sys_siglist.2C__sys_siglist.2C_sys_sigabbrev + +--- rocBLAS-rocm-4.1.0/clients/gtest/rocblas_test.cpp ++++ rocBLAS-rocm-4.1.0/clients/gtest/rocblas_test.cpp +@@ -173,7 +173,7 @@ void catch_signals_and_exceptions_as_fai + // Set up the return point, and handle siglongjmp returning back to here + if(sigsetjmp(t_handler.sigjmp_buf, true)) + { +- FAIL() << "Received " << sys_siglist[t_handler.signal] << " signal"; ++ FAIL() << "Received " << strsignal(t_handler.signal) << " signal"; + } + else + { + +--- rocBLAS-rocm-4.1.0/clients/include/utility.hpp ++++ rocBLAS-rocm-4.1.0/clients/include/utility.hpp +@@ -39,7 +39,7 @@ + // puts, putchar, fputs, printf, fprintf, vprintf, vfprintf: Use rocblas_cout or rocblas_cerr + // sprintf, vsprintf: Possible buffer overflows; us snprintf or vsnprintf instead + // strerror: Thread-unsafe; use snprintf / dprintf with %m or strerror_* alternatives +-// strsignal: Thread-unsafe; use sys_siglist[signal] instead ++// strsignal: Thread-unsafe; use strsignal(signal) instead + // strtok: Thread-unsafe; use strtok_r + // gmtime, ctime, asctime, localtime: Thread-unsafe + // tmpnam: Thread-unsafe; use mkstemp or related functions instead diff --git a/sci-libs/rocBLAS/files/rocBLAS-4.3.0-link-system-blas.patch b/sci-libs/rocBLAS/files/rocBLAS-4.3.0-link-system-blas.patch new file mode 100644 index 000000000000..184b76d7ef38 --- /dev/null +++ b/sci-libs/rocBLAS/files/rocBLAS-4.3.0-link-system-blas.patch @@ -0,0 +1,24 @@ +Link system blas libraries rather than the downloaded libraries (in install.sh) + +--- orig/clients/benchmarks/CMakeLists.txt ++++ rocBLAS-rocm-4.2.0/clients/benchmarks/CMakeLists.txt +@@ -49,7 +49,7 @@ target_include_directories( rocblas-benc + $ + ) + +-target_link_libraries( rocblas-bench PRIVATE rocblas_fortran_client roc::rocblas lapack cblas ) ++target_link_libraries( rocblas-bench PRIVATE rocblas_fortran_client roc::rocblas lapack cblas -lblas ) + if(LINK_BLIS) + target_link_libraries( rocblas-bench PRIVATE ${BLIS_LIBRARY} ) + endif() +--- orig/clients/gtest/CMakeLists.txt ++++ rocBLAS-rocm-4.2.0/clients/gtest/CMakeLists.txt +@@ -129,7 +129,7 @@ target_include_directories( rocblas-test + $ + ) + +-target_link_libraries( rocblas-test PRIVATE rocblas_fortran_client roc::rocblas lapack cblas ${GTEST_LIBRARIES} ) ++target_link_libraries( rocblas-test PRIVATE rocblas_fortran_client roc::rocblas lapack cblas -lblas ${GTEST_LIBRARIES} ) + if(LINK_BLIS) + target_link_libraries( rocblas-test PRIVATE ${BLIS_LIBRARY} ) + endif() diff --git a/sci-libs/rocBLAS/metadata.xml b/sci-libs/rocBLAS/metadata.xml new file mode 100644 index 000000000000..44cdde5646e8 --- /dev/null +++ b/sci-libs/rocBLAS/metadata.xml @@ -0,0 +1,19 @@ + + + + + sci@gentoo.org + + + gentoo@holzke.net + Wilfried Holzke + + + xgreenlandforwyy@gmail.com + Yiyang Wu + + + Perform rocblas-test to compare the result between rocBLAS and system BLAS. + Build and install rocblas-bench. + + diff --git a/sci-libs/rocBLAS/rocBLAS-4.3.0.ebuild b/sci-libs/rocBLAS/rocBLAS-4.3.0.ebuild new file mode 100644 index 000000000000..4e05309d0c48 --- /dev/null +++ b/sci-libs/rocBLAS/rocBLAS-4.3.0.ebuild @@ -0,0 +1,139 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6..9} ) + +inherit cmake prefix python-any-r1 + +DESCRIPTION="AMD's library for BLAS on ROCm." +HOMEPAGE="https://github.com/ROCmSoftwarePlatform/rocBLAS" +SRC_URI="https://github.com/ROCmSoftwarePlatform/rocBLAS/archive/rocm-${PV}.tar.gz -> rocm-${P}.tar.gz + https://github.com/ROCmSoftwarePlatform/Tensile/archive/rocm-${PV}.tar.gz -> rocm-Tensile-${PV}.tar.gz" + +LICENSE="MIT" +KEYWORDS="~amd64" +IUSE="benchmark test" +SLOT="0/$(ver_cut 1-2)" + +BDEPEND=" + dev-util/rocm-cmake + !dev-util/Tensile + $(python_gen_any_dep ' + dev-python/msgpack[${PYTHON_USEDEP}] + dev-python/pyyaml[${PYTHON_USEDEP}] + ') +" + +DEPEND=" + dev-util/hip:${SLOT} + dev-libs/msgpack + test? ( virtual/blas + dev-cpp/gtest + sys-libs/libomp ) + benchmark? ( virtual/blas + sys-libs/libomp ) +" +RESTRICT="!test? ( test )" + +python_check_deps() { + has_version "dev-python/pyyaml[${PYTHON_USEDEP}]" && + has_version "dev-python/msgpack[${PYTHON_USEDEP}]" +} + +S="${WORKDIR}"/${PN}-rocm-${PV} + +PATCHES=("${FILESDIR}"/${PN}-4.3.0-fix-glibc-2.32-and-above.patch + "${FILESDIR}"/${PN}-4.3.0-change-default-Tensile-library-dir.patch + "${FILESDIR}"/${PN}-4.3.0-link-system-blas.patch ) + +src_prepare() { + eapply_user + + pushd "${WORKDIR}"/Tensile-rocm-${PV} || die + eapply "${FILESDIR}/Tensile-${PV}-hsaco-compile-specified-arch.patch" # backported from upstream, should remove after 4.3.0 + eapply "${FILESDIR}/Tensile-4.3.0-output-commands.patch" + popd || die + + # Fit for Gentoo FHS rule + sed -e "/PREFIX rocblas/d" \ + -e "/