From 34a45f47f42ee4ce0997bfea22948aad293b606a Mon Sep 17 00:00:00 2001 From: Patrick Lauer Date: Sun, 10 Aug 2025 06:00:06 +0000 Subject: [PATCH] sci-libs/hipBLASLt: add 6.4.3 Signed-off-by: Patrick Lauer --- sci-libs/hipBLASLt/Manifest | 1 + sci-libs/hipBLASLt/hipBLASLt-6.4.3.ebuild | 153 ++++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 sci-libs/hipBLASLt/hipBLASLt-6.4.3.ebuild diff --git a/sci-libs/hipBLASLt/Manifest b/sci-libs/hipBLASLt/Manifest index 7ceec3b61c706..511fa7e35a225 100644 --- a/sci-libs/hipBLASLt/Manifest +++ b/sci-libs/hipBLASLt/Manifest @@ -3,3 +3,4 @@ DIST hipBLASLt-6.3.1.tar.gz 89385330 BLAKE2B 4bcf083e41ad6f22f61321bd066d79a6a38 DIST hipBLASLt-6.3.2.tar.gz 89385514 BLAKE2B 785ee2951b76100f29eed4891cdc3fc58abbee866a9eac7109bc49e56854007d57d15bc6d605a7527ecc685e59500567581d194ede67cff566fba3b582d7b3c4 SHA512 2f4f497a5228162f4fffda9f549f943d26c86d7160a50c0aadc403340cee4466e9f16bd5cfcd386535b7f05cc8d1839a4d146c52761b6eb29e2e53962437e781 DIST hipBLASLt-6.3.3.tar.gz 89385318 BLAKE2B b307e4c418bda7583efdf5dc646f05368c195f6df0077823ae179efb52a56ba4f13b5fce6a10ff38e0ad593bf5b415fc6e5b4132488b2dbf9da58198af15d230 SHA512 9fb523e614dd790aa3c01337f3d93f9df0a135d25e9efda2375e88818f6097d661e5159336258631cc0a25d923efcddb4b39378bf54c33d0e5a01bba387f1368 DIST hipBLASLt-6.4.1.tar.gz 186266266 BLAKE2B 5bc583ea3798e16e55fc1d7eaf8b13376191a72e1eb64ee7dc17cd4ba4550e17be6e66947ace5054942296e2548dd31633a961061cf7027ef3278858d84f8366 SHA512 efa60a3625c87686905641d9a90d1403f6e9be510cc538c99864c910db8ec3ab10571778ca81b43ebba5de8ad0f2e6bcec69421ede1bc39239a8d6b5ab3139b2 +DIST hipBLASLt-6.4.3.tar.gz 188053924 BLAKE2B 5a249c2ff856fe858422a2a99e3e072afb29c5ff5ca08f4e57c3574baf85ce40611822a7b72aa7a40329e1c328bdb06cbc47f7278506a57e8e241f695b0cc940 SHA512 0edf1ef227e7c8de767a2fd3da639351d55d70921f2cc1fb4c09163cd32f3fc0b7d5ee7ba50bb62c619b7d9fdb5dc23c65a5e29cfc78937868153ad234c3966f diff --git a/sci-libs/hipBLASLt/hipBLASLt-6.4.3.ebuild b/sci-libs/hipBLASLt/hipBLASLt-6.4.3.ebuild new file mode 100644 index 0000000000000..a2ce9ce18ae01 --- /dev/null +++ b/sci-libs/hipBLASLt/hipBLASLt-6.4.3.ebuild @@ -0,0 +1,153 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +ROCM_SKIP_GLOBALS=1 +PYTHON_COMPAT=( python3_{10..14} ) + +LLVM_COMPAT=( 20 ) + +inherit cmake flag-o-matic llvm-r1 python-any-r1 rocm +DESCRIPTION="General matrix-matrix operations library for AMD Instinct accelerators" +HOMEPAGE="https://github.com/ROCm/hipBLASLt" +SRC_URI="https://github.com/ROCm/hipBLASLt/archive/rocm-${PV}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/hipBLASLt-rocm-${PV}" + +LICENSE="MIT" +SLOT="0/$(ver_cut 1-2)" +KEYWORDS="~amd64" + +SUPPORTED_GPUS=( gfx908 gfx90a gfx940 gfx941 gfx942 gfx1100 gfx1101 gfx1200 gfx1201 ) +IUSE_TARGETS=( "${SUPPORTED_GPUS[@]/#/amdgpu_targets_}" ) +IUSE="${IUSE_TARGETS[@]/#/+} benchmark roctracer test" +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-util/hip:${SLOT} + dev-cpp/msgpack-cxx + roctracer? ( dev-util/roctracer:${SLOT} ) +" + +DEPEND="${RDEPEND}" +BDEPEND=" + ${PYTHON_DEPS} + dev-build/rocm-cmake + dev-util/hipcc + sci-libs/hipBLAS-common:${SLOT} + $(python_gen_any_dep ' + dev-python/msgpack[${PYTHON_USEDEP}] + dev-python/pyyaml[${PYTHON_USEDEP}] + dev-python/joblib[${PYTHON_USEDEP}] + ') + $(llvm_gen_dep 'llvm-core/clang:${LLVM_SLOT}') + test? ( + dev-cpp/gtest + virtual/blas + dev-util/rocm-smi:${SLOT} + ) + benchmark? ( + virtual/blas + llvm-runtimes/openmp + ) +" + +PATCHES=( + "${FILESDIR}"/${PN}-6.1.1-fix-msgpack-dependency.patch + "${FILESDIR}"/${PN}-6.1.1-no-arch.patch + "${FILESDIR}"/${PN}-6.1.1-no-git.patch + "${FILESDIR}"/${PN}-6.1.1-clang-19.patch + "${FILESDIR}"/${PN}-6.1.1-fix-libcxx.patch + "${FILESDIR}"/${PN}-6.3.0-no-arch-extra.patch + "${FILESDIR}"/${PN}-6.4.1-min-pip-install.patch + "${FILESDIR}"/${PN}-6.4.1-headers.patch + "${FILESDIR}"/${PN}-6.4.1-libcxx-integrals.patch + "${FILESDIR}"/${PN}-6.4.1-gentoopath.patch + "${FILESDIR}"/${PN}-6.4.1-upstream-clang.patch +) + +python_check_deps() { + python_has_version "dev-python/msgpack[${PYTHON_USEDEP}]" && + python_has_version "dev-python/pyyaml[${PYTHON_USEDEP}]" && + python_has_version "dev-python/joblib[${PYTHON_USEDEP}]" +} + +pkg_setup() { + python-any-r1_pkg_setup +} + +pkg_pretend() { + if [[ "${AMDGPU_TARGETS[@]}" = "" ]]; then + ewarn "hipBLASLt supports only few GPUs: ${SUPPORTED_GPUS[@]}," + ewarn "but none of them were defined in AMDGPU_TARGETS USE_EXPAND variable." + ewarn + ewarn "Library will continue to be built in \"dummy\" mode," + ewarn "serving as a non-functional placeholder for end-user applications." + fi +} + +src_prepare() { + local shebangs=($(grep -rl "#!/usr/bin/env python3" tensilelite/Tensile || die)) + python_fix_shebang -q ${shebangs[*]} + + rocm_use_clang + sed -e "s:\${rocm_path}/bin/amdclang++:${CXX}:" \ + -i library/src/amd_detail/rocblaslt/src/kernels/compile_code_object.sh \ + -i tensilelite/Tensile/Ops/gen_assembly.sh || die + + # Fix compiler validation (just a validation) + sed "s/amdclang/$(basename "$CC")/g" \ + -i tensilelite/Tensile/Utilities/Toolchain.py || die + + cmake_src_prepare +} + +src_configure() { + rocm_use_clang + + # too many warnings + append-cxxflags -Wno-explicit-specialization-storage-class + + local targets="$(get_amdgpu_flags)" + local build_with_tensile=$([ "${AMDGPU_TARGETS[@]}" = "" ] && echo OFF || echo ON ) + + local mycmakeargs=( + -DROCM_SYMLINK_LIBS=OFF + -DBUILD_WITH_TENSILE="${build_with_tensile}" + -DTensile_COMPILER=${CXX} + -DAMDGPU_TARGETS="${targets}" + -DBUILD_CLIENTS_TESTS=$(usex test ON OFF) + -DBUILD_CLIENTS_BENCHMARKS="$(usex benchmark ON OFF)" + -DPython_EXECUTABLE="${PYTHON}" + -DHIPBLASLT_ENABLE_MARKER="$(usex roctracer ON OFF)" + -Wno-dev + ) + + cmake_src_configure +} + +src_compile() { + local -x ROCM_PATH="${EPREFIX}/usr" + # set PYTHONPATH to load Tensile from virtualenv, not the system-wide one + local -x PYTHONPATH="${S}_build/virtualenv/lib/${EPYTHON}/site-packages" + local -x TENSILE_ROCM_ASSEMBLER_PATH="$(get_llvm_prefix)/bin/clang++" + # TensileCreateLibrary reads CMAKE_CXX_COMPILER again + local -x CMAKE_CXX_COMPILER="$(get_llvm_prefix)/bin/clang++" + cmake_src_compile +} + +src_install() { + cmake_src_install + + # 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)/hipblaslt/library/ +} + +src_test() { + check_amdgpu + + # Expected time for 7900 XTX: 340s (full) or 5s with GTEST_FILTER='*quick*' + # Fails in `MatrixTransformTest.MultipleDevices` in dGPU+iGPU combination + HIP_VISIBLE_DEVICES=0 cmake_src_test +}