summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSv. Lockal <lockalsash@gmail.com>2024-05-13 14:01:53 +0000
committerSam James <sam@gentoo.org>2024-06-26 10:19:23 +0100
commit773337c9262ab9fd2d0aa362726f68e0ae08f926 (patch)
treebeedab96a0a3a7daf2ce7607fb92edee9b56b39c /sci-libs
parentdev-libs/rocdbgapi: new package, add 5.7.1, 6.1.1 (diff)
downloadgentoo-773337c9262ab9fd2d0aa362726f68e0ae08f926.tar.gz
gentoo-773337c9262ab9fd2d0aa362726f68e0ae08f926.tar.bz2
gentoo-773337c9262ab9fd2d0aa362726f68e0ae08f926.zip
sci-libs/hipBLASLt: new package, add 6.1.1
Signed-off-by: Sv. Lockal <lockalsash@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sci-libs')
-rw-r--r--sci-libs/hipBLASLt/Manifest1
-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, 268 insertions, 0 deletions
diff --git a/sci-libs/hipBLASLt/Manifest b/sci-libs/hipBLASLt/Manifest
new file mode 100644
index 000000000000..83717bb68f79
--- /dev/null
+++ b/sci-libs/hipBLASLt/Manifest
@@ -0,0 +1 @@
+DIST hipBLASLt-6.1.1.tar.gz 78448557 BLAKE2B 08ac9ce45d7d1e4384a36939af22f65589ed87e25b4db77f5f7ff5fbe65b8070e9c55fbb09db3b7bd49be98981dc8bf939e646ea27571bf1d1ccfa52a50b0f92 SHA512 1aa3a1cb8e9c7f653db66909b38be065b7386b97d4bd6b52ecc6c2bf72c6cdfabde6f12ebc6016b5fa195f979359af875eda8d54ea6772329312cb357bc2ebc5
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>