public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/rocBLAS/, sci-libs/rocBLAS/files/
Date: Wed, 26 Jun 2024 09:21:24 +0000 (UTC)	[thread overview]
Message-ID: <1719393560.e41b4bb57f3cd8010b6cd0e52fe0fae8e646901b.sam@gentoo> (raw)

commit:     e41b4bb57f3cd8010b6cd0e52fe0fae8e646901b
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Tue Mar 19 18:49:11 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 26 09:19:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e41b4bb5

sci-libs/rocBLAS: add 6.1.1

Changes:
* in updated expand-isa-compatibility patch do not coerce gfx1011 and gfx1012 to gfx1010, as Gentoo users can build rocBLAS for gfx1011 and gfx1012 with USE flags
* add myself to maintainers

Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sci-libs/rocBLAS/Manifest                          |   1 +
 .../rocBLAS-6.0.2-expand-isa-compatibility.patch   |  96 ++++++++++++++++++
 sci-libs/rocBLAS/metadata.xml                      |   4 +
 sci-libs/rocBLAS/rocBLAS-6.1.1.ebuild              | 111 +++++++++++++++++++++
 4 files changed, 212 insertions(+)

diff --git a/sci-libs/rocBLAS/Manifest b/sci-libs/rocBLAS/Manifest
index f17d3a47c686..ca306e9c9efb 100644
--- a/sci-libs/rocBLAS/Manifest
+++ b/sci-libs/rocBLAS/Manifest
@@ -3,3 +3,4 @@ DIST rocBLAS-5.4.2-Tensile-asm_full-navi22.tar.gz 1057686 BLAKE2B aa755595bbcd48
 DIST rocm-rocBLAS-5.1.3.tar.gz 13741546 BLAKE2B af10d8cb69bee44ef5aab2dc350e1d9f3b6fddb3a840c17230c4b55b2649a4724c9f2e58c1eafdb3e2716eea016a72a35c3ddb498881b1ce682d780baa8d8b07 SHA512 5ab71838fdd0e9c5848cbf28a19d113353b619a878d8c7d05f64feb32faae2054169c95ed6e9dd6b05a2e807b57229dd2c361c4d289b6e6f17c196558640890f
 DIST rocm-rocBLAS-5.4.2.tar.gz 15938434 BLAKE2B 14ebafa944fdac443800bb7f9b16f8ecf0f420b168d3c6534f68ad7d14bf058a4cc1673fce8f4b9be53e4a6c1cf05011e01853cd901bce0b59827d2aca4d029f SHA512 e62bb80457c1e89454885499bdce9d60beecd706806724418983c78c65c2ae303550f9670b5a6e71dae6a61c0e42b223ab01b36b8406430731ebcbff54c4a8f4
 DIST rocm-rocBLAS-5.7.1.tar.gz 55389700 BLAKE2B 9e58b1d29c8a04aa58ce17fdd9b0c2504934261851619dc5b696a04e8c6a79e7c44d86a6db7a9c76a434d76593de8c191cba6f163cf398d01cfc001e5fa32b5a SHA512 cfc73f6c490595a3c153c2ac2a3cb5926c48c2c19baa07ff3dcdf3a7ccaed82cfdff64ed5a3be64c349cb43d654d4b104d9090e2ec9f2061049d6a4921c07722
+DIST rocm-rocBLAS-6.1.1.tar.gz 100103895 BLAKE2B df89a21e47730714b80c62717a86d65ac0d819c2d33b2a3c6252b60b8d7cc9eb5f8f1db27159b0a8dfc87aba7ccad97e2f832bc0044e92d0b69c526d382c745a SHA512 74e847c4ddee16cae7f41e268a815ea03875519c365abe7dfce313a9545df245baa73301b432f64a36cc988281fec7530629a0d72583e9ea287c98ec8a0b3907

diff --git a/sci-libs/rocBLAS/files/rocBLAS-6.0.2-expand-isa-compatibility.patch b/sci-libs/rocBLAS/files/rocBLAS-6.0.2-expand-isa-compatibility.patch
new file mode 100644
index 000000000000..ca895c4b4ff5
--- /dev/null
+++ b/sci-libs/rocBLAS/files/rocBLAS-6.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
+ #include <windows.h>
+@@ -80,6 +81,20 @@ static Processor getActiveArch(int deviceId)
+     // strip out xnack/ecc from name
+     std::string deviceFullString(deviceProperties.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(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;
++    }
+ 
+     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>
+@@ -1242,6 +1243,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
+@@ -45,6 +45,7 @@ extern "C" void rocblas_shutdown();
+ #include <Tensile/hip/HipUtils.hpp>
+ #include <atomic>
+ #include <complex>
++#include <cstring>
+ #include <exception>
+ #include <future>
+ #include <iomanip>
+@@ -802,6 +803,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 066f5c749e3f..0e8f76b2a76e 100644
--- a/sci-libs/rocBLAS/metadata.xml
+++ b/sci-libs/rocBLAS/metadata.xml
@@ -12,6 +12,10 @@
     <email>xgreenlandforwyy@gmail.com</email>
     <name>Yiyang Wu</name>
   </maintainer>
+  <maintainer type="person">
+    <email>lockalsash@gmail.com</email>
+    <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>

diff --git a/sci-libs/rocBLAS/rocBLAS-6.1.1.ebuild b/sci-libs/rocBLAS/rocBLAS-6.1.1.ebuild
new file mode 100644
index 000000000000..fed17e82b14e
--- /dev/null
+++ b/sci-libs/rocBLAS/rocBLAS-6.1.1.ebuild
@@ -0,0 +1,111 @@
+# Copyright 1999-2024 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"
+ROCM_VERSION=${PV}
+inherit cmake docs edo multiprocessing rocm
+
+DESCRIPTION="AMD's library for BLAS on ROCm"
+HOMEPAGE="https://github.com/ROCmSoftwarePlatform/rocBLAS"
+SRC_URI="https://github.com/ROCmSoftwarePlatform/rocBLAS/archive/rocm-${PV}.tar.gz -> rocm-${P}.tar.gz"
+S="${WORKDIR}/${PN}-rocm-${PV}"
+
+LICENSE="BSD"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+IUSE="benchmark test"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="${ROCM_REQUIRED_USE}"
+
+BDEPEND="
+	>=dev-build/rocm-cmake-5.3
+	dev-util/Tensile:${SLOT}
+	dev-python/joblib
+	test? ( dev-cpp/gtest )
+"
+
+DEPEND="
+	>=dev-cpp/msgpack-cxx-6.0.0
+	=dev-util/hip-6*
+	test? (
+		virtual/blas
+		dev-cpp/gtest
+		sys-libs/libomp
+	)
+	benchmark? (
+		virtual/blas
+		sys-libs/libomp
+	)
+"
+
+QA_FLAGS_IGNORED="/usr/lib64/rocblas/library/.*"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-5.4.2-cpp_lib_filesystem.patch
+	"${FILESDIR}"/${PN}-5.4.2-add-missing-header.patch
+	"${FILESDIR}"/${PN}-5.4.2-link-cblas.patch
+	"${FILESDIR}"/${PN}-6.0.2-expand-isa-compatibility.patch
+	)
+
+src_prepare() {
+	cmake_src_prepare
+	sed -e "s:,-rpath=.*\":\":" -i clients/CMakeLists.txt || die
+}
+
+src_configure() {
+	addpredict /dev/random
+	addpredict /dev/kfd
+	addpredict /dev/dri/
+
+	local mycmakeargs=(
+		-DCMAKE_SKIP_RPATH=ON
+		-DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF
+		-DROCM_SYMLINK_LIBS=OFF
+		-DAMDGPU_TARGETS="$(get_amdgpu_flags)"
+		-DTensile_LOGIC="asm_full"
+		-DTensile_COMPILER="hipcc"
+		-DTensile_LIBRARY_FORMAT="msgpack"
+		-DTensile_CODE_OBJECT_VERSION="default"
+		-DTensile_ROOT="${EPREFIX}/usr/share/Tensile"
+		-DBUILD_WITH_TENSILE=ON
+		-DCMAKE_INSTALL_INCLUDEDIR="include/rocblas"
+		-DBUILD_CLIENTS_SAMPLES=OFF
+		-DBUILD_CLIENTS_TESTS=$(usex test ON OFF)
+		-DBUILD_CLIENTS_BENCHMARKS=$(usex benchmark ON OFF)
+		-DTensile_CPU_THREADS=$(makeopts_jobs)
+		-DBUILD_WITH_PIP=OFF
+	)
+
+	CXX=hipcc 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"
+	edob ./${PN,,}-test
+}
+
+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/
+}


             reply	other threads:[~2024-06-26  9:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26  9:21 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-02-13  8:38 [gentoo-commits] repo/gentoo:master commit in: sci-libs/rocBLAS/, sci-libs/rocBLAS/files/ Sam James
2025-01-05 21:49 Sam James
2023-11-27 14:35 Benda XU
2022-12-19 14:00 Andreas Sturmlechner
2022-07-08 17:29 Benda XU
2022-03-20  7:33 Benda XU
2022-03-05 20:51 Andrew Ammerlaan
2022-03-05 20:51 Andrew Ammerlaan
2021-08-27 11:53 Benda XU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1719393560.e41b4bb57f3cd8010b6cd0e52fe0fae8e646901b.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox