commit:     d1ef1565621453484517f70e79e750b5b716f1d6
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Sun Oct 12 16:17:12 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 21 18:47:34 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d1ef1565

sci-libs/rocBLAS: add 7.0.2, fix 9999

Bug: https://bugs.gentoo.org/964799

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

 sci-libs/rocBLAS/Manifest                          |  1 +
 .../rocBLAS/files/rocBLAS-7.0.1-find-cblas.patch   | 15 ++++
 .../rocBLAS-7.0.2-expand-isa-compatibility.patch   | 96 ++++++++++++++++++++++
 sci-libs/rocBLAS/metadata.xml                      |  5 +-
 .../{rocBLAS-9999.ebuild => rocBLAS-7.0.2.ebuild}  | 28 +++++--
 sci-libs/rocBLAS/rocBLAS-9999.ebuild               | 28 +++++--
 6 files changed, 157 insertions(+), 16 deletions(-)

diff --git a/sci-libs/rocBLAS/Manifest b/sci-libs/rocBLAS/Manifest
index 90ddb03ce91b..65ae15ac6118 100644
--- a/sci-libs/rocBLAS/Manifest
+++ b/sci-libs/rocBLAS/Manifest
@@ -1,2 +1,3 @@
 DIST rocm-rocBLAS-6.3.3.tar.gz 57909385 BLAKE2B 
a51274e2895419cc517ac24a0235c90f3b2551945b6936789abc78a08c8dde151de6d853d6378a702138227604af4cc185bde3acb5bf8999e09699d293bb2b85
 SHA512 
fcc8718e0c3dde8715f758e83f3a1ca45dde88ac56680e7723e2041dd3c1d7b9f575b1686552d04e7ef12b57188164c8abb5a6e4c568ade03d534edc30846c9e
 DIST rocm-rocBLAS-6.4.3.tar.gz 57989956 BLAKE2B 
36ed966b9ebeabae20510a20ed5e0503254cddbac25535297baaca6ac52decac2598bcb85c73a720737dd959fc64c2ee542b3b8ed59ae85980aeaf6dbc093681
 SHA512 
6273122eca037c22e44d56a3c09e04383c2f59d64342b36ac65430ad9f9a963c70b4c5477eb615a31daaf0deea1aedd11b88f2d66bcbada89504cb48cf2c264f
+DIST rocm-rocBLAS-7.0.2.tar.gz 58187427 BLAKE2B 
ce3d054d53499d1d15c1d097f588fbe86e61984dc99a04bfbc9a4e9d9a789774e5808ea6c060a553c96fa3fa860eaf4a52833cf5ed50b7670a62053196881340
 SHA512 
b74d7fa56b08b513e4acbc6a5e91db95964bb270f4e90977fe0ecf5777b71244e6761d7c5851892c8be6f4fcd5bcccad85961efc5ef8dcad9dd2e90df4014a06

diff --git a/sci-libs/rocBLAS/files/rocBLAS-7.0.1-find-cblas.patch 
b/sci-libs/rocBLAS/files/rocBLAS-7.0.1-find-cblas.patch
new file mode 100644
index 000000000000..2943699dac9d
--- /dev/null
+++ b/sci-libs/rocBLAS/files/rocBLAS-7.0.1-find-cblas.patch
@@ -0,0 +1,15 @@
+Fix for "undefined symbol: cblas_..." with USE="benchmark" and FEATURES="test"
+--- a/clients/CMakeLists.txt
++++ b/clients/CMakeLists.txt
+@@ -177,8 +177,9 @@ if( BUILD_CLIENTS_BENCHMARKS OR BUILD_CLIENTS_TESTS)
+         endif()
+       endif()
+     else()
+-      find_package( BLAS REQUIRED )
+-      set( BLAS_LIBRARY "${BLAS_LIBRARIES}" )
++      find_package( CBLAS CONFIG REQUIRED )
++      set( BLAS_LIBRARY "${CBLAS_LIBRARIES}" )
++      set( BLAS_INCLUDE_DIR "${CBLAS_INCLUDE_DIRS}" )
+     endif()
+   else() # WIN32
+     file(TO_CMAKE_PATH "C:/Program\ 
Files/AMD/AOCL-Windows/amd-blis/lib/ILP64/AOCL-LibBlis-Win-MT.lib" 
AOCL_BLAS_LIBRARY)

diff --git 
a/sci-libs/rocBLAS/files/rocBLAS-7.0.2-expand-isa-compatibility.patch 
b/sci-libs/rocBLAS/files/rocBLAS-7.0.2-expand-isa-compatibility.patch
new file mode 100644
index 000000000000..8fa9392635a8
--- /dev/null
+++ b/sci-libs/rocBLAS/files/rocBLAS-7.0.2-expand-isa-compatibility.patch
@@ -0,0 +1,96 @@
+--- a/library/src/handle.cpp
++++ b/library/src/handle.cpp
+@@ -21,6 +21,7 @@
+  * ************************************************************************ */
+ #include "handle.hpp"
+ #include <cstdarg>
++#include <cstring>
+ #include <limits>
+ 
+ #ifdef WIN32
+@@ -333,6 +334,20 @@ Processor _rocblas_handle::getActiveArch()
+     // strip out xnack/ecc from name
+     std::string deviceFullString(device_properties.gcnArchName);
+     std::string deviceString = deviceFullString.substr(0, 
deviceFullString.find(":"));
++    // coerce to compatible arch
++    int gcnArch = deviceString.substr(0, 3) == "gfx" ? 
std::stoi(deviceString.substr(3)) : 0;
++    switch(gcnArch)
++    {
++    case 902: case 909: case 912:
++        std::strcpy(device_properties.gcnArchName, "gfx900");
++        break;
++    case 1013:
++        std::strcpy(device_properties.gcnArchName, "gfx1010");
++        break;
++    case 1031: case 1032: case 1033: case 1034: case 1035: case 1036:
++        std::strcpy(device_properties.gcnArchName, "gfx1030");
++        break;
++    }
+ 
+     if(deviceString.find("gfx803") != std::string::npos)
+     {
+--- a/library/src/rocblas_auxiliary.cpp
++++ b/library/src/rocblas_auxiliary.cpp
+@@ -24,6 +24,7 @@
+ #include "logging.hpp"
+ #include "rocblas-auxiliary.h"
+ #include <cctype>
++#include <cstring>
+ #include <cstdlib>
+ #include <memory>
+ #include <string>
+@@ -924,6 +925,20 @@ std::string rocblas_internal_get_arch_name()
+     hipGetDevice(&deviceId);
+     hipDeviceProp_t deviceProperties;
+     hipGetDeviceProperties(&deviceProperties, deviceId);
++    // coerce to compatible arch
++    int gcnArch = strncmp(deviceProperties.gcnArchName, "gfx", 3) == 0 ? 
std::stoi(deviceProperties.gcnArchName + 3) : 0;
++    switch(gcnArch)
++    {
++    case 902: case 909: case 912:
++        std::strcpy(deviceProperties.gcnArchName, "gfx900");
++        break;
++    case 1013:
++        std::strcpy(deviceProperties.gcnArchName, "gfx1010");
++        break;
++    case 1031: case 1032: case 1033: case 1034: case 1035: case 1036:
++        std::strcpy(deviceProperties.gcnArchName, "gfx1030");
++        break;
++    }
+     return ArchName<hipDeviceProp_t>{}(deviceProperties);
+ }
+ 
+--- a/library/src/tensile_host.cpp
++++ b/library/src/tensile_host.cpp
+@@ -51,6 +51,7 @@
+ #include <Tensile/hip/HipUtils.hpp>
+ #include <atomic>
+ #include <complex>
++#include <cstring>
+ #include <exception>
+ #include <future>
+ #include <iomanip>
+@@ -831,6 +832,23 @@ namespace
+                         std::string deviceFullString(prop.gcnArchName);
+                         std::string deviceString
+                             = deviceFullString.substr(0, 
deviceFullString.find(":"));
++                        // coerce to compatible arch
++                        int gcnArch = deviceString.substr(0, 3) == "gfx" ? 
std::stoi(deviceString.substr(3)) : 0;
++                        switch(gcnArch)
++                        {
++                        case 902: case 909: case 912:
++                            std::strcpy(prop.gcnArchName, "gfx900");
++                            deviceString = prop.gcnArchName;
++                            break;
++                        case 1013:
++                            std::strcpy(prop.gcnArchName, "gfx1010");
++                            deviceString = prop.gcnArchName;
++                            break;
++                        case 1031: case 1032: case 1033: case 1034: case 
1035: case 1036:
++                            std::strcpy(prop.gcnArchName, "gfx1030");
++                            deviceString = prop.gcnArchName;
++                            break;
++                        }
+                         m_devicePropMap[deviceString] = 
std::make_shared<hipDeviceProp_t>(prop);
+                     }
+                 }

diff --git a/sci-libs/rocBLAS/metadata.xml b/sci-libs/rocBLAS/metadata.xml
index bd9344786002..42d9ffa1bb06 100644
--- a/sci-libs/rocBLAS/metadata.xml
+++ b/sci-libs/rocBLAS/metadata.xml
@@ -17,11 +17,12 @@
     <name>Sv. Lockal</name>
   </maintainer>
   <use>
-    <flag name="test">Perform rocblas-test to compare the result between 
rocBLAS and system BLAS.</flag>
     <flag name="benchmark">Build and install rocblas-bench.</flag>
     <flag name="hipblaslt">Build with hipBLASLt for some non-batched and 
strided batched problems on gfx12.</flag>
+    <flag name="roctracer">Enable roctracer (roctx) marker.</flag>
+    <flag name="test">Perform rocblas-test to compare the result between 
rocBLAS and system BLAS.</flag>
   </use>
   <upstream>
-    <remote-id type="github">ROCm/rocBLAS</remote-id>
+    <remote-id type="github">ROCm/rocm-libraries</remote-id>
   </upstream>
 </pkgmetadata>

diff --git a/sci-libs/rocBLAS/rocBLAS-9999.ebuild 
b/sci-libs/rocBLAS/rocBLAS-7.0.2.ebuild
similarity index 77%
copy from sci-libs/rocBLAS/rocBLAS-9999.ebuild
copy to sci-libs/rocBLAS/rocBLAS-7.0.2.ebuild
index 1436148acadc..2e2813dc28cd 100644
--- a/sci-libs/rocBLAS/rocBLAS-9999.ebuild
+++ b/sci-libs/rocBLAS/rocBLAS-7.0.2.ebuild
@@ -12,14 +12,14 @@ 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";
+HOMEPAGE="https://github.com/ROCm/rocm-libraries/tree/develop/projects/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"
+       SLOT="0/7.0"
 else
        SRC_URI="https://github.com/ROCm/rocBLAS/archive/rocm-${PV}.tar.gz -> 
rocm-${P}.tar.gz"
        S="${WORKDIR}/${PN}-rocm-${PV}"
@@ -27,18 +27,18 @@ else
        KEYWORDS="~amd64"
 fi
 
-LICENSE="BSD"
-IUSE="benchmark hipblaslt test video_cards_amdgpu"
+LICENSE="MIT BSD"
+IUSE="benchmark hipblaslt roctracer test video_cards_amdgpu"
 RESTRICT="!test? ( test )"
 REQUIRED_USE="${ROCM_REQUIRED_USE}"
 
 BDEPEND="
-       >=dev-build/rocm-cmake-5.3
+       dev-build/rocm-cmake:${SLOT}
 "
 
 RDEPEND="
        dev-util/hip:${SLOT}
-       dev-util/roctracer:${SLOT}
+       roctracer? ( dev-util/roctracer:${SLOT} )
        hipblaslt? ( sci-libs/hipBLASLt:${SLOT} )
        benchmark? (
                virtual/blas
@@ -62,9 +62,22 @@ DEPEND="
 
 QA_FLAGS_IGNORED="/usr/lib64/rocblas/library/.*"
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-5.4.2-add-missing-header.patch
+       "${FILESDIR}"/${PN}-7.0.2-expand-isa-compatibility.patch
+       "${FILESDIR}"/${PN}-6.3.0-no-git.patch
+       "${FILESDIR}"/${PN}-7.0.1-find-cblas.patch
+)
+
 src_prepare() {
        cmake_src_prepare
-       sed -e "s:,-rpath=.*\":\":" -i clients/CMakeLists.txt || die
+
+       # Remove RPATH's, fixes multilib compatibility
+       sed -e "/apply_omp_settings/a return()" -i clients/CMakeLists.txt || die
+
+       # Disable automagic linking with roctracer
+       sed -e "s/if(ROCTRACER_INCLUDE_DIR/if(ROCBLAS_ENABLE_MARKER AND 
ROCTRACER_INCLUDE_DIR/" \
+               -i library/CMakeLists.txt || die
 }
 
 src_configure() {
@@ -85,6 +98,7 @@ src_configure() {
                -DBUILD_CLIENTS_BENCHMARKS="$(usex benchmark ON OFF)"
                -DBUILD_WITH_PIP=OFF
                -DBUILD_WITH_HIPBLASLT="$(usex hipblaslt ON OFF)"
+               -DROCBLAS_ENABLE_MARKER="$(usex roctracer 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
index 1436148acadc..36fcbbb79d32 100644
--- a/sci-libs/rocBLAS/rocBLAS-9999.ebuild
+++ b/sci-libs/rocBLAS/rocBLAS-9999.ebuild
@@ -12,14 +12,14 @@ 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";
+HOMEPAGE="https://github.com/ROCm/rocm-libraries/tree/develop/projects/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"
+       SLOT="0/7.0"
 else
        SRC_URI="https://github.com/ROCm/rocBLAS/archive/rocm-${PV}.tar.gz -> 
rocm-${P}.tar.gz"
        S="${WORKDIR}/${PN}-rocm-${PV}"
@@ -27,18 +27,18 @@ else
        KEYWORDS="~amd64"
 fi
 
-LICENSE="BSD"
-IUSE="benchmark hipblaslt test video_cards_amdgpu"
+LICENSE="MIT BSD"
+IUSE="benchmark hipblaslt roctracer test video_cards_amdgpu"
 RESTRICT="!test? ( test )"
 REQUIRED_USE="${ROCM_REQUIRED_USE}"
 
 BDEPEND="
-       >=dev-build/rocm-cmake-5.3
+       dev-build/rocm-cmake:${SLOT}
 "
 
 RDEPEND="
        dev-util/hip:${SLOT}
-       dev-util/roctracer:${SLOT}
+       roctracer? ( dev-util/roctracer:${SLOT} )
        hipblaslt? ( sci-libs/hipBLASLt:${SLOT} )
        benchmark? (
                virtual/blas
@@ -62,9 +62,22 @@ DEPEND="
 
 QA_FLAGS_IGNORED="/usr/lib64/rocblas/library/.*"
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-5.4.2-add-missing-header.patch
+       "${FILESDIR}"/${PN}-6.0.2-expand-isa-compatibility.patch
+       "${FILESDIR}"/${PN}-6.3.0-no-git.patch
+       "${FILESDIR}"/${PN}-7.0.1-find-cblas.patch
+)
+
 src_prepare() {
        cmake_src_prepare
-       sed -e "s:,-rpath=.*\":\":" -i clients/CMakeLists.txt || die
+
+       # Remove RPATH's, fixes multilib compatibility
+       sed -e "/apply_omp_settings/a return()" -i clients/CMakeLists.txt || die
+
+       # Disable automagic linking with roctracer
+       sed -e "s/if(ROCTRACER_INCLUDE_DIR/if(ROCBLAS_ENABLE_MARKER AND 
ROCTRACER_INCLUDE_DIR/" \
+               -i library/CMakeLists.txt || die
 }
 
 src_configure() {
@@ -85,6 +98,7 @@ src_configure() {
                -DBUILD_CLIENTS_BENCHMARKS="$(usex benchmark ON OFF)"
                -DBUILD_WITH_PIP=OFF
                -DBUILD_WITH_HIPBLASLT="$(usex hipblaslt ON OFF)"
+               -DROCBLAS_ENABLE_MARKER="$(usex roctracer ON OFF)"
                -DLINK_BLIS=OFF
                -DTensile_CPU_THREADS=$(makeopts_jobs)
                -Wno-dev

Reply via email to