diff options
author | YiyangWu <xgreenlandforwyy@gmail.com> | 2022-02-21 23:03:56 +0800 |
---|---|---|
committer | Benda Xu <heroxbd@gentoo.org> | 2022-03-27 11:12:51 +0800 |
commit | f1dcb1e8ba4936959138ccf747400d0d54d87b26 (patch) | |
tree | 9591970366528da7d5372ce2c471021f0fcbd667 /sci-libs | |
parent | dev-util/Tensile: bump version to 5.0.2 (diff) | |
download | gentoo-f1dcb1e8ba4936959138ccf747400d0d54d87b26.tar.gz gentoo-f1dcb1e8ba4936959138ccf747400d0d54d87b26.tar.bz2 gentoo-f1dcb1e8ba4936959138ccf747400d0d54d87b26.zip |
sci-libs/rocBLAS: bump version to 5.0.2
Enable nai22 chips (Radeon RX 6700/6700 XT / 6800M, gfx1031)
fix test issue when PORTAGE_USERNAME is not portage:
"[: too many arguments"
Closes: https://bugs.gentoo.org/834672
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
Signed-off-by: Benda Xu <heroxbd@gentoo.org>
Diffstat (limited to 'sci-libs')
5 files changed, 259 insertions, 0 deletions
diff --git a/sci-libs/rocBLAS/Manifest b/sci-libs/rocBLAS/Manifest index 00865310a02d..e8bb583d38a1 100644 --- a/sci-libs/rocBLAS/Manifest +++ b/sci-libs/rocBLAS/Manifest @@ -1,2 +1,4 @@ +DIST rocBLAS-5.0.2-Tensile-asm_full-navi22.tar.gz 1110323 BLAKE2B 80fab97c6f89fccf1f8829ad41baf15ad31bbbb313b48825841834c7ec1b9f8ece794aebdf9fda42b54a38f642beb1bc1e374f2f3b4e43d8ba9dfd1eb6e3ece5 SHA512 8f6946cf9d68afd195640ae7e0da8dc33341c67f28813813b5361a56531fa2af4453d075703ea52c66d93a1936cf74688b86aa2fa62b52a7ed5f03272290c232 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 +DIST rocm-rocBLAS-5.0.2.tar.gz 13295178 BLAKE2B e1abfa06b9ac1545732465857839dae3f3708af49439a306a2b5b1b1b392101c38c95815f2c05a0d9ed29d41b154bc2e16a4f9203a37f5e2f68ee12cc4b44a06 SHA512 2f4a74f49350ede0debcf32229a6b6b95505615723c3f2bee16e4c169a3bb966dfb1971819028f47c525f571bea5662b892e63f655b0d1d2b8f20746bc5fe770 diff --git a/sci-libs/rocBLAS/files/rocBLAS-5.0.2-change-default-Tensile-library-dir.patch b/sci-libs/rocBLAS/files/rocBLAS-5.0.2-change-default-Tensile-library-dir.patch new file mode 100644 index 000000000000..618847b8fb8d --- /dev/null +++ b/sci-libs/rocBLAS/files/rocBLAS-5.0.2-change-default-Tensile-library-dir.patch @@ -0,0 +1,47 @@ +change the default rocm tensile library search path +Index: rocBLAS-rocm-5.0.1/library/src/tensile_host.cpp +=================================================================== +--- rocBLAS-rocm-5.0.1.orig/library/src/tensile_host.cpp ++++ rocBLAS-rocm-5.0.1/library/src/tensile_host.cpp +@@ -558,40 +558,8 @@ namespace + // Find the location of librocblas.dll/.so + // Fall back on hard-coded path if static library or not found + +-#ifndef ROCBLAS_STATIC_LIB +-#ifdef WIN32 +- // wchar_t wpath[MAX_PATH + 1] = {0}; +- // if(GetModuleFileNameW(GetModuleHandle("rocblas.dll"), wpath, MAX_PATH + 1)) +- // { +- // std::wstring wspath(wpath); +- // std::string tmp(wspath.begin(), wspath.end()); + +- std::vector<TCHAR> dll_path(MAX_PATH + 1); +- if(GetModuleFileNameA( +- GetModuleHandleA("rocblas.dll"), dll_path.data(), MAX_PATH + 1)) +- { +- std::string tmp(dll_path.begin(), dll_path.end()); +- std::filesystem::path exepath = tmp; +- if(exepath.has_filename()) +- { +- path = exepath.remove_filename().string(); +- } +- } +-#else +- dl_iterate_phdr(rocblas_dl_iterate_phdr_callback, NULL); +- if(rocblas_so_path.size()) +- path = std::string{dirname(&rocblas_so_path[0])}; +-#endif +-#endif // ifndef ROCBLAS_STATIC_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-5.0.2-cpp_lib_filesystem.patch b/sci-libs/rocBLAS/files/rocBLAS-5.0.2-cpp_lib_filesystem.patch new file mode 100644 index 000000000000..500abbacfdc2 --- /dev/null +++ b/sci-libs/rocBLAS/files/rocBLAS-5.0.2-cpp_lib_filesystem.patch @@ -0,0 +1,50 @@ +--- b/clients/common/utility.cpp 2022-01-26 03:31:42.000000000 +0800 ++++ a/clients/common/utility.cpp 2022-02-22 18:45:35.319732953 +0800 +@@ -23,6 +23,7 @@ + #include <fcntl.h> + #endif + ++#include <version> + #ifdef __cpp_lib_filesystem + #include <filesystem> + #else +--- b/clients/include/rocblas_data.hpp 2022-01-26 03:31:42.000000000 +0800 ++++ a/clients/include/rocblas_data.hpp 2022-02-22 18:44:51.275733070 +0800 +@@ -17,6 +17,7 @@ + #include <string> + #include <utility> + ++#include<version> + #ifdef __cpp_lib_filesystem + #include <filesystem> + #else +--- b/clients/include/singletons.hpp 2022-01-26 03:31:42.000000000 +0800 ++++ a/clients/include/singletons.hpp 2022-02-22 18:47:55.139732583 +0800 +@@ -3,6 +3,6 @@ + * ************************************************************************ */ + + // global for device memory padding see d_vector.hpp ++#include<cstddef> +- + extern size_t g_DVEC_PAD; + void d_vector_set_pad_length(size_t pad); +--- b/clients/include/testing_logging.hpp 2022-01-26 03:31:42.000000000 +0800 ++++ a/clients/include/testing_logging.hpp 2022-02-22 18:44:13.115733171 +0800 +@@ -22,6 +22,7 @@ + #include <unistd.h> + #endif + ++#include<version> + #ifdef __cpp_lib_filesystem + #include <filesystem> + #else +--- b/clients/include/testing_ostream_threadsafety.hpp 2022-01-26 03:31:42.000000000 +0800 ++++ a/clients/include/testing_ostream_threadsafety.hpp 2022-02-22 18:45:19.055732996 +0800 +@@ -30,6 +30,7 @@ + #include <sys/types.h> + #endif + ++#include <version> + #ifdef __cpp_lib_filesystem + #include <filesystem> + #else diff --git a/sci-libs/rocBLAS/files/rocBLAS-5.0.2-unbundle-Tensile.patch b/sci-libs/rocBLAS/files/rocBLAS-5.0.2-unbundle-Tensile.patch new file mode 100644 index 000000000000..75f673f63d47 --- /dev/null +++ b/sci-libs/rocBLAS/files/rocBLAS-5.0.2-unbundle-Tensile.patch @@ -0,0 +1,25 @@ +Index: rocBLAS-rocm-5.0.2/CMakeLists.txt +=================================================================== +--- rocBLAS-rocm-5.0.2.orig/CMakeLists.txt ++++ rocBLAS-rocm-5.0.2/CMakeLists.txt +@@ -271,20 +271,6 @@ if(NOT SKIP_LIBRARY) + set( Tensile_ROOT "${CMAKE_BINARY_DIR}/virtualenv/Lib/site-packages/Tensile" ) + endif() + +- include(virtualenv) +- if (Tensile_TEST_LOCAL_PATH) +- virtualenv_install(${Tensile_TEST_LOCAL_PATH}) +- message (STATUS "using local Tensile from ${Tensile_TEST_LOCAL_PATH}, copied to ${Tensile_ROOT}") +- else() +- # Use the virtual-env setup and download package from specified repot: +- set( tensile_fork "ROCmSoftwarePlatform" CACHE STRING "Tensile fork to use" ) +- file (STRINGS "tensile_tag.txt" read_tensile_tag) +- set( tensile_tag ${read_tensile_tag} CACHE STRING "Tensile tag to download" ) +- virtualenv_install("git+https://github.com/${tensile_fork}/Tensile.git@${tensile_tag}") +- message (STATUS "using GIT Tensile fork=${tensile_fork} from branch=${tensile_tag}") +- endif() +- message(STATUS "Adding ${VIRTUALENV_HOME_DIR} to CMAKE_PREFIX_PATH") +- list(APPEND CMAKE_PREFIX_PATH ${VIRTUALENV_HOME_DIR}) + if (TENSILE_VERSION) + find_package(Tensile ${TENSILE_VERSION} EXACT REQUIRED HIP LLVM OpenMP PATHS "${INSTALLED_TENSILE_PATH}") + else() diff --git a/sci-libs/rocBLAS/rocBLAS-5.0.2.ebuild b/sci-libs/rocBLAS/rocBLAS-5.0.2.ebuild new file mode 100644 index 000000000000..0600f90bac37 --- /dev/null +++ b/sci-libs/rocBLAS/rocBLAS-5.0.2.ebuild @@ -0,0 +1,135 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DOCS_BUILDER="doxygen" +DOCS_DIR="docs" +DOCS_DEPEND="media-gfx/graphviz" +inherit cmake docs prefix + +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://media.githubusercontent.com/media/littlewu2508/littlewu2508.github.io/main/gentoo-distfiles/${P}-Tensile-asm_full-navi22.tar.gz" +S="${WORKDIR}/${PN}-rocm-${PV}" + +LICENSE="BSD" +KEYWORDS="~amd64" +SLOT="0/$(ver_cut 1-2)" +IUSE="benchmark test" +RESTRICT="!test? ( test )" + +BDEPEND=" + dev-util/rocm-cmake:${SLOT} + dev-util/Tensile:${SLOT} +" + +DEPEND=" + dev-util/hip:${SLOT} + dev-libs/msgpack + test? ( + virtual/blas + dev-cpp/gtest + sys-libs/libomp + ) + benchmark? ( + virtual/blas + sys-libs/libomp + ) +" + +PATCHES=( + "${FILESDIR}"/${PN}-4.3.0-fix-glibc-2.32-and-above.patch + "${FILESDIR}"/${PN}-5.0.2-change-default-Tensile-library-dir.patch + "${FILESDIR}"/${PN}-5.0.2-cpp_lib_filesystem.patch + "${FILESDIR}"/${PN}-5.0.2-unbundle-Tensile.patch + ) + +src_prepare() { + cmake_src_prepare + cp -a "${WORKDIR}/asm_full/" library/src/blas3/Tensile/Logic/ || die + # Fit for Gentoo FHS rule + sed -e "/PREFIX rocblas/d" \ + -e "/<INSTALL_INTERFACE/s:include:include/rocblas:" \ + -e "s:rocblas/include:include/rocblas:" \ + -e "s:\\\\\${CPACK_PACKAGING_INSTALL_PREFIX}rocblas/lib:${EPREFIX}/usr/$(get_libdir)/rocblas:" \ + -e "s:share/doc/rocBLAS:share/doc/${P}:" \ + -e "/rocm_install_symlink_subdir( rocblas )/d" -i library/src/CMakeLists.txt || die + + sed -e "s:,-rpath=.*\":\":" -i clients/CMakeLists.txt || die + + eprefixify library/src/tensile_host.cpp +} + +src_configure() { + # allow acces to hardware + addpredict /dev/kfd + addpredict /dev/dri/ + addpredict /dev/random + + export PATH="${EPREFIX}/usr/lib/llvm/roc/bin:${PATH}" + + local mycmakeargs=( + -DTensile_LOGIC="asm_full" + -DTensile_COMPILER="hipcc" + -DTensile_LIBRARY_FORMAT="msgpack" + -DTensile_CODE_OBJECT_VERSION="V3" + -DTensile_TEST_LOCAL_PATH="${EPREFIX}/usr/share/Tensile" + -DTensile_ROOT="${EPREFIX}/usr/share/Tensile" + -DBUILD_WITH_TENSILE=ON + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" + -DCMAKE_INSTALL_INCLUDEDIR="include/rocblas" + -DCMAKE_SKIP_RPATH=TRUE + -DBUILD_TESTING=OFF + -DBUILD_CLIENTS_SAMPLES=OFF + -DBUILD_CLIENTS_TESTS=$(usex test ON OFF) + -DBUILD_CLIENTS_BENCHMARKS=$(usex benchmark ON OFF) + ${AMDGPU_TARGETS+-DAMDGPU_TARGETS="${AMDGPU_TARGETS}"} + ) + + CXX="hipcc" cmake_src_configure + + # do not rerun cmake and the build process in src_install + sed -e '/RERUN/,+1d' -i "${BUILD_DIR}"/build.ninja || die +} + +src_compile() { + docs_compile + cmake_src_compile +} + +check_rw_permission() { + local cmd="[ -r $1 ] && [ -w $1 ]" + local error=0 user + if has sandbox ${FEATURES}; then + user="portage" + su portage -c "${cmd}" || error=1 + else + user="$(whoami)" + bash -c "${cmd}" || error=1 + fi + if [[ "${error}" == 1 ]]; then + die "${user} do not have read and write permissions on $1! \n Make sure ${user} is in render group and check the permissions." + fi +} + +src_test() { + # check permissions on /dev/kfd and /dev/dri/render* + check_rw_permission /dev/kfd + check_rw_permission /dev/dri/render* + addwrite /dev/kfd + addwrite /dev/dri/ + cd "${BUILD_DIR}/clients/staging" || die + ROCBLAS_TEST_TIMEOUT=3600 LD_LIBRARY_PATH="${BUILD_DIR}/clients:${BUILD_DIR}/library/src" ROCBLAS_TENSILE_LIBPATH="${BUILD_DIR}/Tensile/library" ./rocblas-test || die "Tests failed" +} + +src_install() { + cmake_src_install + + if use benchmark; then + cd "${BUILD_DIR}" || die + dolib.so clients/librocblas_fortran_client.so + dobin clients/staging/rocblas-bench + fi +} |