1 |
commit: 3b32497070812f973e5064f9ada07ab5d404b402 |
2 |
Author: Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com> |
3 |
AuthorDate: Fri Jan 20 09:58:17 2023 +0000 |
4 |
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jan 31 14:26:37 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b324970 |
7 |
|
8 |
dev-util/Tensile: add 5.4.2 |
9 |
|
10 |
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com> |
11 |
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org> |
12 |
|
13 |
dev-util/Tensile/Manifest | 1 + |
14 |
dev-util/Tensile/Tensile-5.4.2.ebuild | 89 ++++++++++++++++++++++ |
15 |
.../Tensile/files/Tensile-5.4.2-gentoopath.patch | 67 ++++++++++++++++ |
16 |
.../Tensile/files/Tensile-5.4.2-use-ninja.patch | 21 +++++ |
17 |
4 files changed, 178 insertions(+) |
18 |
|
19 |
diff --git a/dev-util/Tensile/Manifest b/dev-util/Tensile/Manifest |
20 |
index c3f43afdabe4..dd1df20ec814 100644 |
21 |
--- a/dev-util/Tensile/Manifest |
22 |
+++ b/dev-util/Tensile/Manifest |
23 |
@@ -1,3 +1,4 @@ |
24 |
DIST Tensile-5.0.2-PR1419.patch.gz 43754 BLAKE2B 3b1d7333ed0115f77816806e7735e25d897dbae3f7a40ece61d655c8f016d9d1c804b586b4e0e75661e20c517f5937a61d5ead25a545f0ce2e4a178bcbb3e7be SHA512 0154d8e14d335f4ecd86e5db335289f8662cede7e5d4b93bf6c56d8e48c1d7d0457271c078c9abbbca1f4aa91f028f6ce6a89efb783ba0207d0f39fd5de8a42c |
25 |
DIST rocm-Tensile-5.0.2.tar.gz 14362090 BLAKE2B d44c3135496db41c4eb2545f6054c84493e89ef6357da881dae6859763338417e7a9e142cdce7e2de0536684bb641049ad0440964adbe68d03ca329f01efabc9 SHA512 f5ab7d7cbc5ba25498a02a6b7c07d5a9a548edcd44b439b92c8718072382adc18ae78274db1a7174e06436ac1396f3b4edafc7f491a2c87086c368e7270e64e3 |
26 |
DIST rocm-Tensile-5.1.3.tar.gz 14357517 BLAKE2B 7c5881cc2b1d25db39f54a99f9f0a08395a5f7a58deebe74d9868e8f7044db5ae2f3907196adf16dc6abeba0f1f47f5cce5c8900891276daff8e4ad614cf3b94 SHA512 4405cb6de65c1da1fd93910fc901402a24e996ff04eccadf483c25d8eb518e03ea9bbf00e372dd5fe377696e71c39355603095f3c5fc1e26d311ed15d8e3b734 |
27 |
+DIST rocm-Tensile-5.4.2.tar.gz 14413805 BLAKE2B ca1c13785164439f6fe83f16b36b7a0b06a63b70b9f0741d77b0fff98f38d1e1c7e9a54ef61897e6eb0a4eaf52ec9e5f14f42a7e6fd657f26306afa3de0c74a2 SHA512 d99736a202c7353979e732941199b4b20e53ff2b6c19a7175609440a840aa5624bc53a8013c435f31ac37933527771521ff02137c1c8fd53c5317eca8533be80 |
28 |
|
29 |
diff --git a/dev-util/Tensile/Tensile-5.4.2.ebuild b/dev-util/Tensile/Tensile-5.4.2.ebuild |
30 |
new file mode 100644 |
31 |
index 000000000000..09bccd0ab2dd |
32 |
--- /dev/null |
33 |
+++ b/dev-util/Tensile/Tensile-5.4.2.ebuild |
34 |
@@ -0,0 +1,89 @@ |
35 |
+# Copyright 1999-2023 Gentoo Authors |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+EAPI=8 |
39 |
+ |
40 |
+PYTHON_COMPAT=( python3_{10..11} ) |
41 |
+DISTUTILS_USE_PEP517=setuptools |
42 |
+inherit distutils-r1 llvm prefix |
43 |
+ |
44 |
+LLVM_MAX_SLOT=15 |
45 |
+ |
46 |
+DESCRIPTION="Stretching GPU performance for GEMMs and tensor contractions" |
47 |
+HOMEPAGE="https://github.com/ROCmSoftwarePlatform/Tensile" |
48 |
+SRC_URI="https://github.com/ROCmSoftwarePlatform/Tensile/archive/rocm-${PV}.tar.gz -> rocm-Tensile-${PV}.tar.gz" |
49 |
+S="${WORKDIR}/${PN}-rocm-${PV}" |
50 |
+ |
51 |
+LICENSE="MIT" |
52 |
+KEYWORDS="~amd64" |
53 |
+SLOT="0/$(ver_cut 1-2)" |
54 |
+ |
55 |
+# Not compatible with recent versions of pytest |
56 |
+RESTRICT="test" |
57 |
+ |
58 |
+RDEPEND="${PYTHON_DEPS} |
59 |
+ sys-devel/clang:${LLVM_MAX_SLOT} |
60 |
+ dev-python/pyyaml[${PYTHON_USEDEP}] |
61 |
+ dev-python/msgpack[${PYTHON_USEDEP}] |
62 |
+ >=dev-util/rocm-smi-4.3.0 |
63 |
+" |
64 |
+DEPEND="${RDEPEND} |
65 |
+ dev-util/hip |
66 |
+" |
67 |
+ |
68 |
+PATCHES=( "${FILESDIR}"/${PN}-4.3.0-output-commands.patch |
69 |
+ "${FILESDIR}"/${PN}-5.3.3-gfx1031.patch |
70 |
+ "${FILESDIR}"/${PN}-5.3.3-fix-arch-parse.patch |
71 |
+ "${FILESDIR}"/${PN}-5.4.2-use-ninja.patch |
72 |
+ ) |
73 |
+ |
74 |
+CMAKE_USE_DIR="${WORKDIR}/Source" |
75 |
+ |
76 |
+src_prepare() { |
77 |
+ distutils-r1_src_prepare |
78 |
+ sed -e "s,\@LLVM_PATH\@,$(get_llvm_prefix ${LLVM_MAX_SLOT}),g" \ |
79 |
+ "${FILESDIR}"/${PN}-5.4.2-gentoopath.patch > "${S}"/gentoopath.patch || die |
80 |
+ eapply $(prefixify_ro "${S}"/gentoopath.patch) |
81 |
+ |
82 |
+ pushd ${PN} || die |
83 |
+ |
84 |
+ sed -e "/ROCM_SMI_ROOT/s,lib,$(get_libdir)," \ |
85 |
+ -i Source/cmake/FindROCmSMI.cmake || die |
86 |
+ sed -r -e "/TENSILE_USE_LLVM/s/ON/OFF/" \ |
87 |
+ -i Source/CMakeLists.txt || die |
88 |
+ sed -e "/chmod 755/d" -i Source/TensileCreateLibrary.cmake || die # remove chmod 755 on |
89 |
+ |
90 |
+ # ${Tensile_ROOT}/bin does not exists; call command directly |
91 |
+ sed -e "s,\${Tensile_ROOT}/bin/,,g" -i Source/TensileCreateLibrary.cmake cmake/TensileConfig.cmake || die |
92 |
+ |
93 |
+ local Tensile_share_dir="\"${EPREFIX}/usr/share/${PN}\"" |
94 |
+ sed -e "/HipClangVersion/s/0.0.0/$(hipconfig -v)/" -i Common.py || die |
95 |
+ |
96 |
+ sed -e "s,os.path.dirname(os.path.realpath(__file__)),${Tensile_share_dir},g" \ |
97 |
+ -i ReplacementKernels.py Common.py ${PN}.py || die |
98 |
+ |
99 |
+ sed -e "s|os\.path\.dirname.*$|\"${EPREFIX}/usr/share/Tensile/Source\", end='')|" -i __init__.py || die |
100 |
+ |
101 |
+ popd || die |
102 |
+ |
103 |
+ sed -e "/package_data/d" -e "/data_files/d" -i setup.py || die |
104 |
+} |
105 |
+ |
106 |
+python_install() { |
107 |
+ distutils-r1_python_install |
108 |
+ |
109 |
+ python_moduleinto Tensile |
110 |
+ pushd Tensile || die |
111 |
+ python_domodule Components |
112 |
+ python_newexe Utilities/merge.py ${PN}-merge |
113 |
+} |
114 |
+ |
115 |
+src_install() { |
116 |
+ distutils-r1_src_install |
117 |
+ |
118 |
+ pushd ${PN} || die |
119 |
+ insinto /usr/share/${PN} |
120 |
+ doins -r Configs Perf ReplacementKernels ReplacementKernels-cov3 Source CustomKernels |
121 |
+ insinto /usr/$(get_libdir)/cmake/${PN} |
122 |
+ doins cmake/*.cmake |
123 |
+} |
124 |
|
125 |
diff --git a/dev-util/Tensile/files/Tensile-5.4.2-gentoopath.patch b/dev-util/Tensile/files/Tensile-5.4.2-gentoopath.patch |
126 |
new file mode 100644 |
127 |
index 000000000000..2aed8082de05 |
128 |
--- /dev/null |
129 |
+++ b/dev-util/Tensile/files/Tensile-5.4.2-gentoopath.patch |
130 |
@@ -0,0 +1,67 @@ |
131 |
+Fix incorrect path in scripts and CMakeLists, in order to build tensile_client |
132 |
+=================================================================== |
133 |
+Index: Tensile-rocm-5.4.2/Tensile/Source/lib/CMakeLists.txt |
134 |
+=================================================================== |
135 |
+--- Tensile-rocm-5.4.2.orig/Tensile/Source/lib/CMakeLists.txt |
136 |
++++ Tensile-rocm-5.4.2/Tensile/Source/lib/CMakeLists.txt |
137 |
+@@ -51,7 +51,7 @@ set(tensile_sources ${tensile_sources} |
138 |
+ ) |
139 |
+ |
140 |
+ if(TENSILE_USE_LLVM) |
141 |
+- find_package(LLVM 13.0 QUIET CONFIG) |
142 |
++ find_package(LLVM PATHS @LLVM_PATH@ QUIET CONFIG) |
143 |
+ if(NOT LLVM_FOUND) |
144 |
+ find_package(LLVM 12.0 QUIET CONFIG) |
145 |
+ if(NOT LLVM_FOUND) |
146 |
+Index: Tensile-rocm-5.4.2/Tensile/Common.py |
147 |
+=================================================================== |
148 |
+--- Tensile-rocm-5.4.2.orig/Tensile/Common.py |
149 |
++++ Tensile-rocm-5.4.2/Tensile/Common.py |
150 |
+@@ -1950,7 +1950,7 @@ def assignGlobalParameters( config ): |
151 |
+ else: |
152 |
+ print2(" %24s: %8s (unspecified)" % (key, defaultValue)) |
153 |
+ |
154 |
+- globalParameters["ROCmPath"] = "/opt/rocm" |
155 |
++ globalParameters["ROCmPath"] = "@GENTOO_PORTAGE_EPREFIX@/usr" |
156 |
+ if "ROCM_PATH" in os.environ: |
157 |
+ globalParameters["ROCmPath"] = os.environ.get("ROCM_PATH") |
158 |
+ if "TENSILE_ROCM_PATH" in os.environ: |
159 |
+Index: Tensile-rocm-5.4.2/Tensile/ClientWriter.py |
160 |
+=================================================================== |
161 |
+--- Tensile-rocm-5.4.2.orig/Tensile/ClientWriter.py |
162 |
++++ Tensile-rocm-5.4.2/Tensile/ClientWriter.py |
163 |
+@@ -180,7 +180,7 @@ def runClient(libraryLogicPath, forBench |
164 |
+ def getBuildClientLibraryScript(buildPath, libraryLogicPath): |
165 |
+ callCreateLibraryCmd = ["python"] if os.name == "nt" else [] |
166 |
+ |
167 |
+- callCreateLibraryCmd += [os.path.join(globalParameters["ScriptPath"] , "bin", "TensileCreateLibrary")] |
168 |
++ callCreateLibraryCmd += "TensileCreateLibrary" |
169 |
+ |
170 |
+ if globalParameters["MergeFiles"]: |
171 |
+ callCreateLibraryCmd += ["--merge-files"] |
172 |
+Index: Tensile-rocm-5.4.2/Tensile/GenerateSummations.py |
173 |
+=================================================================== |
174 |
+--- Tensile-rocm-5.4.2.orig/Tensile/GenerateSummations.py |
175 |
++++ Tensile-rocm-5.4.2/Tensile/GenerateSummations.py |
176 |
+@@ -59,7 +59,7 @@ def createLibraryForBenchmark(logicPath, |
177 |
+ Selection. |
178 |
+ """ |
179 |
+ |
180 |
+- pythonExePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin", "TensileCreateLibrary") |
181 |
++ pythonExePath = "TensileCreateLibrary" |
182 |
+ args = [pythonExePath, \ |
183 |
+ "--merge-files", "--new-client-only", "--no-short-file-names", "--no-library-print-debug", \ |
184 |
+ "--architecture=all", "--code-object-version=V3", "--cxx-compiler=hipcc", "--library-format=yaml", \ |
185 |
+Index: Tensile-rocm-5.4.2/HostLibraryTests/CMakeLists.txt |
186 |
+=================================================================== |
187 |
+--- Tensile-rocm-5.4.2.orig/HostLibraryTests/CMakeLists.txt |
188 |
++++ Tensile-rocm-5.4.2/HostLibraryTests/CMakeLists.txt |
189 |
+@@ -139,7 +139,7 @@ set(test_sources ${test_sources} |
190 |
+ ) |
191 |
+ |
192 |
+ if(TENSILE_USE_LLVM) |
193 |
+- find_package(LLVM 13.0 QUIET CONFIG) |
194 |
++ find_package(LLVM PATHS @LLVM_PATH@ QUIET CONFIG) |
195 |
+ if(NOT LLVM_FOUND) |
196 |
+ find_package(LLVM 12.0 QUIET CONFIG) |
197 |
+ if(NOT LLVM_FOUND) |
198 |
|
199 |
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 |
200 |
new file mode 100644 |
201 |
index 000000000000..f88bf00665cb |
202 |
--- /dev/null |
203 |
+++ b/dev-util/Tensile/files/Tensile-5.4.2-use-ninja.patch |
204 |
@@ -0,0 +1,21 @@ |
205 |
+Index: Tensile-rocm-5.4.2/Tensile/ClientExecutable.py |
206 |
+=================================================================== |
207 |
+--- Tensile-rocm-5.4.2.orig/Tensile/ClientExecutable.py |
208 |
++++ Tensile-rocm-5.4.2/Tensile/ClientExecutable.py |
209 |
+@@ -44,6 +44,7 @@ class CMakeEnvironment: |
210 |
+ args = ['cmake'] |
211 |
+ args += ['-G', 'Ninja'] if (os.name == 'nt') else [] |
212 |
+ args += itertools.chain.from_iterable([ ['-D{}={}'.format(key, value)] for key,value in self.options.items()]) |
213 |
++ args += itertools.chain.from_iterable([ ['-G', 'Ninja'], [ '-D', 'CMAKE_EXPORT_COMPILE_COMMANDS=ON' ] ]) |
214 |
+ args += [self.sourceDir] |
215 |
+ args = [cmake_path(arg) for arg in args] |
216 |
+ |
217 |
+@@ -53,7 +54,7 @@ class CMakeEnvironment: |
218 |
+ subprocess.check_output(args, stderr=subprocess.STDOUT, cwd=Common.ensurePath(self.buildDir)) |
219 |
+ |
220 |
+ def build(self): |
221 |
+- args = [('ninja' if (os.name == "nt") else 'make'), f'-j{CPUThreadCount()}'] |
222 |
++ args = [('ninja'), f'-j{CPUThreadCount()}'] |
223 |
+ Common.print2(' '.join(args)) |
224 |
+ with Common.ClientExecutionLock(): |
225 |
+ # change to use check_output to force windows cmd block util command finish |