summaryrefslogtreecommitdiff
path: root/sci-libs/hipBLASLt/hipBLASLt-6.1.1.ebuild
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/hipBLASLt-6.1.1.ebuild
parent9f6a82a85d400d6ae7de04c43cee88dbc6bc4da0 (diff)
gentoo auto-resync : 27:06:2024 - 07:59:39
Diffstat (limited to 'sci-libs/hipBLASLt/hipBLASLt-6.1.1.ebuild')
-rw-r--r--sci-libs/hipBLASLt/hipBLASLt-6.1.1.ebuild120
1 files changed, 120 insertions, 0 deletions
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
+}