diff options
author | Yiyang Wu <xgreenlandforwyy@gmail.com> | 2023-01-20 17:58:17 +0800 |
---|---|---|
committer | Benda Xu <heroxbd@gentoo.org> | 2023-01-31 22:26:37 +0800 |
commit | 3b32497070812f973e5064f9ada07ab5d404b402 (patch) | |
tree | 192cb930afee2c7b35db149049c28cd770c7c8f2 /dev-util/Tensile | |
parent | dev-util/rocprofiler: add 5.3.3 (diff) | |
download | gentoo-3b32497070812f973e5064f9ada07ab5d404b402.tar.gz gentoo-3b32497070812f973e5064f9ada07ab5d404b402.tar.bz2 gentoo-3b32497070812f973e5064f9ada07ab5d404b402.zip |
dev-util/Tensile: add 5.4.2
Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
Signed-off-by: Benda Xu <heroxbd@gentoo.org>
Diffstat (limited to 'dev-util/Tensile')
-rw-r--r-- | dev-util/Tensile/Manifest | 1 | ||||
-rw-r--r-- | dev-util/Tensile/Tensile-5.4.2.ebuild | 89 | ||||
-rw-r--r-- | dev-util/Tensile/files/Tensile-5.4.2-gentoopath.patch | 67 | ||||
-rw-r--r-- | dev-util/Tensile/files/Tensile-5.4.2-use-ninja.patch | 21 |
4 files changed, 178 insertions, 0 deletions
diff --git a/dev-util/Tensile/Manifest b/dev-util/Tensile/Manifest index c3f43afdabe4..dd1df20ec814 100644 --- a/dev-util/Tensile/Manifest +++ b/dev-util/Tensile/Manifest @@ -1,3 +1,4 @@ DIST Tensile-5.0.2-PR1419.patch.gz 43754 BLAKE2B 3b1d7333ed0115f77816806e7735e25d897dbae3f7a40ece61d655c8f016d9d1c804b586b4e0e75661e20c517f5937a61d5ead25a545f0ce2e4a178bcbb3e7be SHA512 0154d8e14d335f4ecd86e5db335289f8662cede7e5d4b93bf6c56d8e48c1d7d0457271c078c9abbbca1f4aa91f028f6ce6a89efb783ba0207d0f39fd5de8a42c DIST rocm-Tensile-5.0.2.tar.gz 14362090 BLAKE2B d44c3135496db41c4eb2545f6054c84493e89ef6357da881dae6859763338417e7a9e142cdce7e2de0536684bb641049ad0440964adbe68d03ca329f01efabc9 SHA512 f5ab7d7cbc5ba25498a02a6b7c07d5a9a548edcd44b439b92c8718072382adc18ae78274db1a7174e06436ac1396f3b4edafc7f491a2c87086c368e7270e64e3 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 diff --git a/dev-util/Tensile/Tensile-5.4.2.ebuild b/dev-util/Tensile/Tensile-5.4.2.ebuild new file mode 100644 index 000000000000..09bccd0ab2dd --- /dev/null +++ b/dev-util/Tensile/Tensile-5.4.2.ebuild @@ -0,0 +1,89 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..11} ) +DISTUTILS_USE_PEP517=setuptools +inherit distutils-r1 llvm prefix + +LLVM_MAX_SLOT=15 + +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" +KEYWORDS="~amd64" +SLOT="0/$(ver_cut 1-2)" + +# Not compatible with recent versions of pytest +RESTRICT="test" + +RDEPEND="${PYTHON_DEPS} + sys-devel/clang:${LLVM_MAX_SLOT} + dev-python/pyyaml[${PYTHON_USEDEP}] + dev-python/msgpack[${PYTHON_USEDEP}] + >=dev-util/rocm-smi-4.3.0 +" +DEPEND="${RDEPEND} + dev-util/hip +" + +PATCHES=( "${FILESDIR}"/${PN}-4.3.0-output-commands.patch + "${FILESDIR}"/${PN}-5.3.3-gfx1031.patch + "${FILESDIR}"/${PN}-5.3.3-fix-arch-parse.patch + "${FILESDIR}"/${PN}-5.4.2-use-ninja.patch + ) + +CMAKE_USE_DIR="${WORKDIR}/Source" + +src_prepare() { + distutils-r1_src_prepare + sed -e "s,\@LLVM_PATH\@,$(get_llvm_prefix ${LLVM_MAX_SLOT}),g" \ + "${FILESDIR}"/${PN}-5.4.2-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 + sed -e "/chmod 755/d" -i Source/TensileCreateLibrary.cmake || die # remove chmod 755 on + + # ${Tensile_ROOT}/bin does not exists; call command directly + sed -e "s,\${Tensile_ROOT}/bin/,,g" -i Source/TensileCreateLibrary.cmake 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 +} + +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 ReplacementKernels ReplacementKernels-cov3 Source CustomKernels + insinto /usr/$(get_libdir)/cmake/${PN} + doins cmake/*.cmake +} diff --git a/dev-util/Tensile/files/Tensile-5.4.2-gentoopath.patch b/dev-util/Tensile/files/Tensile-5.4.2-gentoopath.patch new file mode 100644 index 000000000000..2aed8082de05 --- /dev/null +++ b/dev-util/Tensile/files/Tensile-5.4.2-gentoopath.patch @@ -0,0 +1,67 @@ +Fix incorrect path in scripts and CMakeLists, in order to build tensile_client +=================================================================== +Index: Tensile-rocm-5.4.2/Tensile/Source/lib/CMakeLists.txt +=================================================================== +--- Tensile-rocm-5.4.2.orig/Tensile/Source/lib/CMakeLists.txt ++++ Tensile-rocm-5.4.2/Tensile/Source/lib/CMakeLists.txt +@@ -51,7 +51,7 @@ set(tensile_sources ${tensile_sources} + ) + + if(TENSILE_USE_LLVM) +- find_package(LLVM 13.0 QUIET CONFIG) ++ find_package(LLVM PATHS @LLVM_PATH@ QUIET CONFIG) + if(NOT LLVM_FOUND) + find_package(LLVM 12.0 QUIET CONFIG) + if(NOT LLVM_FOUND) +Index: Tensile-rocm-5.4.2/Tensile/Common.py +=================================================================== +--- Tensile-rocm-5.4.2.orig/Tensile/Common.py ++++ Tensile-rocm-5.4.2/Tensile/Common.py +@@ -1950,7 +1950,7 @@ def assignGlobalParameters( config ): + else: + print2(" %24s: %8s (unspecified)" % (key, defaultValue)) + +- globalParameters["ROCmPath"] = "/opt/rocm" ++ globalParameters["ROCmPath"] = "@GENTOO_PORTAGE_EPREFIX@/usr" + if "ROCM_PATH" in os.environ: + globalParameters["ROCmPath"] = os.environ.get("ROCM_PATH") + if "TENSILE_ROCM_PATH" in os.environ: +Index: Tensile-rocm-5.4.2/Tensile/ClientWriter.py +=================================================================== +--- Tensile-rocm-5.4.2.orig/Tensile/ClientWriter.py ++++ Tensile-rocm-5.4.2/Tensile/ClientWriter.py +@@ -180,7 +180,7 @@ def runClient(libraryLogicPath, forBench + def getBuildClientLibraryScript(buildPath, libraryLogicPath): + callCreateLibraryCmd = ["python"] if os.name == "nt" else [] + +- callCreateLibraryCmd += [os.path.join(globalParameters["ScriptPath"] , "bin", "TensileCreateLibrary")] ++ callCreateLibraryCmd += "TensileCreateLibrary" + + if globalParameters["MergeFiles"]: + callCreateLibraryCmd += ["--merge-files"] +Index: Tensile-rocm-5.4.2/Tensile/GenerateSummations.py +=================================================================== +--- Tensile-rocm-5.4.2.orig/Tensile/GenerateSummations.py ++++ Tensile-rocm-5.4.2/Tensile/GenerateSummations.py +@@ -59,7 +59,7 @@ def createLibraryForBenchmark(logicPath, + Selection. + """ + +- pythonExePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin", "TensileCreateLibrary") ++ pythonExePath = "TensileCreateLibrary" + args = [pythonExePath, \ + "--merge-files", "--new-client-only", "--no-short-file-names", "--no-library-print-debug", \ + "--architecture=all", "--code-object-version=V3", "--cxx-compiler=hipcc", "--library-format=yaml", \ +Index: Tensile-rocm-5.4.2/HostLibraryTests/CMakeLists.txt +=================================================================== +--- Tensile-rocm-5.4.2.orig/HostLibraryTests/CMakeLists.txt ++++ Tensile-rocm-5.4.2/HostLibraryTests/CMakeLists.txt +@@ -139,7 +139,7 @@ set(test_sources ${test_sources} + ) + + if(TENSILE_USE_LLVM) +- find_package(LLVM 13.0 QUIET CONFIG) ++ find_package(LLVM PATHS @LLVM_PATH@ QUIET CONFIG) + if(NOT LLVM_FOUND) + find_package(LLVM 12.0 QUIET CONFIG) + if(NOT LLVM_FOUND) diff --git a/dev-util/Tensile/files/Tensile-5.4.2-use-ninja.patch b/dev-util/Tensile/files/Tensile-5.4.2-use-ninja.patch new file mode 100644 index 000000000000..f88bf00665cb --- /dev/null +++ b/dev-util/Tensile/files/Tensile-5.4.2-use-ninja.patch @@ -0,0 +1,21 @@ +Index: Tensile-rocm-5.4.2/Tensile/ClientExecutable.py +=================================================================== +--- Tensile-rocm-5.4.2.orig/Tensile/ClientExecutable.py ++++ Tensile-rocm-5.4.2/Tensile/ClientExecutable.py +@@ -44,6 +44,7 @@ class CMakeEnvironment: + args = ['cmake'] + args += ['-G', 'Ninja'] if (os.name == 'nt') else [] + args += itertools.chain.from_iterable([ ['-D{}={}'.format(key, value)] for key,value in self.options.items()]) ++ args += itertools.chain.from_iterable([ ['-G', 'Ninja'], [ '-D', 'CMAKE_EXPORT_COMPILE_COMMANDS=ON' ] ]) + args += [self.sourceDir] + args = [cmake_path(arg) for arg in args] + +@@ -53,7 +54,7 @@ class CMakeEnvironment: + subprocess.check_output(args, stderr=subprocess.STDOUT, cwd=Common.ensurePath(self.buildDir)) + + def build(self): +- args = [('ninja' if (os.name == "nt") else 'make'), f'-j{CPUThreadCount()}'] ++ args = [('ninja'), f'-j{CPUThreadCount()}'] + Common.print2(' '.join(args)) + with Common.ClientExecutionLock(): + # change to use check_output to force windows cmd block util command finish |