summaryrefslogtreecommitdiff
path: root/sci-libs/hipBLASLt
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-06-27 07:59:40 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-06-27 07:59:40 +0100
commitd2ed973482fdd800013658e83a61709b29e0a80f (patch)
tree57ea7666a57b5a05a4c8866e4915e90b4a6e7c94 /sci-libs/hipBLASLt
parent9f6a82a85d400d6ae7de04c43cee88dbc6bc4da0 (diff)
gentoo auto-resync : 27:06:2024 - 07:59:39
Diffstat (limited to 'sci-libs/hipBLASLt')
-rw-r--r--sci-libs/hipBLASLt/Manifest8
-rw-r--r--sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-clang-19.patch11
-rw-r--r--sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-fix-msgpack-dependency.patch29
-rw-r--r--sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-gentoopath.patch24
-rw-r--r--sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-no-arch.patch56
-rw-r--r--sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-no-git.patch13
-rw-r--r--sci-libs/hipBLASLt/hipBLASLt-6.1.1.ebuild120
-rw-r--r--sci-libs/hipBLASLt/metadata.xml14
8 files changed, 275 insertions, 0 deletions
diff --git a/sci-libs/hipBLASLt/Manifest b/sci-libs/hipBLASLt/Manifest
new file mode 100644
index 000000000000..23aeb5897dba
--- /dev/null
+++ b/sci-libs/hipBLASLt/Manifest
@@ -0,0 +1,8 @@
+AUX hipBLASLt-6.1.1-clang-19.patch 341 BLAKE2B 7e486930db9a406e3665eb4d276c0df4790018ce4f8f6f7a72bd986da61a0ccfc6619ea0de6a2a488cb1ee64f92470aaa337b4590a5be0044be0bf9a014bad25 SHA512 894596742720d947fb25fd3332c34efbb5cc2fdc790c29919e0d65df85d2add6f1ac2a6c7b8f4796428bc69197af0f6227132a6711f3106e9a7b84f285ecfa83
+AUX hipBLASLt-6.1.1-fix-msgpack-dependency.patch 1094 BLAKE2B 9606ba01ead2aefd52ec2d2f424c735d361ffab67fc1bc2a6800cd81a34ae7e8d3a189fa79ef84f2caf4d6186687d6eddd8083ca8a912beaa0bce0ae72ad0393 SHA512 8b1b383611a88d9af6be546b985d4d460be830c370ec149eb7c4ae56dfedb57583ea463470029d099a779161f8b582637cf62ec0fbbd3617023002cc903cf82c
+AUX hipBLASLt-6.1.1-gentoopath.patch 724 BLAKE2B ac3acc8c444de7a8072337cadb3c9976d94cd019a1ecf51a18a4ccd59500efd4de798f710738c818f495dd018d0c8885e8754fede2d308a50c355f2a39236370 SHA512 59358f5d0c22d9188cf4e70215c0e42415831b0e804709f1c97d42fce15049edb3e58320c252b413b016490ed72fc27ab59660880fe71e4226bace0808529b32
+AUX hipBLASLt-6.1.1-no-arch.patch 1967 BLAKE2B d73ede48e0254a99df1b632437a4d820d1f639600bdda216d38c74dca38e6234a3ef4dd8bdc3a1e0450cfd64e07c9c2806f5378ec1097be0e130f6f6b5c4b934 SHA512 a4aae7c3117821e72ce63b72b2017eedb414046c9e0f52c2cb16c8a6c7aa84efcd1960adfe85dd89f3a247c8f7bccc7a586e36d494c6e9bc1a8fbd39f6febe87
+AUX hipBLASLt-6.1.1-no-git.patch 365 BLAKE2B 47b7f23a4ce0919cfd6d2d1a946d98822db912571d908c82d35d734ea2bfee15a1e537f50e8fb2ada474e819274654462b26f97fcb5dc010354df9f6ba30c377 SHA512 a44aa357bdc035ffcfe4d30fb81db205dfcfd28c00543a4c55f7f61f5a90ae228bcfce71be2f4290e842f60f534287b2f25a4cd2a27369ddbbaf1e0d1171a7d5
+DIST hipBLASLt-6.1.1.tar.gz 78448557 BLAKE2B 08ac9ce45d7d1e4384a36939af22f65589ed87e25b4db77f5f7ff5fbe65b8070e9c55fbb09db3b7bd49be98981dc8bf939e646ea27571bf1d1ccfa52a50b0f92 SHA512 1aa3a1cb8e9c7f653db66909b38be065b7386b97d4bd6b52ecc6c2bf72c6cdfabde6f12ebc6016b5fa195f979359af875eda8d54ea6772329312cb357bc2ebc5
+EBUILD hipBLASLt-6.1.1.ebuild 3260 BLAKE2B c22ce042c79793e78b9e91bea880ec853d6faa6cda427393729f39ba8fd9af491454da04cfd6330c85cb6bf7b8bd1034c7dac120d2dba1d1be0956c56d40b761 SHA512 f640b0c0db0089627341f102b87c23b892874cd90d49d89b3257234c65105db2c377c835b8e2876d3034401112303a7f17d025f7a268c410a948f9cb38b77814
+MISC metadata.xml 416 BLAKE2B 72248e12cd10654326a6685df0e03c508d413d2728d8e687eb8ad3d8dc928e518e3ba21df1ee774282c45363f61eed98b47b862cab2354d743ca530047084281 SHA512 02acf2d17f2c56f09c599fcde965bd5ceb07c335d7c2b4fd57a06a6b1a591a250d22de7a002f299cc99cacd1fd72f183adf51fc1b9ebff1338c6d83450da9c3b
diff --git a/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-clang-19.patch b/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-clang-19.patch
new file mode 100644
index 000000000000..5d082cc704b6
--- /dev/null
+++ b/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-clang-19.patch
@@ -0,0 +1,11 @@
+Clang 19 is so smart, it can analyze templates before instantiation
+--- a/tensilelite/Tensile/Source/lib/include/Tensile/MasterSolutionLibrary.hpp
++++ b/tensilelite/Tensile/Source/lib/include/Tensile/MasterSolutionLibrary.hpp
+@@ -36,6 +36,7 @@
+
+ namespace Tensile
+ {
++ enum class LazyLoadingInit;
+
+ /**
+ * \ingroup SolutionLibrary
diff --git a/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-fix-msgpack-dependency.patch b/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-fix-msgpack-dependency.patch
new file mode 100644
index 000000000000..ef0b8395c527
--- /dev/null
+++ b/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-fix-msgpack-dependency.patch
@@ -0,0 +1,29 @@
+Gentoo uses "msgpack-cxx" as library name and adds important
+MSGPACK_NO_BOOST compile definition when msgpack-cxx us installed with USE=-boost
+--- a/tensilelite/Tensile/Source/lib/CMakeLists.txt
++++ b/tensilelite/Tensile/Source/lib/CMakeLists.txt
+@@ -102,22 +102,9 @@ if(TENSILE_USE_LLVM OR TENSILE_USE_MSGPACK)
+ endif()
+
+ if(TENSILE_USE_MSGPACK)
+- find_package(msgpack REQUIRED)
++ find_package(msgpack-cxx REQUIRED)
+ target_compile_definitions(TensileHost PUBLIC -DTENSILE_MSGPACK=1)
+-
+- if(TARGET msgpackc-cxx)
+- get_target_property(msgpack_inc msgpackc-cxx INTERFACE_INCLUDE_DIRECTORIES)
+- elseif(TARGET msgpackc)
+- get_target_property(msgpack_inc msgpackc INTERFACE_INCLUDE_DIRECTORIES)
+- endif()
+-
+- if(DEFINED msgpack_inc)
+- # include C++ headers manually
+- # External header includes included as system files
+- target_include_directories(TensileHost
+- SYSTEM PRIVATE $<BUILD_INTERFACE:${msgpack_inc}>
+- )
+- endif()
++ target_link_libraries(TensileHost PRIVATE msgpack-cxx)
+ endif()
+
+ if(TENSILE_USE_LLVM)
diff --git a/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-gentoopath.patch b/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-gentoopath.patch
new file mode 100644
index 000000000000..17c5d9c534c0
--- /dev/null
+++ b/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-gentoopath.patch
@@ -0,0 +1,24 @@
+--- a/tensilelite/Tensile/Ops/gen_assembly.sh
++++ b/tensilelite/Tensile/Ops/gen_assembly.sh
+@@ -32,7 +32,7 @@ if ! [ -z ${ROCM_PATH+x} ]; then
+ rocm_path=${ROCM_PATH}
+ fi
+
+-toolchain=${rocm_path}/llvm/bin/clang++
++toolchain=@LLVM_PATH@/bin/clang++
+
+ . ${venv}/bin/activate
+
+--- 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.1.1-no-arch.patch b/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-no-arch.patch
new file mode 100644
index 000000000000..6bd608c94d0e
--- /dev/null
+++ b/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-no-arch.patch
@@ -0,0 +1,56 @@
+Add ability to build without specitying any arch.
+This produces dummy library, which can be linked to other project (like caffe2 in pytorch).
+
+Related upstream bug: https://github.com/ROCm/hipBLASLt/issues/535
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -220,6 +220,10 @@ else()
+ else()
+ find_package(Tensile 4.33.0 EXACT REQUIRED HIP LLVM OpenMP PATHS "${INSTALLED_TENSILE_PATH}")
+ endif()
++ else() # link to Tensile (required), but don't generate libraries
++ cmake_policy(SET CMP0074 NEW)
++ set(Tensile_ROOT "${CMAKE_SOURCE_DIR}/tensilelite/Tensile")
++ find_package(Tensile REQUIRED HIP LLVM OpenMP)
+ endif()
+
+ # setup hipblaslt defines used for both the library and clients
+--- a/library/CMakeLists.txt
++++ b/library/CMakeLists.txt
+@@ -75,7 +75,7 @@ add_library(roc::hipblaslt ALIAS hipblaslt)
+
+ # Target compile definitions
+ if(NOT BUILD_CUDA)
+-if( BUILD_WITH_TENSILE )
++if( TRUE ) # link with Tensile is always reqiured
+
+ if( BUILD_SHARED_LIBS )
+ target_link_libraries( hipblaslt PRIVATE TensileHost )
+@@ -194,7 +194,7 @@ rocm_install_targets(TARGETS hipblaslt
+ ${CMAKE_BINARY_DIR}/include
+ )
+
+-if ( NOT BUILD_CUDA )
++if ( NOT BUILD_CUDA AND BUILD_WITH_TENSILE )
+ if (WIN32)
+ set( HIPBLASLT_TENSILE_LIBRARY_DIR "\${CPACK_PACKAGING_INSTALL_PREFIX}hipblaslt/bin" CACHE PATH "path to tensile library" )
+ else()
+--- a/library/src/amd_detail/rocblaslt/src/CMakeLists.txt
++++ b/library/src/amd_detail/rocblaslt/src/CMakeLists.txt
+@@ -100,7 +100,16 @@ if( BUILD_WITH_TENSILE )
+ set( Tensile_INC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/amd_detail/rocblaslt/src/Tensile
+ )
++else()
++ set_target_properties( TensileHost PROPERTIES POSITION_INDEPENDENT_CODE ON )
+
++ set( Tensile_SRC
++ src/amd_detail/rocblaslt/src/tensile_host.cpp
++ )
++
++ set( Tensile_INC
++ ${CMAKE_CURRENT_SOURCE_DIR}/src/amd_detail/rocblaslt/src/Tensile
++ )
+ endif( ) # BUILD_WITH_TENSILE
+
+ set(DL_LIB dl) \ No newline at end of file
diff --git a/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-no-git.patch b/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-no-git.patch
new file mode 100644
index 000000000000..55c26680673f
--- /dev/null
+++ b/sci-libs/hipBLASLt/files/hipBLASLt-6.1.1-no-git.patch
@@ -0,0 +1,13 @@
+Git is not used
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -23,9 +23,6 @@
+
+ # Dependencies
+
+-# Git
+-find_package(Git REQUIRED)
+-
+ # Workaround until hcc & hip cmake modules fixes symlink logic in their config files.
+ # (Thanks to rocBLAS devs for finding workaround for this problem!)
+ list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
diff --git a/sci-libs/hipBLASLt/hipBLASLt-6.1.1.ebuild b/sci-libs/hipBLASLt/hipBLASLt-6.1.1.ebuild
new file mode 100644
index 000000000000..cf2ad2ac5382
--- /dev/null
+++ b/sci-libs/hipBLASLt/hipBLASLt-6.1.1.ebuild
@@ -0,0 +1,120 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ROCM_SKIP_GLOBALS=1
+PYTHON_COMPAT=( python3_{10..13} )
+
+# gfx941 and gfx942 assembly uses directives of LLVM >= 18.1.0
+LLVM_COMPAT=( 18 )
+
+inherit cmake python-any-r1 llvm-r1 prefix 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=( gfx90a gfx940 gfx941 gfx942 )
+IUSE_TARGETS=( "${SUPPORTED_GPUS[@]/#/amdgpu_targets_}" )
+IUSE="${IUSE_TARGETS[@]/#/+} test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ dev-util/hip
+ dev-cpp/msgpack-cxx
+ sci-libs/hipBLAS:${SLOT}
+"
+
+DEPEND="${RDEPEND}"
+BDEPEND="
+ dev-build/rocm-cmake
+ $(python_gen_any_dep '
+ dev-python/msgpack[${PYTHON_USEDEP}]
+ dev-python/pyyaml[${PYTHON_USEDEP}]
+ dev-python/joblib[${PYTHON_USEDEP}]
+ ')
+ $(llvm_gen_dep 'sys-devel/clang:${LLVM_SLOT}')
+ test? (
+ dev-cpp/gtest
+ )
+"
+
+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
+)
+
+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() {
+ sed -e "s,\@LLVM_PATH\@,$(get_llvm_prefix),g" \
+ "${FILESDIR}"/${PN}-6.1.1-gentoopath.patch > "${S}"/gentoopath.patch || die
+ eapply $(prefixify_ro "${S}"/gentoopath.patch)
+
+ local shebangs=($(grep -rl "#!/usr/bin/env python3" tensilelite/Tensile || die))
+ python_fix_shebang -q ${shebangs[*]}
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ 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}"
+ -DAMDGPU_TARGETS="${targets}"
+ -DBUILD_CLIENTS_TESTS=$(usex test ON OFF)
+ )
+
+ use test && mycmakeargs+=( -DBUILD_FORTRAN_CLIENTS=ON )
+
+ CXX=hipcc 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++"
+ 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
+ cmake_src_test -j1
+}
diff --git a/sci-libs/hipBLASLt/metadata.xml b/sci-libs/hipBLASLt/metadata.xml
new file mode 100644
index 000000000000..da84ad53885c
--- /dev/null
+++ b/sci-libs/hipBLASLt/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>sci@gentoo.org</email>
+ </maintainer>
+ <maintainer type="person">
+ <email>lockalsash@gmail.com</email>
+ <name>Sv. Lockal</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">ROCm/hipBLASLt</remote-id>
+ </upstream>
+</pkgmetadata>