dev-util/Tensile: add 7.1.0

Signed-off-by: Patrick Lauer <patrick@gentoo.org>
This commit is contained in:
Patrick Lauer
2025-11-09 06:15:06 +00:00
parent b5e3956585
commit 252bc3f379
2 changed files with 158 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
DIST rocm-Tensile-6.3.3.tar.gz 12723968 BLAKE2B e8c14f85dd44767b685595180974d683d759f84fc044e98974beae107f78ec97d43de30232ea0bd3578aa6cd40e17309d603ce583925ed4dd65cc146241e5b7d SHA512 836e17aab29ace976595c5b3fbc6b1742c774eb0420488a1449e04649c424e5a877168cf71de96fddcfbad337e295206ec456aea7649fe9e67a8802739ddbabe
DIST rocm-Tensile-6.4.3.tar.gz 12731564 BLAKE2B b679ecf84cd023eecec8cef58729709f60b77615a76bc3215607c4e605b6057fa1c00e230d8c0ec9b24ca7f31c8e2e99dbffdfc732c3268958ea33d60962e256 SHA512 3d358d212ad52216520d391968578e3d6d7040f23c469e42b9fe6eea0a33034074df45d4a39a8978cc13f822f75a4cdfa850aa85c772ff4443276f9c4b9397a8
DIST rocm-Tensile-7.0.2.tar.gz 12056926 BLAKE2B 4e0af4789505b9fd2c813e7250eb7c1d877dbcce58dcf92828b1d5fc55fe9162aca65c3b8adfca541904fdaa660a620f579991868e3b3379428bf5e9f1f443de SHA512 1ad54d984d9334a4a2da0f10c268d72508e9e471a3bbc252bda7568eaadff83356a7c03726ca4908963ebd8e4bfebd227469766821ffc8418e3e68792f8e9fa1
DIST rocm-Tensile-7.1.0.tar.gz 12402002 BLAKE2B d6cbb5d18fa5770fe2d5f10a0268bdfe173a1721b6f94db98d39dbaa84d89612e60a832c84f8071794da1766176b6dd2bc6dac7a4404b4711f1546ab34e7d6af SHA512 9e2c011819622f0b292cf450edb65a32e661d44d37bb7b0478ac4e1cdeb1c9cceee4a594fb8466b8e8e94086f1b9eaaf8f746db3ffb78f9ef3f047146e7825ee

View File

@@ -0,0 +1,157 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
DISTUTILS_USE_PEP517=setuptools
ROCM_VERSION=${PV}
LLVM_COMPAT=( 20 )
inherit cmake distutils-r1 llvm-r1 prefix rocm
DESCRIPTION="A tool for creating a benchmark-driven GEMMs and tensor contractions code"
HOMEPAGE="https://rocm.docs.amd.com/projects/Tensile/en/latest/src/index.html"
if [[ "${PV}" == 9999 ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/ROCm/rocm-libraries.git"
EGIT_BRANCH="develop"
S="${WORKDIR}/${P}/shared/tensile"
SLOT="0/7.0"
else
SRC_URI="https://github.com/ROCm/Tensile/archive/rocm-${PV}.tar.gz -> rocm-Tensile-${PV}.tar.gz"
S="${WORKDIR}/${PN}-rocm-${PV}"
SLOT="0/$(ver_cut 1-2)"
KEYWORDS="~amd64"
fi
LICENSE="MIT"
IUSE="client test"
REQUIRED_USE="client? ( ${ROCM_REQUIRED_USE} )"
# tests can freeze machine depending on gpu/kernel
RESTRICT="test"
RDEPEND="${PYTHON_DEPS}
client? ( dev-libs/boost )
>=dev-cpp/msgpack-cxx-6.0.0
dev-python/pyyaml[${PYTHON_USEDEP}]
dev-python/msgpack[${PYTHON_USEDEP}]
dev-python/joblib[${PYTHON_USEDEP}]
dev-util/hip:${SLOT}
dev-util/rocm-smi:${SLOT}
$(llvm_gen_dep "
llvm-core/clang:\${LLVM_SLOT}
")
"
DEPEND="${RDEPEND}"
BDEPEND="
test? (
dev-python/pytest-forked[${PYTHON_USEDEP}]
dev-python/pytest-xdist[${PYTHON_USEDEP}]
dev-python/filelock[${PYTHON_USEDEP}]
dev-python/joblib[${PYTHON_USEDEP}]
)
"
distutils_enable_tests pytest
PATCHES=(
"${FILESDIR}"/${PN}-5.4.2-fix-arch-parse.patch
"${FILESDIR}"/${PN}-6.0.2-expand-isa-compatibility.patch
"${FILESDIR}"/${PN}-7.0.1-fix-install.patch
)
CMAKE_USE_DIR="${S}/${PN}/Source"
src_prepare() {
distutils-r1_src_prepare
sed -e "s,\@LLVM_PATH\@,$(get_llvm_prefix),g" \
"${FILESDIR}/${PN}-5.7.1-gentoopath.patch" > "${S}"/gentoopath.patch || die
eapply $(prefixify_ro "${S}"/gentoopath.patch)
pushd "${PN}" || die
sed -e "/ROCM_SMI_ROOT/s,lib,$(get_libdir)," \
-i Source/cmake/FindROCmSMI.cmake || die
sed -r -e "/TENSILE_USE_LLVM/s/ON/OFF/" \
-i Source/CMakeLists.txt || die
# ${Tensile_ROOT}/bin does not exists; call command directly
sed -e "s,\${Tensile_ROOT}/bin/,,g" -i cmake/TensileConfig.cmake || die
local Tensile_share_dir="\"${EPREFIX}/usr/share/${PN}\""
sed -e "/HipClangVersion/s/0.0.0/$(hipconfig -v)/" -i Common.py || die
sed -e "s,os.path.dirname(os.path.realpath(__file__)),${Tensile_share_dir},g" \
-i ReplacementKernels.py Common.py "${PN}.py" || die
sed -e "s|os\.path\.dirname.*$|\"${EPREFIX}/usr/share/Tensile/Source\", end='')|" -i __init__.py || die
# bug 949817: fix v_dot4_i32_i8 syntax for clang-20
sed 's/ op_sel:\[0,0\] op_sel_hi:\[1,1\]//' -i Components/MAC_I8X4.py || die
# Fix compiler "validation"
rocm_use_clang
sed "s/amdclang/$(basename "$CC")/g" -i Utilities/Toolchain.py || die
popd || die
use client && PATCHES='' cmake_src_prepare # do not apply patches again in cmake_src_prepare
}
src_configure() {
rocm_use_clang
distutils-r1_src_configure
if use client; then
local mycmakeargs=(
-DCMAKE_SKIP_RPATH=ON
-DTENSILE_USE_MSGPACK=ON
-DTENSILE_USE_LLVM=ON
-DTensile_LIBRARY_FORMAT=msgpack
-DAMDGPU_TARGETS="$(get_amdgpu_flags)"
)
cmake_src_configure
fi
}
src_compile() {
distutils-r1_src_compile
use client && cmake_src_compile
}
python_install() {
distutils-r1_python_install
python_moduleinto Tensile
pushd Tensile || die
python_domodule Components
python_domodule Utilities
python_domodule TensileCreateLib
}
src_install() {
distutils-r1_src_install
pushd "${PN}" || die
insinto "/usr/share/${PN}"
doins -r Configs Perf Source CustomKernels
insinto "/usr/$(get_libdir)/cmake/${PN}"
doins cmake/*.cmake
if use client; then
pushd "${BUILD_DIR}" || die
dobin client/tensile_client
fi
# Remove extra copy
rm -rf "${ED}"/usr/cmake || die
}
# Test suite fails to start without this
python_test() {
export ROCM_PATH="${EPREFIX}/usr"
epytest
}