From df97245a4d5e684e33afcf9927f59f4a02049585 Mon Sep 17 00:00:00 2001 From: "Sv. Lockal" Date: Sun, 10 Aug 2025 11:55:21 +0000 Subject: [PATCH] sci-libs/rocBLAS: add 9999, set Tensile_CPU_THREADS, improve dependencies Bug: https://bugs.gentoo.org/949494 Signed-off-by: Sv. Lockal Part-of: https://github.com/gentoo/gentoo/pull/43406 Signed-off-by: Sam James --- ...S-6.4.3.ebuild => rocBLAS-6.4.3-r1.ebuild} | 24 ++-- sci-libs/rocBLAS/rocBLAS-9999.ebuild | 131 ++++++++++++++++++ 2 files changed, 145 insertions(+), 10 deletions(-) rename sci-libs/rocBLAS/{rocBLAS-6.4.3.ebuild => rocBLAS-6.4.3-r1.ebuild} (97%) create mode 100644 sci-libs/rocBLAS/rocBLAS-9999.ebuild diff --git a/sci-libs/rocBLAS/rocBLAS-6.4.3.ebuild b/sci-libs/rocBLAS/rocBLAS-6.4.3-r1.ebuild similarity index 97% rename from sci-libs/rocBLAS/rocBLAS-6.4.3.ebuild rename to sci-libs/rocBLAS/rocBLAS-6.4.3-r1.ebuild index 83a3cc8fa055a..cd672f4a50053 100644 --- a/sci-libs/rocBLAS/rocBLAS-6.4.3.ebuild +++ b/sci-libs/rocBLAS/rocBLAS-6.4.3-r1.ebuild @@ -25,26 +25,29 @@ REQUIRED_USE="${ROCM_REQUIRED_USE}" BDEPEND=" >=dev-build/rocm-cmake-5.3 - video_cards_amdgpu? ( - dev-util/Tensile:${SLOT} - ) +" + +RDEPEND=" + dev-util/hip:${SLOT} + dev-util/roctracer:${SLOT} hipblaslt? ( sci-libs/hipBLASLt:${SLOT} ) - test? ( dev-cpp/gtest ) + benchmark? ( + virtual/blas + dev-cpp/gtest + llvm-runtimes/openmp + ) " DEPEND=" + ${RDEPEND} >=dev-cpp/msgpack-cxx-6.0.0 - dev-util/hip:${SLOT} - dev-util/roctracer:${SLOT} test? ( virtual/blas dev-cpp/gtest llvm-runtimes/openmp ) - benchmark? ( - virtual/blas - dev-cpp/gtest - llvm-runtimes/openmp + video_cards_amdgpu? ( + dev-util/Tensile:${SLOT} ) " @@ -83,6 +86,7 @@ src_configure() { -DBUILD_WITH_PIP=OFF -DBUILD_WITH_HIPBLASLT="$(usex hipblaslt ON OFF)" -DLINK_BLIS=OFF + -DTensile_CPU_THREADS=$(makeopts_jobs) -Wno-dev ) diff --git a/sci-libs/rocBLAS/rocBLAS-9999.ebuild b/sci-libs/rocBLAS/rocBLAS-9999.ebuild new file mode 100644 index 0000000000000..1436148acadcd --- /dev/null +++ b/sci-libs/rocBLAS/rocBLAS-9999.ebuild @@ -0,0 +1,131 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DOCS_BUILDER="doxygen" +DOCS_DIR="docs/doxygen" +DOCS_DEPEND="media-gfx/graphviz" +LLVM_COMPAT=( 20 ) +ROCM_VERSION=${PV} + +inherit cmake docs edo flag-o-matic multiprocessing rocm llvm-r1 + +DESCRIPTION="AMD's library for BLAS on ROCm" +HOMEPAGE="https://github.com/ROCm/rocBLAS" + +if [[ "${PV}" == 9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/ROCm/rocm-libraries.git" + EGIT_BRANCH="develop" + S="${WORKDIR}/${P}/projects/rocblas" + SLOT="0/6.4" +else + SRC_URI="https://github.com/ROCm/rocBLAS/archive/rocm-${PV}.tar.gz -> rocm-${P}.tar.gz" + S="${WORKDIR}/${PN}-rocm-${PV}" + SLOT="0/$(ver_cut 1-2)" + KEYWORDS="~amd64" +fi + +LICENSE="BSD" +IUSE="benchmark hipblaslt test video_cards_amdgpu" +RESTRICT="!test? ( test )" +REQUIRED_USE="${ROCM_REQUIRED_USE}" + +BDEPEND=" + >=dev-build/rocm-cmake-5.3 +" + +RDEPEND=" + dev-util/hip:${SLOT} + dev-util/roctracer:${SLOT} + hipblaslt? ( sci-libs/hipBLASLt:${SLOT} ) + benchmark? ( + virtual/blas + dev-cpp/gtest + llvm-runtimes/openmp + ) +" + +DEPEND=" + ${RDEPEND} + >=dev-cpp/msgpack-cxx-6.0.0 + test? ( + virtual/blas + dev-cpp/gtest + llvm-runtimes/openmp + ) + video_cards_amdgpu? ( + dev-util/Tensile:${SLOT} + ) +" + +QA_FLAGS_IGNORED="/usr/lib64/rocblas/library/.*" + +src_prepare() { + cmake_src_prepare + sed -e "s:,-rpath=.*\":\":" -i clients/CMakeLists.txt || die +} + +src_configure() { + llvm_prepend_path "${LLVM_SLOT}" + rocm_use_clang + + # too many warnings + append-cxxflags -Wno-explicit-specialization-storage-class -Wno-unused-value + + local mycmakeargs=( + -DCMAKE_SKIP_RPATH=ON + -DROCM_SYMLINK_LIBS=OFF + -DAMDGPU_TARGETS="$(get_amdgpu_flags)" + -DBUILD_WITH_TENSILE="$(usex video_cards_amdgpu)" + -DCMAKE_INSTALL_INCLUDEDIR="include/rocblas" + -DBUILD_CLIENTS_SAMPLES=OFF + -DBUILD_CLIENTS_TESTS="$(usex test ON OFF)" + -DBUILD_CLIENTS_BENCHMARKS="$(usex benchmark ON OFF)" + -DBUILD_WITH_PIP=OFF + -DBUILD_WITH_HIPBLASLT="$(usex hipblaslt ON OFF)" + -DLINK_BLIS=OFF + -DTensile_CPU_THREADS=$(makeopts_jobs) + -Wno-dev + ) + + if usex video_cards_amdgpu; then + mycmakeargs+=( + -DTensile_COMPILER="hipcc" + -DTensile_ROOT="${EPREFIX}/usr/share/Tensile" + -DTensile_CPU_THREADS="$(makeopts_jobs)" + ) + fi + + cmake_src_configure +} + +src_compile() { + docs_compile + cmake_src_compile +} + +src_test() { + check_amdgpu + cd "${BUILD_DIR}"/clients/staging || die + export ROCBLAS_TEST_TIMEOUT=3600 ROCBLAS_TENSILE_LIBPATH="${BUILD_DIR}/Tensile/library" + export LD_LIBRARY_PATH="${BUILD_DIR}/clients:${BUILD_DIR}/library/src" + + # `--gtest_filter=*quick*:*pre_checkin*-*known_bug*` is >1h on 7900XTX + edob ./rocblas-test --yaml rocblas_smoke.yaml +} + +src_install() { + cmake_src_install + + if use benchmark; then + cd "${BUILD_DIR}" || die + dolib.a clients/librocblas_fortran_client.a + dobin clients/staging/rocblas-bench + fi + + # Stop llvm-strip from removing .strtab section from *.hsaco files, + # otherwise rocclr/elf/elf.cpp complains with "failed: null sections(STRTAB)" and crashes + dostrip -x "/usr/$(get_libdir)/rocblas/library/" +}