diff options
author | Sv. Lockal <lockalsash@gmail.com> | 2024-03-17 18:05:41 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-06-26 10:19:13 +0100 |
commit | 3c5c14db790c3477d1a5ccdc46553adfcbd9079a (patch) | |
tree | cdc67a0ad510ff0f235b2c7fccc975cc9003a8e2 | |
parent | dev-libs/rccl: add 6.1.1 (diff) | |
download | gentoo-3c5c14db790c3477d1a5ccdc46553adfcbd9079a.tar.gz gentoo-3c5c14db790c3477d1a5ccdc46553adfcbd9079a.tar.bz2 gentoo-3c5c14db790c3477d1a5ccdc46553adfcbd9079a.zip |
dev-util/Tensile: add 6.1.1
Changes:
* fix USE=test dependency for dev-python/joblib (in 5.7.1 and 6.1.1)
* ReplacementKernels-cov3 directory does not exist anymore
* update expand-isa-compatibility patch to not use removed gcnArch field
* update llvm eclass to r1
* add LLVM_COMPAT 18
Signed-off-by: Sv. Lockal <lockalsash@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | dev-util/Tensile/Manifest | 1 | ||||
-rw-r--r-- | dev-util/Tensile/Tensile-5.7.1-r2.ebuild | 1 | ||||
-rw-r--r-- | dev-util/Tensile/Tensile-6.1.1.ebuild | 136 | ||||
-rw-r--r-- | dev-util/Tensile/files/Tensile-6.0.2-expand-isa-compatibility.patch | 34 | ||||
-rw-r--r-- | dev-util/Tensile/files/Tensile-6.1.1-fix-msgpack-dependency.patch | 31 |
5 files changed, 203 insertions, 0 deletions
diff --git a/dev-util/Tensile/Manifest b/dev-util/Tensile/Manifest index 4d93ffa204a1..fb95e0c702e7 100644 --- a/dev-util/Tensile/Manifest +++ b/dev-util/Tensile/Manifest @@ -2,3 +2,4 @@ DIST Tensile-5.0.2-PR1419.patch.gz 43754 BLAKE2B 3b1d7333ed0115f77816806e7735e25 DIST rocm-Tensile-5.1.3.tar.gz 14357517 BLAKE2B 7c5881cc2b1d25db39f54a99f9f0a08395a5f7a58deebe74d9868e8f7044db5ae2f3907196adf16dc6abeba0f1f47f5cce5c8900891276daff8e4ad614cf3b94 SHA512 4405cb6de65c1da1fd93910fc901402a24e996ff04eccadf483c25d8eb518e03ea9bbf00e372dd5fe377696e71c39355603095f3c5fc1e26d311ed15d8e3b734 DIST rocm-Tensile-5.4.2.tar.gz 14413805 BLAKE2B ca1c13785164439f6fe83f16b36b7a0b06a63b70b9f0741d77b0fff98f38d1e1c7e9a54ef61897e6eb0a4eaf52ec9e5f14f42a7e6fd657f26306afa3de0c74a2 SHA512 d99736a202c7353979e732941199b4b20e53ff2b6c19a7175609440a840aa5624bc53a8013c435f31ac37933527771521ff02137c1c8fd53c5317eca8533be80 DIST rocm-Tensile-5.7.1.tar.gz 12396002 BLAKE2B ec2c2bc3f07fe22abd800b642c998ea80b9e4e2d0d28c4763d574dbd2fcb14c735223ddc7571d4ab3a48f0bd819cc835c16df9882049c5bf56f25ef729e6d654 SHA512 8f356f36cfec74ee9b000d1180cf52077dc5c595e5c5a40792fc3eb13f3139980c7440f9bc912218f946cf8137e2481d23fe39f110511c1bb55fe85a933ffd36 +DIST rocm-Tensile-6.1.1.tar.gz 12675289 BLAKE2B dfe3698d7dda14d5b20a6fe1ef6535ac9737ac330b71678a3a94e939adc2350e2dcf33e58c711ee90dae543efba59fe210bfa39fc69b63910ec4537db3f209bf SHA512 cf8b014b1ff7cd5d45236b8a9a6f5604b02e34a9245a163c672847b535d565151bf7e3a5127601681e80e6fe26964a0e544594044efe2fe68e39b0f1128f96e2 diff --git a/dev-util/Tensile/Tensile-5.7.1-r2.ebuild b/dev-util/Tensile/Tensile-5.7.1-r2.ebuild index 94b4aac75b1b..64902c86549c 100644 --- a/dev-util/Tensile/Tensile-5.7.1-r2.ebuild +++ b/dev-util/Tensile/Tensile-5.7.1-r2.ebuild @@ -38,6 +38,7 @@ BDEPEND=" dev-python/pytest-forked[${PYTHON_USEDEP}] dev-python/pytest-xdist[${PYTHON_USEDEP}] dev-python/filelock[${PYTHON_USEDEP}] + dev-python/joblib[${PYTHON_USEDEP}] ) " diff --git a/dev-util/Tensile/Tensile-6.1.1.ebuild b/dev-util/Tensile/Tensile-6.1.1.ebuild new file mode 100644 index 000000000000..fcb77f77972d --- /dev/null +++ b/dev-util/Tensile/Tensile-6.1.1.ebuild @@ -0,0 +1,136 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) +DISTUTILS_USE_PEP517=setuptools +ROCM_VERSION=${PV} +LLVM_COMPAT=( 18 ) + +inherit cmake distutils-r1 llvm-r1 prefix rocm + +DESCRIPTION="Stretching GPU performance for GEMMs and tensor contractions" +HOMEPAGE="https://github.com/ROCmSoftwarePlatform/Tensile" +SRC_URI="https://github.com/ROCmSoftwarePlatform/Tensile/archive/rocm-${PV}.tar.gz -> rocm-Tensile-${PV}.tar.gz" +S="${WORKDIR}/${PN}-rocm-${PV}" + +LICENSE="MIT" +SLOT="0/$(ver_cut 1-2)" +KEYWORDS="~amd64" +IUSE="client test" +REQUIRED_USE="client? ( ${ROCM_REQUIRED_USE} )" + +RESTRICT="!test? ( 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-util/hip-6* + >=dev-util/rocm-smi-4.3.0 + $(llvm_gen_dep ' + sys-devel/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}-4.3.0-output-commands.patch + "${FILESDIR}"/${PN}-5.4.2-fix-arch-parse.patch + "${FILESDIR}"/${PN}-5.4.2-use-ninja.patch + "${FILESDIR}"/${PN}-6.1.1-fix-msgpack-dependency.patch + "${FILESDIR}"/${PN}-6.0.2-expand-isa-compatibility.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 + + popd || die + + sed -e "/package_data/d" -e "/data_files/d" -i setup.py || die + use client && PATCHES= cmake_src_prepare # do not apply patches again in cmake_src_prepare +} + +src_configure() { + 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)" + ) + CXX=hipcc 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_newexe Utilities/merge.py ${PN}-merge +} + +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 +} + +# Test suite fails to start without this +python_test() { + export ROCM_PATH="${EPREFIX}/usr" + epytest +} diff --git a/dev-util/Tensile/files/Tensile-6.0.2-expand-isa-compatibility.patch b/dev-util/Tensile/files/Tensile-6.0.2-expand-isa-compatibility.patch new file mode 100644 index 000000000000..7a72d833bba0 --- /dev/null +++ b/dev-util/Tensile/files/Tensile-6.0.2-expand-isa-compatibility.patch @@ -0,0 +1,34 @@ +diff --git a/Tensile/Source/lib/source/hip/HipHardware.cpp b/Tensile/Source/lib/source/hip/HipHardware.cpp +index ffa4f0f..f894366 100644 +--- a/Tensile/Source/lib/source/hip/HipHardware.cpp ++++ b/Tensile/Source/lib/source/hip/HipHardware.cpp +@@ -24,6 +24,8 @@ + * + *******************************************************************************/ + ++#include <cstring> ++ + #include <Tensile/AMDGPU.hpp> + #include <Tensile/hip/HipHardware.hpp> + #include <Tensile/hip/HipUtils.hpp> +@@ -55,6 +57,20 @@ namespace Tensile + { + hipDeviceProp_t prop; + HIP_CHECK_EXC(hipGetDeviceProperties(&prop, deviceId)); ++ // coerce to compatible arch ++ int gcnArch = strncmp(prop.gcnArchName, "gfx", 3) == 0 ? std::stoi(prop.gcnArchName + 3) : 0; ++ switch(gcnArch) ++ { ++ case 902: case 909: case 912: ++ std::strcpy(prop.gcnArchName, "gfx900"); ++ break; ++ case 1013: ++ std::strcpy(prop.gcnArchName, "gfx1010"); ++ break; ++ case 1031: case 1032: case 1033: case 1034: case 1035: case 1036: ++ std::strcpy(prop.gcnArchName, "gfx1030"); ++ break; ++ } + #if HIP_VERSION >= 50220730 + int hip_version; + HIP_CHECK_EXC(hipRuntimeGetVersion(&hip_version)); diff --git a/dev-util/Tensile/files/Tensile-6.1.1-fix-msgpack-dependency.patch b/dev-util/Tensile/files/Tensile-6.1.1-fix-msgpack-dependency.patch new file mode 100644 index 000000000000..7a3b1884c074 --- /dev/null +++ b/dev-util/Tensile/files/Tensile-6.1.1-fix-msgpack-dependency.patch @@ -0,0 +1,31 @@ +Gentoo uses "msgpack-cxx" as library name and adds important +MSGPACK_NO_BOOST compile definition when msgpack-cxx us installed with USE=-boost +--- a/Tensile/Source/lib/CMakeLists.txt ++++ b/Tensile/Source/lib/CMakeLists.txt +@@ -98,24 +98,9 @@ if(TENSILE_USE_LLVM OR TENSILE_USE_MSGPACK) + endif() + + if(TENSILE_USE_MSGPACK) +- find_package(msgpack REQUIRED NAMES msgpack msgpack-cxx msgpack-c) ++ 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) +- elseif(TARGET msgpack-cxx) +- get_target_property(msgpack_inc msgpack-cxx 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) |