Gentoo Archives: gentoo-commits

From: Benda XU <heroxbd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/files/, dev-util/Tensile/
Date: Sun, 27 Mar 2022 03:13:03
Message-Id: 1648350771.f4aae2060ce38589b7fc56c5fcd165b291ffa986.heroxbd@gentoo
1 commit: f4aae2060ce38589b7fc56c5fcd165b291ffa986
2 Author: YiyangWu <xgreenlandforwyy <AT> gmail <DOT> com>
3 AuthorDate: Tue Mar 22 09:27:48 2022 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 27 03:12:51 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4aae206
7
8 dev-util/Tensile: bump version to 5.0.2
9
10 Package-Manager: Portage-3.0.30, Repoman-3.0.3
11 Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
12 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
13
14 dev-util/Tensile/Manifest | 2 +
15 dev-util/Tensile/Tensile-5.0.2.ebuild | 83 ++++++++++++++++
16 .../files/Tensile-5.0.2-fix-arch-parse.patch | 12 +++
17 .../Tensile/files/Tensile-5.0.2-gentoopath.patch | 75 +++++++++++++++
18 dev-util/Tensile/files/Tensile-5.0.2-gfx1031.patch | 104 +++++++++++++++++++++
19 .../Tensile/files/Tensile-5.0.2-use-ninja.patch | 21 +++++
20 6 files changed, 297 insertions(+)
21
22 diff --git a/dev-util/Tensile/Manifest b/dev-util/Tensile/Manifest
23 index fd4cac044af8..c3e8f48bab20 100644
24 --- a/dev-util/Tensile/Manifest
25 +++ b/dev-util/Tensile/Manifest
26 @@ -1 +1,3 @@
27 +DIST Tensile-5.0.2-PR1419.patch.gz 43754 BLAKE2B 3b1d7333ed0115f77816806e7735e25d897dbae3f7a40ece61d655c8f016d9d1c804b586b4e0e75661e20c517f5937a61d5ead25a545f0ce2e4a178bcbb3e7be SHA512 0154d8e14d335f4ecd86e5db335289f8662cede7e5d4b93bf6c56d8e48c1d7d0457271c078c9abbbca1f4aa91f028f6ce6a89efb783ba0207d0f39fd5de8a42c
28 DIST rocm-Tensile-4.3.0.tar.gz 14250149 BLAKE2B 030138eaca2a0aadd96801e6dbd72e510716dd90553ef3795c5e04e00a34a05ecae82b24f755e4033a4acfcdb1cf26291da1e7902bb090f89a010d403e832beb SHA512 126db0b413c716fba8d5be9bff7a44fd1badacbf32f3db8d0db649819177db37ebd56fd22dd3c809655f5d29675be115e698cd10bc3d0b4b23878ae3726fce47
29 +DIST rocm-Tensile-5.0.2.tar.gz 14362090 BLAKE2B d44c3135496db41c4eb2545f6054c84493e89ef6357da881dae6859763338417e7a9e142cdce7e2de0536684bb641049ad0440964adbe68d03ca329f01efabc9 SHA512 f5ab7d7cbc5ba25498a02a6b7c07d5a9a548edcd44b439b92c8718072382adc18ae78274db1a7174e06436ac1396f3b4edafc7f491a2c87086c368e7270e64e3
30
31 diff --git a/dev-util/Tensile/Tensile-5.0.2.ebuild b/dev-util/Tensile/Tensile-5.0.2.ebuild
32 new file mode 100644
33 index 000000000000..1210cd769aa5
34 --- /dev/null
35 +++ b/dev-util/Tensile/Tensile-5.0.2.ebuild
36 @@ -0,0 +1,83 @@
37 +# Copyright 1999-2022 Gentoo Authors
38 +# Distributed under the terms of the GNU General Public License v2
39 +
40 +EAPI=8
41 +
42 +PYTHON_COMPAT=( python3_{8..10} )
43 +DISTUTILS_USE_PEP517=setuptools
44 +inherit distutils-r1 prefix
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 + https://github.com/littlewu2508/littlewu2508.github.io/raw/main/gentoo-distfiles/${P}-PR1419.patch.gz"
50 +S="${WORKDIR}/${PN}-rocm-${PV}"
51 +
52 +LICENSE="MIT"
53 +KEYWORDS="~amd64"
54 +SLOT="0/$(ver_cut 1-2)"
55 +
56 +# Not compatible with recent versions of pytest
57 +RESTRICT="test"
58 +
59 +RDEPEND="${PYTHON_DEPS}
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:${SLOT}
66 +"
67 +
68 +PATCHES=( "${FILESDIR}"/${PN}-4.3.0-output-commands.patch
69 + "${FILESDIR}"/${PN}-5.0.2-gfx1031.patch
70 + "${FILESDIR}"/${PN}-5.0.2-fix-arch-parse.patch
71 + "${FILESDIR}"/${PN}-5.0.2-use-ninja.patch
72 + "${WORKDIR}"/${PN}-5.0.2-PR1419.patch
73 + )
74 +
75 +CMAKE_USE_DIR="${WORKDIR}/Source"
76 +
77 +src_prepare() {
78 + distutils-r1_src_prepare
79 + eapply $(prefixify_ro "${FILESDIR}"/${PN}-5.0.2-gentoopath.patch)
80 +
81 + pushd ${PN} || die
82 +
83 + sed -e "/ROCM_SMI_ROOT/s,lib,$(get_libdir)," \
84 + -i Source/cmake/FindROCmSMI.cmake || die
85 + sed -r -e "/TENSILE_USE_LLVM/s/ON/OFF/" \
86 + -i Source/CMakeLists.txt || die
87 + sed -e "/chmod 755/d" -i Source/TensileCreateLibrary.cmake || die # remove chmod 755 on
88 + sed -e "s,\${Tensile_ROOT}/bin/,,g" -i Source/TensileCreateLibrary.cmake cmake/TensileConfig.cmake || die # ${Tensile_ROOT}/bin does not exists; call command directly
89 +
90 + local Tensile_share_dir="\"${EPREFIX}/usr/share/${PN}\""
91 + sed -e "/HipClangVersion/s/0,0,0/$(hipconfig -v)/" -i Common.py || die
92 +
93 + sed -e "s,os.path.dirname(os.path.realpath(__file__)),${Tensile_share_dir},g" -i ReplacementKernels.py Common.py ${PN}.py || die
94 +
95 + sed -e "s|os\.path\.dirname.*$|\"${EPREFIX}/usr/share/Tensile/Source\", end='')|" -i __init__.py || die
96 +
97 + popd || die
98 +
99 + sed -e "/package_data/d" -e "/data_files/d" -i setup.py || die
100 +}
101 +
102 +python_install() {
103 + distutils-r1_python_install
104 +
105 + python_moduleinto Tensile
106 + pushd Tensile
107 + python_domodule Components
108 + python_newexe Utilities/merge.py ${PN}-merge
109 +}
110 +
111 +src_install() {
112 + distutils-r1_src_install
113 +
114 + pushd ${PN} || die
115 + insinto /usr/share/${PN}
116 + doins -r Configs Perf ReplacementKernels ReplacementKernels-cov3 Source CustomKernels
117 + insinto /usr/$(get_libdir)/cmake/${PN}
118 + doins cmake/*.cmake
119 +}
120
121 diff --git a/dev-util/Tensile/files/Tensile-5.0.2-fix-arch-parse.patch b/dev-util/Tensile/files/Tensile-5.0.2-fix-arch-parse.patch
122 new file mode 100644
123 index 000000000000..47bee8819c44
124 --- /dev/null
125 +++ b/dev-util/Tensile/files/Tensile-5.0.2-fix-arch-parse.patch
126 @@ -0,0 +1,12 @@
127 +Index: Tensile-rocm-5.0.1/Tensile/Tensile.py
128 +===================================================================
129 +--- Tensile-rocm-5.0.1.orig/Tensile/Tensile.py
130 ++++ Tensile-rocm-5.0.1/Tensile/Tensile.py
131 +@@ -97,7 +97,6 @@ def addCommonArguments(argParser):
132 + """
133 +
134 + (key, value) = par.split("=")
135 +- value = eval(value)
136 + return (key, value)
137 +
138 + argParser.add_argument("-d", "--device", dest="device", type=int, \
139
140 diff --git a/dev-util/Tensile/files/Tensile-5.0.2-gentoopath.patch b/dev-util/Tensile/files/Tensile-5.0.2-gentoopath.patch
141 new file mode 100644
142 index 000000000000..b8b59af5184e
143 --- /dev/null
144 +++ b/dev-util/Tensile/files/Tensile-5.0.2-gentoopath.patch
145 @@ -0,0 +1,75 @@
146 +Fix incorrect path in scripts and CMakeLists, in order to build tensile_client
147 +===================================================================
148 +--- Tensile-rocm-5.0.2.orig/Tensile/Source/client/CMakeLists.txt
149 ++++ Tensile-rocm-5.0.2/Tensile/Source/client/CMakeLists.txt
150 +@@ -56,3 +56,5 @@ endif()
151 + foreach(arch IN LISTS TENSILE_GPU_ARCHS)
152 + target_link_libraries(tensile_client PRIVATE "--amdgpu-target=${arch}")
153 + endforeach(arch)
154 ++
155 ++target_link_libraries(tensile_client PRIVATE LLVMSupport)
156 +Index: Tensile-rocm-5.0.2/Tensile/Source/lib/CMakeLists.txt
157 +===================================================================
158 +--- Tensile-rocm-5.0.2.orig/Tensile/Source/lib/CMakeLists.txt
159 ++++ Tensile-rocm-5.0.2/Tensile/Source/lib/CMakeLists.txt
160 +@@ -47,7 +47,7 @@ set(tensile_sources ${tensile_sources}
161 + )
162 +
163 + if(TENSILE_USE_LLVM)
164 +- find_package(LLVM 13.0 QUIET CONFIG)
165 ++ find_package(LLVM PATHS @GENTOO_PORTAGE_EPREFIX@/usr/lib/llvm/roc QUIET CONFIG)
166 + if(NOT LLVM_FOUND)
167 + find_package(LLVM 12.0 QUIET CONFIG)
168 + if(NOT LLVM_FOUND)
169 +Index: Tensile-rocm-5.0.2/Tensile/Common.py
170 +===================================================================
171 +--- Tensile-rocm-5.0.2.orig/Tensile/Common.py
172 ++++ Tensile-rocm-5.0.2/Tensile/Common.py
173 +@@ -1873,7 +1873,7 @@ def assignGlobalParameters( config ):
174 + else:
175 + print2(" %24s: %8s (unspecified)" % (key, defaultValue))
176 +
177 +- globalParameters["ROCmPath"] = "/opt/rocm"
178 ++ globalParameters["ROCmPath"] = "@GENTOO_PORTAGE_EPREFIX@/usr"
179 + if "ROCM_PATH" in os.environ:
180 + globalParameters["ROCmPath"] = os.environ.get("ROCM_PATH")
181 + if "TENSILE_ROCM_PATH" in os.environ:
182 +Index: Tensile-rocm-5.0.2/Tensile/ClientWriter.py
183 +===================================================================
184 +--- Tensile-rocm-5.0.2.orig/Tensile/ClientWriter.py
185 ++++ Tensile-rocm-5.0.2/Tensile/ClientWriter.py
186 +@@ -205,7 +205,7 @@ def getBuildClientLibraryScript(buildPat
187 + import io
188 + runScriptFile = io.StringIO()
189 +
190 +- callCreateLibraryCmd = globalParameters["ScriptPath"] + "/bin/TensileCreateLibrary"
191 ++ callCreateLibraryCmd = "TensileCreateLibrary"
192 +
193 +
194 + if globalParameters["MergeFiles"]:
195 +Index: Tensile-rocm-5.0.2/Tensile/GenerateSummations.py
196 +===================================================================
197 +--- Tensile-rocm-5.0.2.orig/Tensile/GenerateSummations.py
198 ++++ Tensile-rocm-5.0.2/Tensile/GenerateSummations.py
199 +@@ -57,7 +57,7 @@ def createLibraryForBenchmark(logicPath,
200 + Selection.
201 + """
202 +
203 +- pythonExePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin", "TensileCreateLibrary")
204 ++ pythonExePath = "TensileCreateLibrary"
205 + args = [pythonExePath, \
206 + "--merge-files", "--new-client-only", "--no-short-file-names", "--no-library-print-debug", \
207 + "--architecture=all", "--code-object-version=V3", "--cxx-compiler=hipcc", "--library-format=yaml", \
208 +Index: Tensile-rocm-5.0.2/HostLibraryTests/CMakeLists.txt
209 +===================================================================
210 +--- Tensile-rocm-5.0.2.orig/HostLibraryTests/CMakeLists.txt
211 ++++ Tensile-rocm-5.0.2/HostLibraryTests/CMakeLists.txt
212 +@@ -135,7 +135,7 @@ set(test_sources ${test_sources}
213 + )
214 +
215 + if(TENSILE_USE_LLVM)
216 +- find_package(LLVM 13.0 QUIET CONFIG)
217 ++ find_package(LLVM PATHS @GENTOO_PORTAGE_EPREFIX@/usr/lib/llvm/roc QUIET CONFIG)
218 + if(NOT LLVM_FOUND)
219 + find_package(LLVM 12.0 QUIET CONFIG)
220 + if(NOT LLVM_FOUND)
221
222 diff --git a/dev-util/Tensile/files/Tensile-5.0.2-gfx1031.patch b/dev-util/Tensile/files/Tensile-5.0.2-gfx1031.patch
223 new file mode 100644
224 index 000000000000..17925cfd49e0
225 --- /dev/null
226 +++ b/dev-util/Tensile/files/Tensile-5.0.2-gfx1031.patch
227 @@ -0,0 +1,104 @@
228 +Index: Tensile-rocm-5.0.1/pytest.ini
229 +===================================================================
230 +--- Tensile-rocm-5.0.1.orig/pytest.ini
231 ++++ Tensile-rocm-5.0.1/pytest.ini
232 +@@ -87,6 +87,7 @@ markers =
233 + xfail-gfx1011: architecture
234 + xfail-gfx1012: architecture
235 + xfail-gfx1030: architecture
236 ++ xfail-gfx1031: architecture
237 + skip-gfx000: architecture
238 + skip-gfx900: architecture
239 + skip-gfx906: architecture
240 +@@ -96,3 +97,4 @@ markers =
241 + skip-gfx1011: architecture
242 + skip-gfx1012: architecture
243 + skip-gfx1030: architecture
244 ++ skip-gfx1031: architecture
245 +Index: Tensile-rocm-5.0.1/Tensile/Common.py
246 +===================================================================
247 +--- Tensile-rocm-5.0.1.orig/Tensile/Common.py
248 ++++ Tensile-rocm-5.0.1/Tensile/Common.py
249 +@@ -198,7 +198,7 @@ globalParameters["MergeFiles"] = True
250 + globalParameters["NumMergedFiles"] = 1 # The number of files that kernels should be split between when merging
251 +
252 + globalParameters["MaxFileName"] = 64 # If a file name would be longer than this, shorten it with a hash.
253 +-globalParameters["SupportedISA"] = [(8,0,3), (9,0,0), (9,0,6), (9,0,8), (9,0,10), (10,1,0), (10,1,1), (10,1,2), (10,3,0)] # assembly kernels writer supports these architectures
254 ++globalParameters["SupportedISA"] = [(8,0,3), (9,0,0), (9,0,6), (9,0,8), (9,0,10), (10,1,0), (10,1,1), (10,1,2), (10,3,0),(10,3,1)] # assembly kernels writer supports these architectures
255 +
256 + globalParameters["GenerateManifestAndExit"] = False # Output manifest file with list of expected library objects and exit
257 + globalParameters["NewClient"] = 2 # Old client deprecated: NewClient must be set to 2.
258 +@@ -264,7 +264,7 @@ architectureMap = {
259 + 'gfx906':'vega20', 'gfx906:xnack+':'vega20', 'gfx906:xnack-':'vega20',
260 + 'gfx908':'arcturus','gfx908:xnack+':'arcturus', 'gfx908:xnack-':'arcturus',
261 + 'gfx90a':'aldebaran', 'gfx90a:xnack+':'aldebaran', 'gfx90a:xnack-':'aldebaran',
262 +- 'gfx1010':'navi10', 'gfx1011':'navi12', 'gfx1012':'navi14', 'gfx1030':'navi21'
263 ++ 'gfx1010':'navi10', 'gfx1011':'navi12', 'gfx1012':'navi14', 'gfx1030':'navi21', 'gfx1031':'navi22'
264 + }
265 +
266 + def getArchitectureName(gfxName):
267 +Index: Tensile-rocm-5.0.1/Tensile/KernelWriterAssembly.py
268 +===================================================================
269 +--- Tensile-rocm-5.0.1.orig/Tensile/KernelWriterAssembly.py
270 ++++ Tensile-rocm-5.0.1/Tensile/KernelWriterAssembly.py
271 +@@ -2364,7 +2364,7 @@ class KernelWriterAssembly(KernelWriter)
272 +
273 + # integer i8x4
274 + elif kernel["ProblemType"]["DataType"].isInt8x4():
275 +- if self.version == (9,0,6) or self.version == (9,0,8) or self.version == (9,0,10) or self.version == (10,3,0):
276 ++ if self.version == (9,0,6) or self.version == (9,0,8) or self.version == (9,0,10) or self.version == (10,3,0) or self.version == (10,3,1):
277 + for b in range(0, kernel["ThreadTile1"]):
278 + for a in range(0, kernel["ThreadTile0"]):
279 + for iui in range(0, innerUnroll):
280 +Index: Tensile-rocm-5.0.1/Tensile/Source/CMakeLists.txt
281 +===================================================================
282 +--- Tensile-rocm-5.0.1.orig/Tensile/Source/CMakeLists.txt
283 ++++ Tensile-rocm-5.0.1/Tensile/Source/CMakeLists.txt
284 +@@ -47,7 +47,7 @@ if(NOT DEFINED CXX_VERSION_STRING)
285 + endif()
286 +
287 + if(CMAKE_CXX_COMPILER STREQUAL "hipcc")
288 +- set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack- gfx1010 gfx1011 gfx1012 gfx1030 CACHE STRING "GPU architectures")
289 ++ set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack- gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 CACHE STRING "GPU architectures")
290 + else()
291 + set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906 gfx908 gfx90a CACHE STRING "GPU architectures")
292 + endif()
293 +Index: Tensile-rocm-5.0.1/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
294 +===================================================================
295 +--- Tensile-rocm-5.0.1.orig/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
296 ++++ Tensile-rocm-5.0.1/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
297 +@@ -62,7 +62,8 @@ namespace Tensile
298 + gfx1010 = 1010,
299 + gfx1011 = 1011,
300 + gfx1012 = 1012,
301 +- gfx1030 = 1030
302 ++ gfx1030 = 1030,
303 ++ gfx1031 = 1031
304 + };
305 +
306 + AMDGPU();
307 +Index: Tensile-rocm-5.0.1/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp
308 +===================================================================
309 +--- Tensile-rocm-5.0.1.orig/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp
310 ++++ Tensile-rocm-5.0.1/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp
311 +@@ -215,6 +215,7 @@ namespace Tensile
312 + iot::enumCase(io, value, "gfx1011", AMDGPU::Processor::gfx1011);
313 + iot::enumCase(io, value, "gfx1012", AMDGPU::Processor::gfx1012);
314 + iot::enumCase(io, value, "gfx1030", AMDGPU::Processor::gfx1030);
315 ++ iot::enumCase(io, value, "gfx1031", AMDGPU::Processor::gfx1031);
316 + }
317 + };
318 + } // namespace Serialization
319 +Index: Tensile-rocm-5.0.1/Tensile/Source/lib/source/AMDGPU.cpp
320 +===================================================================
321 +--- Tensile-rocm-5.0.1.orig/Tensile/Source/lib/source/AMDGPU.cpp
322 ++++ Tensile-rocm-5.0.1/Tensile/Source/lib/source/AMDGPU.cpp
323 +@@ -82,6 +82,8 @@ namespace Tensile
324 + return stream << "gfx1012";
325 + case AMDGPU::Processor::gfx1030:
326 + return stream << "gfx1030";
327 ++ case AMDGPU::Processor::gfx1031:
328 ++ return stream << "gfx1031";
329 + }
330 + return stream;
331 + }
332
333 diff --git a/dev-util/Tensile/files/Tensile-5.0.2-use-ninja.patch b/dev-util/Tensile/files/Tensile-5.0.2-use-ninja.patch
334 new file mode 100644
335 index 000000000000..485ec992d808
336 --- /dev/null
337 +++ b/dev-util/Tensile/files/Tensile-5.0.2-use-ninja.patch
338 @@ -0,0 +1,21 @@
339 +diff --git a/Tensile/ClientExecutable.py b/Tensile/ClientExecutable.py
340 +index ca3809f..2d1d83b 100644
341 +--- a/Tensile/ClientExecutable.py
342 ++++ b/Tensile/ClientExecutable.py
343 +@@ -36,6 +36,7 @@ class CMakeEnvironment:
344 +
345 + args = ['cmake']
346 + args += itertools.chain.from_iterable([ ['-D', '{}={}'.format(key, value)] for key,value in self.options.items()])
347 ++ args += itertools.chain.from_iterable([ ['-G', 'Ninja'], [ '-D', 'CMAKE_EXPORT_COMPILE_COMMANDS=ON' ] ])
348 + args += [self.sourceDir]
349 +
350 + Common.print2(' '.join(args))
351 +@@ -43,7 +44,7 @@ class CMakeEnvironment:
352 + subprocess.check_call(args, cwd=Common.ensurePath(self.buildDir))
353 +
354 + def build(self):
355 +- args = ['make', '-j']
356 ++ args = ['ninja']
357 + Common.print2(' '.join(args))
358 + with Common.ClientExecutionLock():
359 + subprocess.check_call(args, cwd=self.buildDir)