diff options
author | Yiyang Wu <xgreenlandforwyy@gmail.com> | 2023-02-11 18:43:46 +0800 |
---|---|---|
committer | Marek Szuba <marecki@gentoo.org> | 2023-02-24 16:49:51 +0000 |
commit | 523d7b2ee32d79b44796efa2c08f0b897c633801 (patch) | |
tree | 79ebdf80ee4d63f06c5e31833d6f38814030adfb /dev-util/Tensile | |
parent | dev-util/Tensile: Fix create library step in Tensile command (diff) | |
download | gentoo-523d7b2ee32d79b44796efa2c08f0b897c633801.tar.gz gentoo-523d7b2ee32d79b44796efa2c08f0b897c633801.tar.bz2 gentoo-523d7b2ee32d79b44796efa2c08f0b897c633801.zip |
dev-util/Tensile: add client USE to compile tensile_client
tensile_client is for running benchmarks. By default, Tensile contains a
whole set of scripts to configure and compile tensile_client via cmake
for very benchmark. This commit enables a use flag to compile and
install this executable, so at runtime benchmark won't need to compile
again.
Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'dev-util/Tensile')
-rw-r--r-- | dev-util/Tensile/Tensile-5.4.2.ebuild | 32 | ||||
-rw-r--r-- | dev-util/Tensile/files/0001-Detect-prebuilt-tensile_client-in-PATH.patch | 33 | ||||
-rw-r--r-- | dev-util/Tensile/metadata.xml | 3 |
3 files changed, 66 insertions, 2 deletions
diff --git a/dev-util/Tensile/Tensile-5.4.2.ebuild b/dev-util/Tensile/Tensile-5.4.2.ebuild index 9a12444e7abf..8c23e68fdb21 100644 --- a/dev-util/Tensile/Tensile-5.4.2.ebuild +++ b/dev-util/Tensile/Tensile-5.4.2.ebuild @@ -5,7 +5,8 @@ EAPI=8 PYTHON_COMPAT=( python3_{10..11} ) DISTUTILS_USE_PEP517=setuptools -inherit distutils-r1 llvm prefix +ROCM_VERSION=${PV} +inherit cmake distutils-r1 llvm prefix rocm LLVM_MAX_SLOT=15 @@ -17,6 +18,8 @@ S="${WORKDIR}/${PN}-rocm-${PV}" LICENSE="MIT" KEYWORDS="~amd64" SLOT="0/$(ver_cut 1-2)" +IUSE="client" +REQUIRED_USE="client? ( ${ROCM_REQUIRED_USE} )" # Not compatible with recent versions of pytest RESTRICT="test" @@ -38,7 +41,7 @@ PATCHES=( "${FILESDIR}"/${PN}-4.3.0-output-commands.patch "${FILESDIR}"/0001-Change-cmake-name-for-msgpack-5-release.patch ) -CMAKE_USE_DIR="${WORKDIR}/Source" +CMAKE_USE_DIR="${S}/${PN}/Source" src_prepare() { distutils-r1_src_prepare @@ -68,6 +71,26 @@ src_prepare() { 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() { @@ -87,4 +110,9 @@ src_install() { doins -r Configs Perf ReplacementKernels ReplacementKernels-cov3 Source CustomKernels insinto /usr/$(get_libdir)/cmake/${PN} doins cmake/*.cmake + + if use client; then + pushd "${BUILD_DIR}" || die + dobin client/tensile_client + fi } diff --git a/dev-util/Tensile/files/0001-Detect-prebuilt-tensile_client-in-PATH.patch b/dev-util/Tensile/files/0001-Detect-prebuilt-tensile_client-in-PATH.patch new file mode 100644 index 000000000000..116711db44fc --- /dev/null +++ b/dev-util/Tensile/files/0001-Detect-prebuilt-tensile_client-in-PATH.patch @@ -0,0 +1,33 @@ +From 3c806ec52f46d0a1f770f524d1e4f0ffeb8809c2 Mon Sep 17 00:00:00 2001 +From: Yiyang Wu <xgreenlandforwyy@gmail.com> +Date: Sat, 11 Feb 2023 17:48:08 +0800 +Subject: [PATCH] Detect prebuilt tensile_client in PATH + +--- + Tensile/Tensile.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Tensile/Tensile.py b/Tensile/Tensile.py +index 961ea88f..123f8a7a 100644 +--- a/Tensile/Tensile.py ++++ b/Tensile/Tensile.py +@@ -38,6 +38,7 @@ from . import LibraryIO + from . import LibraryLogic + from . import __version__ + from datetime import datetime ++from shutil import which + + + ############################################################################### +@@ -127,7 +128,7 @@ def addCommonArguments(argParser): + action="store", help="select which library format to use") + argParser.add_argument("--client-build-path", default=None) + argParser.add_argument("--client-lock", default=None) +- argParser.add_argument("--prebuilt-client", default=None) ++ argParser.add_argument("--prebuilt-client", default=which("tensile_client")) + + argParser.add_argument("--global-parameters", nargs="+", type=splitExtraParameters, default=[]) + +-- +2.39.1 + diff --git a/dev-util/Tensile/metadata.xml b/dev-util/Tensile/metadata.xml index 97a4d2e3c600..32364cb13b06 100644 --- a/dev-util/Tensile/metadata.xml +++ b/dev-util/Tensile/metadata.xml @@ -8,4 +8,7 @@ <upstream> <remote-id type="github">ROCmSoftwarePlatform/Tensile</remote-id> </upstream> + <use> + <flag name="client">Build and install tensile_client executable to run benchmarks and tune GPU GEMM</flag> + </use> </pkgmetadata> |