diff --git a/sci-libs/hipBLASLt/Manifest b/sci-libs/hipBLASLt/Manifest index 15ab940e21621..7ceec3b61c706 100644 --- a/sci-libs/hipBLASLt/Manifest +++ b/sci-libs/hipBLASLt/Manifest @@ -2,3 +2,4 @@ DIST hipBLASLt-6.1.1.tar.gz 78448557 BLAKE2B 08ac9ce45d7d1e4384a36939af22f65589e DIST hipBLASLt-6.3.1.tar.gz 89385330 BLAKE2B 4bcf083e41ad6f22f61321bd066d79a6a387ea677cdb05f96f474e1b409f0b1cc5dc0c61259d7d6456ced2b77191388e1bd4b260bd7d185875241f55246ed1a8 SHA512 7a6443ab7a66bae1d6273945ea91814b2d5f9846d8276040cda7f43ed7ea0c2cb6063009e7fe092742d396c8d87c2cf62ed4cf8249e936eed69c0cad6db02193 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 diff --git a/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-gentoopath.patch b/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-gentoopath.patch new file mode 100644 index 0000000000000..f0c6a07afff70 --- /dev/null +++ b/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-gentoopath.patch @@ -0,0 +1,13 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -97,10 +97,6 @@ endif() + # hipBLASLt project + project(hipblaslt LANGUAGES CXX) + +-# Force library install path to lib (CentOS 7 defaults to lib64) +-set(CMAKE_INSTALL_LIBDIR "lib" CACHE INTERNAL "Installation directory for libraries" FORCE) +- +- + # Build options + option(BUILD_SHARED_LIBS "Build hipBLASLt as a shared library" ON) + option(BUILD_CLIENTS_TESTS "Build tests (requires googletest)" OFF) diff --git a/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-headers.patch b/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-headers.patch new file mode 100644 index 0000000000000..9f5d31fa3c534 --- /dev/null +++ b/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-headers.patch @@ -0,0 +1,12 @@ +std::map got transitively included via in libstdc++, not libc++ +Upstream fix: https://github.com/ROCm/hipBLASLt/commit/57d3aaf02554f8407d5eba6ef255836725f65aac +--- a/clients/include/datatype_interface.hpp ++++ b/clients/include/datatype_interface.hpp +@@ -27,6 +27,7 @@ + #pragma once + + #include ++#include + + union computeTypeInterface + { diff --git a/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-libcxx-integrals.patch b/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-libcxx-integrals.patch new file mode 100644 index 0000000000000..dcf2092d08bbc --- /dev/null +++ b/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-libcxx-integrals.patch @@ -0,0 +1,39 @@ +Libc++ lands on generic mathod and fails with `std::uniform_int_distribution` (bad integer type) +--- a/clients/include/hipblaslt_random.hpp ++++ b/clients/include/hipblaslt_random.hpp +@@ -88,18 +88,34 @@ class hipblaslt_nan_rng + + public: + // Random integer +- template {}, int> = 0> ++ template ::value && ++ !std::is_same::value && ++ !std::is_same::value, ++ int> = 0> + explicit operator T() + { + return std::uniform_int_distribution{}(t_hipblaslt_rng); + } + ++ // Random unsigned char ++ explicit operator unsigned char() ++ { ++ return static_cast(std::uniform_int_distribution{}(t_hipblaslt_rng)); ++ } ++ + // Random signed char + explicit operator signed char() + { + return static_cast(std::uniform_int_distribution{}(t_hipblaslt_rng)); + } + ++ // Random char ++ explicit operator char() ++ { ++ return static_cast(std::uniform_int_distribution{}(t_hipblaslt_rng)); ++ } ++ + // Random NaN double + explicit operator double() + { diff --git a/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-min-pip-install.patch b/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-min-pip-install.patch new file mode 100644 index 0000000000000..eddeb8e97d658 --- /dev/null +++ b/sci-libs/hipBLASLt/files/hipBLASLt-6.4.1-min-pip-install.patch @@ -0,0 +1,29 @@ +Dependencies are managed by ebuild. +--- a/cmake/virtualenv.cmake ++++ b/cmake/virtualenv.cmake +@@ -27,14 +27,6 @@ endfunction() + + function(virtualenv_install) + virtualenv_create() +- execute_process( +- COMMAND ${VIRTUALENV_BIN_DIR}/${VIRTUALENV_PYTHON_EXENAME} -m pip install --upgrade pip +- COMMAND_ECHO STDOUT +- ) +- execute_process( +- COMMAND ${VIRTUALENV_BIN_DIR}/${VIRTUALENV_PYTHON_EXENAME} -m pip install --upgrade setuptools +- COMMAND_ECHO STDOUT +- ) + execute_process( + COMMAND ${VIRTUALENV_BIN_DIR}/${VIRTUALENV_PYTHON_EXENAME} -m pip install ${ARGN} + COMMAND_ECHO STDOUT +--- a/tensilelite/setup.py ++++ b/tensilelite/setup.py +@@ -51,7 +51,7 @@ setup( + url="https://github.com/RadeonOpenCompute/Tensile", + author="Advanced Micro Devices", + license="MIT", +- install_requires=readRequirementsFromTxt(), ++ install_requires=[], + python_requires='>=3.5', + packages=["Tensile"], + package_data={ "Tensile": ["Tensile/cmake/*"] }, diff --git a/sci-libs/hipBLASLt/hipBLASLt-6.4.1.ebuild b/sci-libs/hipBLASLt/hipBLASLt-6.4.1.ebuild new file mode 100644 index 0000000000000..d735d84b5ff84 --- /dev/null +++ b/sci-libs/hipBLASLt/hipBLASLt-6.4.1.ebuild @@ -0,0 +1,149 @@ +# 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 ) +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 + 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 +) + +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[*]} + + sed -e "s:\${rocm_path}/bin/amdclang++:$(get_llvm_prefix)/bin/clang++:" \ + -i library/src/amd_detail/rocblaslt/src/kernels/compile_code_object.sh \ + -i tensilelite/Tensile/Ops/gen_assembly.sh || die + + sed 's/amdclang/clang/g' -i tensilelite/Tensile/Utilities/Toolchain.py || die + + cmake_src_prepare +} + +src_configure() { + export CC="$(get_llvm_prefix)/bin/clang" CXX="$(get_llvm_prefix)/bin/clang++" + strip-unsupported-flags + + # 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 +} diff --git a/sci-libs/hipBLASLt/metadata.xml b/sci-libs/hipBLASLt/metadata.xml index 2be6f3bc6ac60..0615de9427121 100644 --- a/sci-libs/hipBLASLt/metadata.xml +++ b/sci-libs/hipBLASLt/metadata.xml @@ -13,5 +13,6 @@ Build and install rocblas-bench. + Enable roctracer (roctx) marker.