commit:     ef3519c7e5f5c64612a85b5b341e51fc6b8380e8
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Mon Feb 16 12:32:05 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar  6 00:44:11 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef3519c7

sci-libs/hipsparselt: new package, add 7.2.0

Closes: https://bugs.gentoo.org/968487

Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/45826
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sci-libs/hipsparselt/Manifest                      |   3 +
 .../files/hipBLASLt-7.1.0-rocisa-nanobind.patch    |  19 +++
 sci-libs/hipsparselt/hipsparselt-7.2.0.ebuild      | 185 +++++++++++++++++++++
 sci-libs/hipsparselt/metadata.xml                  |  29 ++++
 4 files changed, 236 insertions(+)

diff --git a/sci-libs/hipsparselt/Manifest b/sci-libs/hipsparselt/Manifest
new file mode 100644
index 000000000000..9b55321634a3
--- /dev/null
+++ b/sci-libs/hipsparselt/Manifest
@@ -0,0 +1,3 @@
+DIST hipblaslt-7.2.0.tar.gz 429012541 BLAKE2B 
40476fddfc021fbed97e755d884229e1f7a79f9f53d615e8f582bfe702a2f71f02fa490aad636b17ac71ed9bf0deb8ab21742ca4599f8c0859fea0ef50c756b4
 SHA512 
1866113e64b5ad3c5a31531b295413c4d03ffec6adc70b588590d77ee48713792a7d592fcee026193eb3fa6d43f09c573d54c475025b2f16e2b46787be448aaa
+DIST hipsparselt-7.2.0.tar.gz 6972883 BLAKE2B 
13d2ae6a3b6a100ebfcf6662ce7ef9d2411ed4462399edceb37771abab20da3580bde0acd25572d0d257e82489062842a0439b66d9310dd82dd24a0b1c227a16
 SHA512 
39009eead7b21f968726339be7df3c7f5e67de683364ed023b080191314e1a030f8f621263d292b6d49f4a44a3299ac3afb4e6cb441cffeaeaebd399fad3f0f6
+DIST origami-7.2.0.tar.gz 52203 BLAKE2B 
ea6c5ce23102280bd70003e541748d0c7b73c2179484c1eb182e5a3946f4dfe998a87e312d200209299dd1d2dfba42eed390fc31c37d6e9a8b06fecca84f1ff8
 SHA512 
ed6326f1ef8eec00e11109a392ec72ca2d28b8106b0ebf08f150a76937974b7b33f4e972799400c34a68a528935ea6234366d2d063079fad7bdb8852d13afe26

diff --git a/sci-libs/hipsparselt/files/hipBLASLt-7.1.0-rocisa-nanobind.patch 
b/sci-libs/hipsparselt/files/hipBLASLt-7.1.0-rocisa-nanobind.patch
new file mode 100644
index 000000000000..e08158786a8a
--- /dev/null
+++ b/sci-libs/hipsparselt/files/hipBLASLt-7.1.0-rocisa-nanobind.patch
@@ -0,0 +1,19 @@
+Use system nanobind
+--- a/tensilelite/rocisa/CMakeLists.txt        2025-11-09 09:49:11.051195769 
-0000
++++ b/tensilelite/rocisa/CMakeLists.txt        2025-11-09 09:50:56.393579853 
-0000
+@@ -17,14 +17,7 @@
+ )
+ 
+ if(HIPBLASLT_BUNDLE_PYTHON_DEPS)
+-    include(FetchContent)
+-    FetchContent_Declare(
+-      nanobind
+-      GIT_REPOSITORY https://github.com/wjakob/nanobind.git
+-      GIT_TAG        9b3afa9dbdc23641daf26fadef7743e7127ff92f # v2.6.1
+-    )
+-    FetchContent_MakeAvailable(nanobind)
+-
++    find_package(nanobind CONFIG REQUIRED)
+     set(ROCISAINST_SOURCE 
"${CMAKE_CURRENT_SOURCE_DIR}/rocisa/src/instruction/instruction.cpp"
+                           
"${CMAKE_CURRENT_SOURCE_DIR}/rocisa/src/instruction/common.cpp"
+                           
"${CMAKE_CURRENT_SOURCE_DIR}/rocisa/src/instruction/branch.cpp"

diff --git a/sci-libs/hipsparselt/hipsparselt-7.2.0.ebuild 
b/sci-libs/hipsparselt/hipsparselt-7.2.0.ebuild
new file mode 100644
index 000000000000..2557e58a7b6a
--- /dev/null
+++ b/sci-libs/hipsparselt/hipsparselt-7.2.0.ebuild
@@ -0,0 +1,185 @@
+# Copyright 1999-2026 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=( 22 )
+
+inherit cmake flag-o-matic multiprocessing llvm-r2 python-any-r1 rocm
+DESCRIPTION="Sparse GEMM operations library for AMD Instinct accelerators"
+HOMEPAGE="https://github.com/ROCm/rocm-libraries/tree/develop/projects/hipsparselt";
+SRC_URI="
+       
https://github.com/ROCm/rocm-libraries/releases/download/rocm-${PV}/hipsparselt.tar.gz
 -> hipsparselt-${PV}.tar.gz
+       
https://github.com/ROCm/rocm-libraries/releases/download/rocm-${PV}/origami.tar.gz
 -> origami-${PV}.tar.gz
+       
https://github.com/ROCm/rocm-libraries/releases/download/rocm-${PV}/hipblaslt.tar.gz
 -> hipblaslt-${PV}.tar.gz
+"
+
+S="${WORKDIR}/hipsparselt"
+ORIGAMI_S="${WORKDIR}/origami"
+HIPBLASLT_S="${WORKDIR}/hipblaslt"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+
+# From hipsparselt_supported_architectures.cmake
+SUPPORTED_GPUS=( gfx942 gfx950 )
+IUSE_TARGETS=( "${SUPPORTED_GPUS[@]/#/amdgpu_targets_}" )
+IUSE="${IUSE_TARGETS[*]/#/+} benchmark roctracer test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       dev-util/hip:${SLOT}
+       roctracer? ( dev-util/roctracer:${SLOT} )
+       benchmark? ( sci-libs/flexiblas )
+"
+
+DEPEND="
+       ${RDEPEND}
+       dev-cpp/msgpack-cxx
+       dev-libs/rocm-comgr:${SLOT}
+       dev-libs/rocr-runtime:${SLOT}
+       sci-libs/hipSPARSE:${SLOT}
+       dev-util/rocm-smi:${SLOT}
+       llvm-runtimes/openmp
+"
+
+BDEPEND="
+       ${PYTHON_DEPS}
+       dev-build/rocm-cmake:${SLOT}
+       dev-util/hipcc:${SLOT}
+       $(python_gen_any_dep "
+               dev-python/msgpack[\${PYTHON_USEDEP}]
+               dev-python/pyyaml[\${PYTHON_USEDEP}]
+               dev-python/joblib[\${PYTHON_USEDEP}]
+               dev-python/nanobind[\${PYTHON_USEDEP}]
+               dev-python/setuptools[\${PYTHON_USEDEP}]
+       ")
+       $(llvm_gen_dep "llvm-core/clang:\${LLVM_SLOT}")
+       test? (
+               dev-cpp/gtest
+               sci-libs/flexiblas
+       )
+"
+
+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}]" &&
+       python_has_version "dev-python/nanobind[${PYTHON_USEDEP}]" &&
+       python_has_version "dev-python/setuptools[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+       QA_FLAGS_IGNORED="usr/$(get_libdir)/hipsparselt/library/.*"
+       python-any-r1_pkg_setup
+}
+
+pkg_pretend() {
+       if [[ "${AMDGPU_TARGETS[*]}" = "" ]]; then
+               ewarn "hipSPARSELt supports only some 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() {
+       rocm_use_clang
+
+       # too many warnings
+       append-cxxflags -Wno-explicit-specialization-storage-class
+
+       # Do not install tests
+       sed -e 's/COMPONENT "tests"/COMPONENT "tests" EXCLUDE_FROM_ALL/' \
+               -i CMakeLists.txt || die
+
+       pushd "${HIPBLASLT_S}" || die
+       eapply "${FILESDIR}"/hipBLASLt-7.1.0-rocisa-nanobind.patch
+
+       sed -e 's:../../shared/origami:../origami:' -i CMakeLists.txt || die
+
+       local shebangs=($(grep -rl "#!/usr/bin/env python3" tensilelite/Tensile 
|| die))
+       python_fix_shebang -q "${shebangs[@]}"
+
+       # Fix compiler validation (just a validation)
+       sed -e "s/amdclang/$(basename "$CC")/g" \
+               -i tensilelite/Tensile/Toolchain/Validators.py || die
+       sed -e 
"s:\$(ROCM_PATH)/bin/amdclang++:$(get_llvm_prefix)/bin/clang++:g" \
+               -i tensilelite/Makefile || die
+       popd || die
+
+       cmake_src_prepare
+}
+
+src_configure() {
+       rocm_use_clang
+
+       # Tensile guesses weirdly how to compile things, ld.bfd won't work, so 
force lld
+       append-cxxflags -DCMAKE_CXX_FLAGS="-fuse-ld=lld"
+
+       local targets="$(get_amdgpu_flags)"
+       local HIPSPARSELT_ENABLE_DEVICE=$([ "${AMDGPU_TARGETS[*]}" != "" ] && 
echo ON || echo OFF )
+
+       # targets has a trailing semicolon, this trips up Tensile's input 
parser, so carefully prune
+       local mycmakeargs=(
+               -DGPU_TARGETS="${targets::-1}"
+               -DHIPSPARSELT_ENABLE_SAMPLES=OFF
+               -DHIPSPARSELT_ENABLE_DEVICE=${HIPSPARSELT_ENABLE_DEVICE}
+               -DHIPSPARSELT_BUILD_TESTING="$(usex test ON OFF)"
+               -DHIPSPARSELT_ENABLE_BENCHMARKS="$(usex benchmark ON OFF)"
+
+               -DHIPSPARSELT_ENABLE_MARKER="$(usex roctracer ON OFF)"
+               -Dnanobind_DIR="$(python_get_sitedir)/nanobind/cmake"
+               -DPython_EXECUTABLE="${PYTHON}"
+               -DROCM_SYMLINK_LIBS=OFF
+               -Wno-dev
+       )
+
+       if [[ "${AMDGPU_TARGETS[*]}" != "" ]]; then
+               mycmakeargs+=(
+                       -DTENSILELITE_BUILD_PARALLEL_LEVEL=$(makeopts_jobs)
+               )
+       fi
+
+       if use test || use benchmark; then
+               mycmakeargs+=(
+                       -DHIPSPARSELT_ENABLE_CLIENT=ON
+                       -DBLA_VENDOR=FlexiBLAS
+               )
+       else
+               mycmakeargs+=(
+                       -DHIPSPARSELT_ENABLE_CLIENT=OFF
+               )
+       fi
+
+       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)/hipsparselt/library/
+}
+
+src_test() {
+       check_amdgpu
+       # Non-instinct GPUs: tests just succeed without testing anything
+       HIP_VISIBLE_DEVICES=0 cmake_src_test
+}

diff --git a/sci-libs/hipsparselt/metadata.xml 
b/sci-libs/hipsparselt/metadata.xml
new file mode 100644
index 000000000000..99d611403637
--- /dev/null
+++ b/sci-libs/hipsparselt/metadata.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person" proxied="yes">
+               <email>[email protected]</email>
+               <name>Sv. Lockal</name>
+               <description>Primary maintainer</description>
+       </maintainer>
+       <maintainer type="person" proxied="yes">
+               <email>[email protected]</email>
+               <name>Yiyang Wu</name>
+       </maintainer>
+       <maintainer type="person" proxied="yes">
+               <email>[email protected]</email>
+               <name>Paul Zander</name>
+               <description>General GPGPU stuff</description>
+       </maintainer>
+       <maintainer type="project" proxied="proxy">
+               <email>[email protected]</email>
+               <name>Gentoo Science Project</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">ROCm/hipBLASLt</remote-id>
+       </upstream>
+       <use>
+               <flag name="benchmark">Build and install rocblas-bench</flag>
+               <flag name="roctracer">Enable roctracer (roctx) marker</flag>
+       </use>
+</pkgmetadata>

Reply via email to