public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/, dev-util/Tensile/files/
@ 2022-03-05 20:51 Andrew Ammerlaan
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Ammerlaan @ 2022-03-05 20:51 UTC (permalink / raw
  To: gentoo-commits

commit:     db81ee2a9a65c0aaebb4df461f8be388c66cdd16
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  5 20:49:57 2022 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Sat Mar  5 20:51:52 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=db81ee2a

dev-util/Tensile: add new dependency of rocBLAS

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 dev-util/Tensile/Manifest                          |  1 +
 dev-util/Tensile/Tensile-4.3.0.ebuild              | 74 +++++++++++++++++
 ...ensile-4.3.0-hsaco-compile-specified-arch.patch | 96 ++++++++++++++++++++++
 .../files/Tensile-4.3.0-output-commands.patch      | 23 ++++++
 dev-util/Tensile/metadata.xml                      | 11 +++
 5 files changed, 205 insertions(+)

diff --git a/dev-util/Tensile/Manifest b/dev-util/Tensile/Manifest
new file mode 100644
index 000000000000..fd4cac044af8
--- /dev/null
+++ b/dev-util/Tensile/Manifest
@@ -0,0 +1 @@
+DIST rocm-Tensile-4.3.0.tar.gz 14250149 BLAKE2B 030138eaca2a0aadd96801e6dbd72e510716dd90553ef3795c5e04e00a34a05ecae82b24f755e4033a4acfcdb1cf26291da1e7902bb090f89a010d403e832beb SHA512 126db0b413c716fba8d5be9bff7a44fd1badacbf32f3db8d0db649819177db37ebd56fd22dd3c809655f5d29675be115e698cd10bc3d0b4b23878ae3726fce47

diff --git a/dev-util/Tensile/Tensile-4.3.0.ebuild b/dev-util/Tensile/Tensile-4.3.0.ebuild
new file mode 100644
index 000000000000..cf33fb19cf10
--- /dev/null
+++ b/dev-util/Tensile/Tensile-4.3.0.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+DISTUTILS_USE_PEP517=setuptools
+inherit distutils-r1
+
+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}
+	dev-python/pyyaml[${PYTHON_USEDEP}]
+	dev-python/msgpack[${PYTHON_USEDEP}]
+"
+DEPEND="${RDEPEND}
+	dev-util/hip:${SLOT}
+"
+BDEPEND="test? (
+	dev-util/rocminfo:${SLOT}
+)"
+
+PATCHES=(
+	"${FILESDIR}/Tensile-${PV}-hsaco-compile-specified-arch.patch" # backported from upstream, should remove after 4.3.0
+	"${FILESDIR}/Tensile-4.3.0-output-commands.patch"
+)
+
+CMAKE_USE_DIR="${WORKDIR}/Source"
+
+distutils_enable_tests pytest
+
+src_prepare() {
+	distutils-r1_src_prepare
+
+	mv ${PN}/Source "${WORKDIR}"/ || die
+	sed -e "/ROCM_SMI_ROOT/s,lib,$(get_libdir)," \
+		-i "${WORKDIR}"/Source/cmake/FindROCmSMI.cmake || die
+	sed -r -e "/TENSILE_USE_LLVM/s/ON/OFF/" \
+		-i "${WORKDIR}"/Source/CMakeLists.txt || die
+
+	sed -e "/HipClangVersion/s/0,0,0/$(ver_rs 1-3 ,)/" \
+		-e "/SourcePath/s,os\.path\.join.*$,\"${EPREFIX}/usr/share/${PN}\"," \
+		-i ${PN}/Common.py || die
+
+	sed -e "s|os\.path\.dirname.*$|\"${EPREFIX}/usr/share/Tensile\", end='')|" \
+		-i ${PN}/__init__.py || die
+}
+
+src_test() {
+	ROCM_PATH="${EPREFIX}/usr/" distutils-r1_src_test
+}
+
+src_install() {
+	distutils-r1_src_install
+
+	# Move the cmake files to the correct directory
+	mkdir -p "${ED}/usr/$(get_libdir)/cmake/${PN}" || die
+	mv "${ED}/usr/cmake/"* "${ED}/usr/$(get_libdir)/cmake/${PN}" || die
+	rm -r "${ED}/usr/cmake" || die
+
+	insinto /usr/share/${PN}
+	doins -r "${WORKDIR}"/Source/*
+	dosym . /usr/share/${PN}/Source
+}

diff --git a/dev-util/Tensile/files/Tensile-4.3.0-hsaco-compile-specified-arch.patch b/dev-util/Tensile/files/Tensile-4.3.0-hsaco-compile-specified-arch.patch
new file mode 100644
index 000000000000..8e6753781a2a
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-4.3.0-hsaco-compile-specified-arch.patch
@@ -0,0 +1,96 @@
+https://github.com/ROCmSoftwarePlatform/Tensile/issues/1395
+https://github.com/ROCmSoftwarePlatform/Tensile/pull/1398
+
+--- a/Tensile/TensileCreateLibrary.py
++++ b/Tensile/TensileCreateLibrary.py
+@@ -136,6 +136,35 @@ def which(p):
+                 return candidate
+     return None
+ 
++def splitArchs():
++  # Helper for architecture
++  def isSupported(arch):
++    return globalParameters["AsmCaps"][arch]["SupportedISA"] and \
++           globalParameters["AsmCaps"][arch]["SupportedSource"]
++
++  if ";" in globalParameters["Architecture"]:
++    wantedArchs = globalParameters["Architecture"].split(";")
++  else:
++    wantedArchs = globalParameters["Architecture"].split("_")
++  archs = []
++  cmdlineArchs = []
++  if "all" in wantedArchs:
++    for arch in globalParameters['SupportedISA']:
++      if isSupported(arch):
++        if (arch == (9,0,6) or arch == (9,0,8) or arch == (9,0,10)):
++          if (arch == (9,0,10)):
++            archs += [gfxName(arch) + '-xnack+']
++            cmdlineArchs += [gfxName(arch) + ':xnack+']
++          archs += [gfxName(arch) + '-xnack-']
++          cmdlineArchs += [gfxName(arch) + ':xnack-']
++        else:
++          archs += [gfxName(arch)]
++          cmdlineArchs += [gfxName(arch)]
++  else:
++    for arch in wantedArchs:
++      archs += [re.sub(":", "-", arch)]
++      cmdlineArchs += [arch]
++  return archs, cmdlineArchs
+ 
+ def buildSourceCodeObjectFile(CxxCompiler, outputPath, kernelFile):
+     buildPath = ensurePath(os.path.join(globalParameters['WorkingPath'], 'code_object_tmp'))
+@@ -149,24 +178,8 @@ def buildSourceCodeObjectFile(CxxCompiler, outputPath, kernelFile):
+     objectFilename = base + '.o'
+     soFilename = base + '.so'
+ 
+-    def isSupported(arch):
+-        return globalParameters["AsmCaps"][arch]["SupportedISA"] and \
+-               globalParameters["AsmCaps"][arch]["SupportedSource"]
+-
+     if (CxxCompiler == "hipcc"):
+-      archs = []
+-      cmdlineArchs = []
+-      for arch in globalParameters['SupportedISA']:
+-        if isSupported(arch):
+-          if (arch == (9,0,6) or arch == (9,0,8) or arch == (9,0,10)):
+-            if (arch == (9,0,10)):
+-              archs += [gfxName(arch) + '-xnack+']
+-              cmdlineArchs += [gfxName(arch) + ':xnack+']
+-            archs += [gfxName(arch) + '-xnack-']
+-            cmdlineArchs += [gfxName(arch) + ':xnack-']
+-          else:
+-            archs += [gfxName(arch)]
+-            cmdlineArchs += [gfxName(arch)]
++      archs, cmdlineArchs = splitArchs()
+ 
+       archFlags = ['--offload-arch=' + arch for arch in cmdlineArchs]
+ 
+@@ -1063,11 +1076,6 @@ def buildObjectFileNames(solutionWriter, kernelWriterSource, kernelWriterAssembl
+   sourceKernels = list([k for k in kernels if k['KernelLanguage'] == 'Source'])
+   asmKernels = list([k for k in kernels if k['KernelLanguage'] == 'Assembly'])
+ 
+-  # Helper for architecture
+-  def isSupported(arch):
+-        return globalParameters["AsmCaps"][arch]["SupportedISA"] and \
+-               globalParameters["AsmCaps"][arch]["SupportedSource"]
+-
+   # Build a list of kernel object names.
+   for kernel in sourceKernels:
+     sourceKernelNames += [kernelWriterSource.getKernelFileBase(kernel)]
+@@ -1081,15 +1089,7 @@ def buildObjectFileNames(solutionWriter, kernelWriterSource, kernelWriterAssembl
+ 
+   # Source based kernels are built for all supported architectures
+   if (cxxCompiler == 'hipcc'):
+-    sourceArchs = []
+-    for arch in globalParameters['SupportedISA']:
+-      if isSupported(arch):
+-        if (arch == (9,0,6) or arch == (9,0,8) or arch == (9,0,10)):
+-          if (arch == (9,0,10)):
+-            sourceArchs += [gfxName(arch) + '-xnack+']
+-          sourceArchs += [gfxName(arch) + '-xnack-']
+-        else:
+-          sourceArchs += [gfxName(arch)]
++    sourceArchs, _ = splitArchs()
+   else:
+     raise RuntimeError("Unknown compiler %s" % cxxCompiler)
+ 

diff --git a/dev-util/Tensile/files/Tensile-4.3.0-output-commands.patch b/dev-util/Tensile/files/Tensile-4.3.0-output-commands.patch
new file mode 100644
index 000000000000..be5a4db21429
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-4.3.0-output-commands.patch
@@ -0,0 +1,23 @@
+diff --color -uprN orig/Tensile/cmake/TensileConfig.cmake Tensile-rocm-4.3.0/Tensile/cmake/TensileConfig.cmake
+--- orig/Tensile/cmake/TensileConfig.cmake	2021-08-18 17:48:00.115478470 +0800
++++ Tensile-rocm-4.3.0/Tensile/cmake/TensileConfig.cmake	2021-08-18 17:48:49.963478801 +0800
+@@ -234,6 +234,7 @@ function(TensileCreateLibraryFiles
+         COMMENT "Generating Tensile Libraries"
+         OUTPUT ${Tensile_EMBED_LIBRARY_SOURCE};${Tensile_MANIFEST_CONTENTS}
+         COMMAND ${CommandLine}
++		USES_TERMINAL
+       )
+ 
+       set("${Tensile_VAR_PREFIX}_ALL_FILES" ${Tensile_MANIFEST_CONTENTS} PARENT_SCOPE)
+diff --color -uprN orig/Tensile/Common.py Tensile-rocm-4.3.0/Tensile/Common.py
+--- orig/Tensile/Common.py	2021-08-18 17:48:00.075478470 +0800
++++ Tensile-rocm-4.3.0/Tensile/Common.py	2021-08-18 17:48:23.287478624 +0800
+@@ -179,7 +179,7 @@ globalParameters["PrintTensorD"] = 0
+ globalParameters["PrintTensorRef"] = 0          # Print reference tensor.  0x1=after init; 0x2=after copy-back; 0x3=both
+ globalParameters["PrintIndexAssignments"] = 0      # Print the tensor index assignment info
+ globalParameters["PrintWinnersOnly"] = False      # Only print the solutions which become the fastest
+-globalParameters["PrintCodeCommands"] = False  # print the commands used to generate the code objects (asm,link,hip-clang, etc)
++globalParameters["PrintCodeCommands"] = True  # print the commands used to generate the code objects (asm,link,hip-clang, etc)
+ globalParameters["DumpTensors"] = False        # If True, dump tensors to binary files instead of printing them.
+ 
+ # TODO - remove this when NewClient is mainstream

diff --git a/dev-util/Tensile/metadata.xml b/dev-util/Tensile/metadata.xml
new file mode 100644
index 000000000000..9bbebec502ca
--- /dev/null
+++ b/dev-util/Tensile/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM 'http://www.gentoo.org/dtd/metadata.dtd'>
+<pkgmetadata>
+  <maintainer type="project">
+    <email>sci@gentoo.org</email>
+    <name>Science Project</name>
+  </maintainer>
+  <upstream>
+    <remote-id type="github">ROCmSoftwarePlatform/Tensile</remote-id>
+  </upstream>
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/, dev-util/Tensile/files/
@ 2022-12-19 14:00 Andreas Sturmlechner
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Sturmlechner @ 2022-12-19 14:00 UTC (permalink / raw
  To: gentoo-commits

commit:     3a572264e28322d9b09f6f9475cca0eede4d5f3f
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 18 13:09:21 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Dec 19 14:00:02 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a572264

dev-util/Tensile: drop 4.3.0-r1

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 dev-util/Tensile/Manifest                          |   1 -
 dev-util/Tensile/Tensile-4.3.0-r1.ebuild           |  86 ---------------
 .../files/Tensile-4.3.0-fix-arch-parse.patch       |  12 ---
 .../Tensile/files/Tensile-4.3.0-gentoopath.patch   |  62 -----------
 dev-util/Tensile/files/Tensile-4.3.0-gfx1031.patch | 119 ---------------------
 ...ensile-4.3.0-hsaco-compile-specified-arch.patch |  96 -----------------
 .../Tensile/files/Tensile-4.3.0-use-ninja.patch    |  21 ----
 7 files changed, 397 deletions(-)

diff --git a/dev-util/Tensile/Manifest b/dev-util/Tensile/Manifest
index 3b51748fa904..c3f43afdabe4 100644
--- a/dev-util/Tensile/Manifest
+++ b/dev-util/Tensile/Manifest
@@ -1,4 +1,3 @@
 DIST Tensile-5.0.2-PR1419.patch.gz 43754 BLAKE2B 3b1d7333ed0115f77816806e7735e25d897dbae3f7a40ece61d655c8f016d9d1c804b586b4e0e75661e20c517f5937a61d5ead25a545f0ce2e4a178bcbb3e7be SHA512 0154d8e14d335f4ecd86e5db335289f8662cede7e5d4b93bf6c56d8e48c1d7d0457271c078c9abbbca1f4aa91f028f6ce6a89efb783ba0207d0f39fd5de8a42c
-DIST rocm-Tensile-4.3.0.tar.gz 14250149 BLAKE2B 030138eaca2a0aadd96801e6dbd72e510716dd90553ef3795c5e04e00a34a05ecae82b24f755e4033a4acfcdb1cf26291da1e7902bb090f89a010d403e832beb SHA512 126db0b413c716fba8d5be9bff7a44fd1badacbf32f3db8d0db649819177db37ebd56fd22dd3c809655f5d29675be115e698cd10bc3d0b4b23878ae3726fce47
 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

diff --git a/dev-util/Tensile/Tensile-4.3.0-r1.ebuild b/dev-util/Tensile/Tensile-4.3.0-r1.ebuild
deleted file mode 100644
index 7cb7e94cd256..000000000000
--- a/dev-util/Tensile/Tensile-4.3.0-r1.ebuild
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{8..10} )
-DISTUTILS_USE_PEP517=setuptools
-inherit distutils-r1 prefix
-
-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}
-	dev-python/pyyaml[${PYTHON_USEDEP}]
-	dev-python/msgpack[${PYTHON_USEDEP}]
-	>=dev-util/rocm-smi-4.3.0
-"
-DEPEND="${RDEPEND}
-	dev-util/hip:${SLOT}
-"
-
-PATCHES=( "${FILESDIR}"/${PN}-4.3.0-output-commands.patch
-		  "${FILESDIR}"/${PN}-4.3.0-hsaco-compile-specified-arch.patch
-		  "${FILESDIR}"/${PN}-4.3.0-gfx1031.patch
-		  "${FILESDIR}"/${PN}-4.3.0-fix-arch-parse.patch
-		  "${FILESDIR}"/${PN}-4.3.0-use-ninja.patch
-	  )
-
-src_prepare() {
-	distutils-r1_src_prepare
-	eapply $(prefixify_ro "${FILESDIR}"/${PN}-4.3.0-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
-	sed -e "s,\${Tensile_ROOT}/bin/,,g" -i Source/TensileCreateLibrary.cmake cmake/TensileConfig.cmake || die # ${Tensile_ROOT}/bin does not exists; call command directly
-
-	local Tensile_share_dir="\"${EPREFIX}/usr/share/${PN}\""
-	sed -e "/HipClangVersion/s/0,0,0/$(hipconfig -v)/" \
-		-e "/SourcePath/s,globalParameters\[\"ScriptPath\"\],${Tensile_share_dir}," \
-		-i Common.py || die
-
-	sed  -e "/CMAKE_CXX_COMPILER/s,globalParameters\[\"ROCmBinPath\"\],\"${EPREFIX}/usr/lib/hip/bin\"," -i ClientExecutable.py || die
-
-	sed -e "/scriptDir/s,os.path.dirname(os.path.realpath(__file__)),${Tensile_share_dir}," -i ReplacementKernels.py || die
-
-	sed -e "s,os.path.dirname(os.path.realpath(__file__)),${Tensile_share_dir},g" -i ${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
-	insinto /usr/$(get_libdir)/cmake/${PN}
-	doins cmake/*.cmake
-}

diff --git a/dev-util/Tensile/files/Tensile-4.3.0-fix-arch-parse.patch b/dev-util/Tensile/files/Tensile-4.3.0-fix-arch-parse.patch
deleted file mode 100644
index 01b94b32cb6e..000000000000
--- a/dev-util/Tensile/files/Tensile-4.3.0-fix-arch-parse.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-Index: Tensile-rocm-4.3.0/Tensile/Tensile.py
-===================================================================
---- Tensile-rocm-4.3.0.orig/Tensile/Tensile.py
-+++ Tensile-rocm-4.3.0/Tensile/Tensile.py
-@@ -97,7 +97,6 @@ def addCommonArguments(argParser):
-     """
- 
-     (key, value) = par.split("=")
--    value = eval(value)
-     return (key, value)
- 
-   argParser.add_argument("-d", "--device", dest="device", type=int, \

diff --git a/dev-util/Tensile/files/Tensile-4.3.0-gentoopath.patch b/dev-util/Tensile/files/Tensile-4.3.0-gentoopath.patch
deleted file mode 100644
index da135e3b38ee..000000000000
--- a/dev-util/Tensile/files/Tensile-4.3.0-gentoopath.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-Index: Tensile-rocm-4.3.0/Tensile/Source/client/CMakeLists.txt
-===================================================================
---- Tensile-rocm-4.3.0.orig/Tensile/Source/client/CMakeLists.txt
-+++ Tensile-rocm-4.3.0/Tensile/Source/client/CMakeLists.txt
-@@ -50,3 +50,5 @@ endif()
- foreach(arch IN LISTS TENSILE_GPU_ARCHS)
-     target_link_libraries(tensile_client PRIVATE "--amdgpu-target=${arch}")
- endforeach(arch)
-+
-+target_link_libraries(tensile_client PRIVATE LLVMSupport)
-Index: Tensile-rocm-4.3.0/Tensile/Source/lib/CMakeLists.txt
-===================================================================
---- Tensile-rocm-4.3.0.orig/Tensile/Source/lib/CMakeLists.txt
-+++ Tensile-rocm-4.3.0/Tensile/Source/lib/CMakeLists.txt
-@@ -48,7 +48,7 @@ set(tensile_sources  ${tensile_sources}
-     )
- 
- if(TENSILE_USE_LLVM)
--    find_package(LLVM 13.0 QUIET CONFIG)
-+    find_package(LLVM PATHS @GENTOO_PORTAGE_EPREFIX@/usr/lib/llvm/roc QUIET CONFIG)
-     if(NOT LLVM_FOUND)
-         find_package(LLVM 12.0 QUIET CONFIG)
-         if(NOT LLVM_FOUND)
-Index: Tensile-rocm-4.3.0/Tensile/Common.py
-===================================================================
---- Tensile-rocm-4.3.0.orig/Tensile/Common.py
-+++ Tensile-rocm-4.3.0/Tensile/Common.py
-@@ -1667,7 +1667,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-4.3.0/Tensile/ClientWriter.py
-===================================================================
---- Tensile-rocm-4.3.0.orig/Tensile/ClientWriter.py
-+++ Tensile-rocm-4.3.0/Tensile/ClientWriter.py
-@@ -284,7 +284,7 @@ def getBuildNewClientLibraryScript(build
-   import io
-   runScriptFile = io.StringIO()
- 
--  callCreateLibraryCmd = globalParameters["ScriptPath"] + "/bin/TensileCreateLibrary"
-+  callCreateLibraryCmd = "TensileCreateLibrary"
- 
- 
-   if globalParameters["MergeFiles"]:
-Index: Tensile-rocm-4.3.0/Tensile/GenerateSummations.py
-===================================================================
---- Tensile-rocm-4.3.0.orig/Tensile/GenerateSummations.py
-+++ Tensile-rocm-4.3.0/Tensile/GenerateSummations.py
-@@ -57,7 +57,7 @@ def createLibraryForBenchmark(logicPath,
-     Selection.
-     """
- 
--    pythonExePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin", "TensileCreateLibrary")
-+    pythonExePath = "TensileCreateLibrary"
-     args = [pythonExePath, \
-         "--merge-files", "--no-legacy-components", \
-         "--new-client-only", "--no-short-file-names", "--no-library-print-debug", "--architecture=all", \

diff --git a/dev-util/Tensile/files/Tensile-4.3.0-gfx1031.patch b/dev-util/Tensile/files/Tensile-4.3.0-gfx1031.patch
deleted file mode 100644
index 99abceb7c44d..000000000000
--- a/dev-util/Tensile/files/Tensile-4.3.0-gfx1031.patch
+++ /dev/null
@@ -1,119 +0,0 @@
---- Tensile-rocm-4.3.0/pytest.ini	2021-04-22 22:35:33.000000000 +0800
-+++ Tensile-rocm-4.3.0/pytest.ini	2021-09-30 17:32:21.382806851 +0800
-@@ -88,6 +88,7 @@
-  xfail-gfx1011: architecture
-  xfail-gfx1012: architecture
-  xfail-gfx1030: architecture
-+ xfail-gfx1031: architecture
-  skip-gfx000:  architecture
-  skip-gfx900:  architecture
-  skip-gfx906:  architecture
-@@ -97,3 +98,4 @@
-  skip-gfx1011: architecture
-  skip-gfx1012: architecture
-  skip-gfx1030: architecture
-+ skip-gfx1031: architecture
---- Tensile-rocm-4.3.0/Tensile/Common.py	2021-10-05 14:41:22.490754124 +0800
-+++ Tensile-rocm-4.3.0/Tensile/Common.py	2021-09-30 17:33:19.041724015 +0800
-@@ -200,7 +200,7 @@
- globalParameters["MergeFiles"] = True             # F=store every solution and kernel in separate file; T=store all solutions in single file
- 
- globalParameters["MaxFileName"] = 64              # If a file name would be longer than this, shorten it with a hash.
-+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
--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
- 
- globalParameters["GenerateManifestAndExit"] = False               # Output manifest file with list of expected library objects and exit
- globalParameters["ClientBuildPath"] = "0_Build"                   # subdirectory for host code build directory
-@@ -265,7 +265,7 @@
-   'gfx906':'vega20', 'gfx906:xnack+':'vega20', 'gfx906:xnack-':'vega20',
-   'gfx908':'arcturus','gfx908:xnack+':'arcturus', 'gfx908:xnack-':'arcturus',
-   'gfx90a':'aldebaran', 'gfx90a:xnack+':'aldebaran', 'gfx90a:xnack-':'aldebaran',
-+  'gfx1010':'navi10', 'gfx1011':'navi11', 'gfx1012':'navi12', 'gfx1030':'navi21', 'gfx1031':'navi22',
--  'gfx1010':'navi10', 'gfx1011':'navi11', 'gfx1012':'navi12', 'gfx1030':'navi21'
- }
- 
- def getArchitectureName(gfxName):
---- Tensile-rocm-4.3.0/Tensile/KernelWriterAssembly.py	2021-04-22 22:35:33.000000000 +0800
-+++ Tensile-rocm-4.3.0/Tensile/KernelWriterAssembly.py	2021-09-30 17:27:06.696711144 +0800
-@@ -2257,7 +2257,7 @@
- 
-     # integer i8x4
-     elif kernel["ProblemType"]["DataType"].isInt8x4():
-+      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):
--      if self.version == (9,0,6) or self.version == (9,0,8) or self.version == (9,0,10) or self.version == (10,3,0):
-         for b in range(0, kernel["ThreadTile1"]):
-           for a in range(0, kernel["ThreadTile0"]):
-             for iui in range(0, innerUnroll):
---- Tensile-rocm-4.3.0/Tensile/Source/CMakeLists.txt	2021-04-22 22:35:33.000000000 +0800
-+++ Tensile-rocm-4.3.0/Tensile/Source/CMakeLists.txt	2021-09-30 17:29:12.846345541 +0800
-@@ -51,7 +51,7 @@
-     endif()
- 
-     if(CMAKE_CXX_COMPILER STREQUAL "hipcc")
-+      set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack- gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 CACHE STRING "GPU architectures")
--      set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack- gfx1010 gfx1011 gfx1012 gfx1030 CACHE STRING "GPU architectures")
-     else()
-       set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906 gfx908 gfx90a CACHE STRING "GPU architectures")
-     endif()
-@@ -104,7 +104,7 @@
-     set_property( CACHE Tensile_CODE_OBJECT_VERSION PROPERTY STRINGS V2 V3)
-     set_property( CACHE Tensile_COMPILER PROPERTY STRINGS hipcc)
-     set(Tensile_ARCHITECTURE all CACHE STRING "Which GPU architecture to use")
-+    set_property( CACHE Tensile_ARCHITECTURE PROPERTY STRINGS all gfx000 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack- gfx1010 gfx1011 gfx1012 gfx1030 gfx1031)
--    set_property( CACHE Tensile_ARCHITECTURE PROPERTY STRINGS all gfx000 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack- gfx1010 gfx1011 gfx1012 gfx1030)
-     set_property( CACHE Tensile_LIBRARY_FORMAT PROPERTY STRINGS yaml msgpack)
- 
-     message( STATUS "Tensile_CODE_OBJECT_VERSION from Tensile/Source/CMakeLists.txt: ${Tensile_CODE_OBJECT_VERSION}")
-@@ -206,7 +206,7 @@
-         ${Tensile_RUNTIME_LANGUAGE}     # HIP or OCL
-         ${Tensile_COMPILER}             # hipcc
-         ${Tensile_CODE_OBJECT_VERSION}  # V2 or V3
-+        ${Tensile_ARCHITECTURE}         # all, gfx000, gfx803, gfx900, gfx906:xnack-, gfx908:xnack-, gfx90a:xnack-, gfx1010, gfx1011, gfx1012, gfx1030, gfx1031
--        ${Tensile_ARCHITECTURE}         # all, gfx000, gfx803, gfx900, gfx906:xnack-, gfx908:xnack-, gfx90a:xnack-, gfx1010, gfx1011, gfx1012, gfx1030
-         ${Tensile_LIBRARY_FORMAT}       # yaml or msgpack
-         ${Tensile_MERGE_FILES}          # ON or OFF
-         ${Tensile_SHORT_FILE_NAMES}     # ON or OFF
---- Tensile-rocm-4.3.0/Tensile/Source/lib/include/Tensile/AMDGPU.hpp	2021-04-22 22:35:33.000000000 +0800
-+++ Tensile-rocm-4.3.0/Tensile/Source/lib/include/Tensile/AMDGPU.hpp	2021-09-30 17:48:11.277066515 +0800
-@@ -62,7 +62,8 @@
-             gfx1010 = 1010,
-             gfx1011 = 1011,
-             gfx1012 = 1012,
-+            gfx1030 = 1030,
-+            gfx1031 = 1031
--            gfx1030 = 1030
-         };
- 
-         AMDGPU();
---- Tensile-rocm-4.3.0/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp	2021-04-22 22:35:33.000000000 +0800
-+++ Tensile-rocm-4.3.0/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp	2021-09-30 17:31:26.075845249 +0800
-@@ -215,6 +215,7 @@
-                 iot::enumCase(io, value, "gfx1011", AMDGPU::Processor::gfx1011);
-                 iot::enumCase(io, value, "gfx1012", AMDGPU::Processor::gfx1012);
-                 iot::enumCase(io, value, "gfx1030", AMDGPU::Processor::gfx1030);
-+                iot::enumCase(io, value, "gfx1031", AMDGPU::Processor::gfx1031);
-             }
-         };
-     } // namespace Serialization
---- Tensile-rocm-4.3.0/Tensile/Source/lib/source/AMDGPU.cpp	2021-04-22 22:35:33.000000000 +0800
-+++ Tensile-rocm-4.3.0/Tensile/Source/lib/source/AMDGPU.cpp	2021-09-30 17:31:45.195486318 +0800
-@@ -82,6 +82,8 @@
-             return stream << "gfx1012";
-         case AMDGPU::Processor::gfx1030:
-             return stream << "gfx1030";
-+        case AMDGPU::Processor::gfx1031:
-+            return stream << "gfx1031";
-         }
-         return stream;
-     }
---- Tensile-rocm-4.3.0/Tensile/Source/TensileCreateLibrary.cmake	2021-04-22 22:35:33.000000000 +0800
-+++ Tensile-rocm-4.3.0/Tensile/Source/TensileCreateLibrary.cmake	2021-09-30 17:29:24.766121912 +0800
-@@ -138,7 +138,7 @@
-     add_library(Tensile ${options} ${Tensile_SOURCE_FILES})
-     # specify gpu targets
-     if( Tensile_ARCHITECTURE MATCHES "all" )
-+      set( Tensile_HIP_ISA "gfx803" "gfx900" "gfx906" "gfx908" "gfx1010" "gfx1011" "gfx1012" "gfx1030", "gfx1031")
--      set( Tensile_HIP_ISA "gfx803" "gfx900" "gfx906" "gfx908" "gfx1010" "gfx1011" "gfx1012" "gfx1030")
-     else()
-       set( Tensile_HIP_ISA ${Tensile_ARCHITECTURE})
-     endif()

diff --git a/dev-util/Tensile/files/Tensile-4.3.0-hsaco-compile-specified-arch.patch b/dev-util/Tensile/files/Tensile-4.3.0-hsaco-compile-specified-arch.patch
deleted file mode 100644
index 8e6753781a2a..000000000000
--- a/dev-util/Tensile/files/Tensile-4.3.0-hsaco-compile-specified-arch.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-https://github.com/ROCmSoftwarePlatform/Tensile/issues/1395
-https://github.com/ROCmSoftwarePlatform/Tensile/pull/1398
-
---- a/Tensile/TensileCreateLibrary.py
-+++ b/Tensile/TensileCreateLibrary.py
-@@ -136,6 +136,35 @@ def which(p):
-                 return candidate
-     return None
- 
-+def splitArchs():
-+  # Helper for architecture
-+  def isSupported(arch):
-+    return globalParameters["AsmCaps"][arch]["SupportedISA"] and \
-+           globalParameters["AsmCaps"][arch]["SupportedSource"]
-+
-+  if ";" in globalParameters["Architecture"]:
-+    wantedArchs = globalParameters["Architecture"].split(";")
-+  else:
-+    wantedArchs = globalParameters["Architecture"].split("_")
-+  archs = []
-+  cmdlineArchs = []
-+  if "all" in wantedArchs:
-+    for arch in globalParameters['SupportedISA']:
-+      if isSupported(arch):
-+        if (arch == (9,0,6) or arch == (9,0,8) or arch == (9,0,10)):
-+          if (arch == (9,0,10)):
-+            archs += [gfxName(arch) + '-xnack+']
-+            cmdlineArchs += [gfxName(arch) + ':xnack+']
-+          archs += [gfxName(arch) + '-xnack-']
-+          cmdlineArchs += [gfxName(arch) + ':xnack-']
-+        else:
-+          archs += [gfxName(arch)]
-+          cmdlineArchs += [gfxName(arch)]
-+  else:
-+    for arch in wantedArchs:
-+      archs += [re.sub(":", "-", arch)]
-+      cmdlineArchs += [arch]
-+  return archs, cmdlineArchs
- 
- def buildSourceCodeObjectFile(CxxCompiler, outputPath, kernelFile):
-     buildPath = ensurePath(os.path.join(globalParameters['WorkingPath'], 'code_object_tmp'))
-@@ -149,24 +178,8 @@ def buildSourceCodeObjectFile(CxxCompiler, outputPath, kernelFile):
-     objectFilename = base + '.o'
-     soFilename = base + '.so'
- 
--    def isSupported(arch):
--        return globalParameters["AsmCaps"][arch]["SupportedISA"] and \
--               globalParameters["AsmCaps"][arch]["SupportedSource"]
--
-     if (CxxCompiler == "hipcc"):
--      archs = []
--      cmdlineArchs = []
--      for arch in globalParameters['SupportedISA']:
--        if isSupported(arch):
--          if (arch == (9,0,6) or arch == (9,0,8) or arch == (9,0,10)):
--            if (arch == (9,0,10)):
--              archs += [gfxName(arch) + '-xnack+']
--              cmdlineArchs += [gfxName(arch) + ':xnack+']
--            archs += [gfxName(arch) + '-xnack-']
--            cmdlineArchs += [gfxName(arch) + ':xnack-']
--          else:
--            archs += [gfxName(arch)]
--            cmdlineArchs += [gfxName(arch)]
-+      archs, cmdlineArchs = splitArchs()
- 
-       archFlags = ['--offload-arch=' + arch for arch in cmdlineArchs]
- 
-@@ -1063,11 +1076,6 @@ def buildObjectFileNames(solutionWriter, kernelWriterSource, kernelWriterAssembl
-   sourceKernels = list([k for k in kernels if k['KernelLanguage'] == 'Source'])
-   asmKernels = list([k for k in kernels if k['KernelLanguage'] == 'Assembly'])
- 
--  # Helper for architecture
--  def isSupported(arch):
--        return globalParameters["AsmCaps"][arch]["SupportedISA"] and \
--               globalParameters["AsmCaps"][arch]["SupportedSource"]
--
-   # Build a list of kernel object names.
-   for kernel in sourceKernels:
-     sourceKernelNames += [kernelWriterSource.getKernelFileBase(kernel)]
-@@ -1081,15 +1089,7 @@ def buildObjectFileNames(solutionWriter, kernelWriterSource, kernelWriterAssembl
- 
-   # Source based kernels are built for all supported architectures
-   if (cxxCompiler == 'hipcc'):
--    sourceArchs = []
--    for arch in globalParameters['SupportedISA']:
--      if isSupported(arch):
--        if (arch == (9,0,6) or arch == (9,0,8) or arch == (9,0,10)):
--          if (arch == (9,0,10)):
--            sourceArchs += [gfxName(arch) + '-xnack+']
--          sourceArchs += [gfxName(arch) + '-xnack-']
--        else:
--          sourceArchs += [gfxName(arch)]
-+    sourceArchs, _ = splitArchs()
-   else:
-     raise RuntimeError("Unknown compiler %s" % cxxCompiler)
- 

diff --git a/dev-util/Tensile/files/Tensile-4.3.0-use-ninja.patch b/dev-util/Tensile/files/Tensile-4.3.0-use-ninja.patch
deleted file mode 100644
index 6645efd72fb1..000000000000
--- a/dev-util/Tensile/files/Tensile-4.3.0-use-ninja.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Index: Tensile-rocm-4.3.0/Tensile/ClientExecutable.py
-===================================================================
---- Tensile-rocm-4.3.0.orig/Tensile/ClientExecutable.py
-+++ Tensile-rocm-4.3.0/Tensile/ClientExecutable.py
-@@ -36,6 +36,7 @@ class CMakeEnvironment:
- 
-         args = ['cmake']
-         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]
- 
-         Common.print2(' '.join(args))
-@@ -43,7 +44,7 @@ class CMakeEnvironment:
-             subprocess.check_call(args, cwd=Common.ensurePath(self.buildDir))
- 
-     def build(self):
--        args = ['make', '-j']
-+        args = ['ninja']
-         Common.print2(' '.join(args))
-         with Common.ClientExecutionLock():
-             subprocess.check_call(args, cwd=self.buildDir)


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/, dev-util/Tensile/files/
@ 2023-01-31 14:30 Benda XU
  0 siblings, 0 replies; 6+ messages in thread
From: Benda XU @ 2023-01-31 14:30 UTC (permalink / raw
  To: gentoo-commits

commit:     3b32497070812f973e5064f9ada07ab5d404b402
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Fri Jan 20 09:58:17 2023 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Tue Jan 31 14:26:37 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b324970

dev-util/Tensile: add 5.4.2

Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 dev-util/Tensile/Manifest                          |  1 +
 dev-util/Tensile/Tensile-5.4.2.ebuild              | 89 ++++++++++++++++++++++
 .../Tensile/files/Tensile-5.4.2-gentoopath.patch   | 67 ++++++++++++++++
 .../Tensile/files/Tensile-5.4.2-use-ninja.patch    | 21 +++++
 4 files changed, 178 insertions(+)

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/, dev-util/Tensile/files/
@ 2023-02-01  1:52 Benda XU
  0 siblings, 0 replies; 6+ messages in thread
From: Benda XU @ 2023-02-01  1:52 UTC (permalink / raw
  To: gentoo-commits

commit:     2b7c870b48d225a9ade51eac426310de68f41069
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Tue Jan 31 14:57:06 2023 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Wed Feb  1 01:51:35 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b7c870b

dev-util/Tensile: add missing patches

Closes: https://bugs.gentoo.org/892736
Closes: https://github.com/gentoo/gentoo/pull/29356
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 dev-util/Tensile/Tensile-5.4.2.ebuild              |  4 +-
 .../files/Tensile-5.4.2-fix-arch-parse.patch       | 12 +++
 dev-util/Tensile/files/Tensile-5.4.2-gfx1031.patch | 88 ++++++++++++++++++++++
 3 files changed, 102 insertions(+), 2 deletions(-)

diff --git a/dev-util/Tensile/Tensile-5.4.2.ebuild b/dev-util/Tensile/Tensile-5.4.2.ebuild
index 09bccd0ab2dd..1e347fdcee56 100644
--- a/dev-util/Tensile/Tensile-5.4.2.ebuild
+++ b/dev-util/Tensile/Tensile-5.4.2.ebuild
@@ -32,8 +32,8 @@ DEPEND="${RDEPEND}
 "
 
 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-gfx1031.patch
+		  "${FILESDIR}"/${PN}-5.4.2-fix-arch-parse.patch
 		  "${FILESDIR}"/${PN}-5.4.2-use-ninja.patch
 	  )
 

diff --git a/dev-util/Tensile/files/Tensile-5.4.2-fix-arch-parse.patch b/dev-util/Tensile/files/Tensile-5.4.2-fix-arch-parse.patch
new file mode 100644
index 000000000000..14263e89ef84
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-5.4.2-fix-arch-parse.patch
@@ -0,0 +1,12 @@
+Index: Tensile-rocm-5.3.3/Tensile/Tensile.py
+===================================================================
+--- Tensile-rocm-5.3.3.orig/Tensile/Tensile.py
++++ Tensile-rocm-5.3.3/Tensile/Tensile.py
+@@ -101,7 +101,6 @@ def addCommonArguments(argParser):
+         Allows the --global-parameters option to specify any parameters from the command line.
+         """
+         (key, value) = par.split("=")
+-        value = eval(value)
+         return (key, value)
+ 
+     argParser.add_argument("-d", "--device", dest="device", type=int, \

diff --git a/dev-util/Tensile/files/Tensile-5.4.2-gfx1031.patch b/dev-util/Tensile/files/Tensile-5.4.2-gfx1031.patch
new file mode 100644
index 000000000000..1f703c07c3ec
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-5.4.2-gfx1031.patch
@@ -0,0 +1,88 @@
+Index: Tensile-rocm-5.3.3/pytest.ini
+===================================================================
+--- Tensile-rocm-5.3.3.orig/pytest.ini
++++ Tensile-rocm-5.3.3/pytest.ini
+@@ -88,6 +88,7 @@ markers =
+  xfail-gfx1011: architecture
+  xfail-gfx1012: architecture
+  xfail-gfx1030: architecture
++ xfail-gfx1031: architecture
+  xfail-gfx1100: architecture
+  xfail-gfx1101: architecture
+  xfail-gfx1102: architecture
+@@ -100,6 +101,7 @@ markers =
+  skip-gfx1011: architecture
+  skip-gfx1012: architecture
+  skip-gfx1030: architecture
++ skip-gfx1031: architecture
+  skip-gfx1100: architecture
+  skip-gfx1101: architecture
+  skip-gfx1102: architecture
+Index: Tensile-rocm-5.3.3/Tensile/Common.py
+===================================================================
+--- Tensile-rocm-5.3.3.orig/Tensile/Common.py
++++ Tensile-rocm-5.3.3/Tensile/Common.py
+@@ -201,7 +201,7 @@ globalParameters["MergeFiles"] = True
+ globalParameters["NumMergedFiles"] = 1            # The number of files that kernels should be split between when merging
+ 
+ globalParameters["MaxFileName"] = 64              # If a file name would be longer than this, shorten it with a hash.
+-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), (11,0,0), (11,0,1), (11,0,2)] # assembly kernels writer supports these architectures
++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), (11,0,0), (11,0,1), (11,0,2)] # assembly kernels writer supports these architectures
+ 
+ globalParameters["GenerateManifestAndExit"] = False               # Output manifest file with list of expected library objects and exit
+ globalParameters["NewClient"] = 2                                 # Old client deprecated: NewClient must be set to 2.
+@@ -271,7 +271,7 @@ architectureMap = {
+   'gfx906':'vega20', 'gfx906:xnack+':'vega20', 'gfx906:xnack-':'vega20',
+   'gfx908':'arcturus','gfx908:xnack+':'arcturus', 'gfx908:xnack-':'arcturus',
+   'gfx90a':'aldebaran', 'gfx90a:xnack+':'aldebaran', 'gfx90a:xnack-':'aldebaran',
+-  'gfx1010':'navi10', 'gfx1011':'navi12', 'gfx1012':'navi14', 'gfx1030':'navi21',
++  'gfx1010':'navi10', 'gfx1011':'navi12', 'gfx1012':'navi14', 'gfx1030':'navi21', 'gfx1031':'navi22',
+   'gfx1100':'navi31', 'gfx1101':'navi32', 'gfx1102':'navi33'
+ }
+ 
+Index: Tensile-rocm-5.3.3/Tensile/Source/CMakeLists.txt
+===================================================================
+--- Tensile-rocm-5.3.3.orig/Tensile/Source/CMakeLists.txt
++++ Tensile-rocm-5.3.3/Tensile/Source/CMakeLists.txt
+@@ -51,7 +51,7 @@ if(NOT DEFINED CXX_VERSION_STRING)
+ endif()
+ 
+ if(CMAKE_CXX_COMPILER STREQUAL "hipcc")
+-  set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack- gfx1010 gfx1011 gfx1012 gfx1030 gfx1100 gfx1101 gfx1102 CACHE STRING "GPU architectures")
++  set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack- gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1100 gfx1101 gfx1102 CACHE STRING "GPU architectures")
+ else()
+   set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906 gfx908 gfx90a gfx1010 gfx1011 gfx1012 gfx1030 gfx1100 gfx1101 gfx1102 CACHE STRING "GPU architectures")
+ endif()
+Index: Tensile-rocm-5.3.3/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
+===================================================================
+--- Tensile-rocm-5.3.3.orig/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
++++ Tensile-rocm-5.3.3/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
+@@ -63,6 +63,7 @@ namespace Tensile
+             gfx1011 = 1011,
+             gfx1012 = 1012,
+             gfx1030 = 1030,
++            gfx1031 = 1031,
+             gfx1100 = 1100,
+             gfx1101 = 1101,
+             gfx1102 = 1102
+@@ -90,6 +91,8 @@ namespace Tensile
+                 return "gfx1012";
+             case AMDGPU::Processor::gfx1030:
+                 return "gfx1030";
++            case AMDGPU::Processor::gfx1031:
++                return "gfx1032";
+             case AMDGPU::Processor::gfx1100:
+                 return "gfx1100";
+             case AMDGPU::Processor::gfx1101:
+Index: Tensile-rocm-5.3.3/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp
+===================================================================
+--- Tensile-rocm-5.3.3.orig/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp
++++ Tensile-rocm-5.3.3/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp
+@@ -215,6 +215,7 @@ namespace Tensile
+                 iot::enumCase(io, value, "gfx1011", AMDGPU::Processor::gfx1011);
+                 iot::enumCase(io, value, "gfx1012", AMDGPU::Processor::gfx1012);
+                 iot::enumCase(io, value, "gfx1030", AMDGPU::Processor::gfx1030);
++                iot::enumCase(io, value, "gfx1031", AMDGPU::Processor::gfx1031);
+                 iot::enumCase(io, value, "gfx1100", AMDGPU::Processor::gfx1100);
+                 iot::enumCase(io, value, "gfx1101", AMDGPU::Processor::gfx1101);
+                 iot::enumCase(io, value, "gfx1102", AMDGPU::Processor::gfx1102);


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/, dev-util/Tensile/files/
@ 2023-03-30 22:41 Marek Szuba
  0 siblings, 0 replies; 6+ messages in thread
From: Marek Szuba @ 2023-03-30 22:41 UTC (permalink / raw
  To: gentoo-commits

commit:     a0035c9a825799ec5df594b8b7e3184fbf8cdd4f
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 30 22:37:21 2023 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Thu Mar 30 22:41:42 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0035c9a

dev-util/Tensile: adapt for msgpack-cxx-6.0.0

The name of the cmake module has changed again.

Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 ...ile-5.1.3-r2.ebuild => Tensile-5.1.3-r3.ebuild} | 15 +++++++------
 ...ile-5.4.2-r1.ebuild => Tensile-5.4.2-r2.ebuild} | 15 +++++++------
 ...1-Change-cmake-name-for-msgpack-5-release.patch | 25 ----------------------
 ...ange-cmake-name-for-msgpack-cxx-6-release.patch | 13 +++++++++++
 4 files changed, 29 insertions(+), 39 deletions(-)

diff --git a/dev-util/Tensile/Tensile-5.1.3-r2.ebuild b/dev-util/Tensile/Tensile-5.1.3-r3.ebuild
similarity index 89%
rename from dev-util/Tensile/Tensile-5.1.3-r2.ebuild
rename to dev-util/Tensile/Tensile-5.1.3-r3.ebuild
index 2f487059341f..da1adcab4f7b 100644
--- a/dev-util/Tensile/Tensile-5.1.3-r2.ebuild
+++ b/dev-util/Tensile/Tensile-5.1.3-r3.ebuild
@@ -23,7 +23,7 @@ SLOT="0/$(ver_cut 1-2)"
 RESTRICT="test"
 
 RDEPEND="${PYTHON_DEPS}
-	dev-cpp/msgpack-cxx
+	>=dev-cpp/msgpack-cxx-6.0.0
 	dev-python/pyyaml[${PYTHON_USEDEP}]
 	dev-python/msgpack[${PYTHON_USEDEP}]
 	dev-util/hip
@@ -32,12 +32,13 @@ RDEPEND="${PYTHON_DEPS}
 "
 DEPEND="${RDEPEND}"
 
-PATCHES=( "${FILESDIR}"/${PN}-4.3.0-output-commands.patch
-		  "${FILESDIR}"/${PN}-5.0.2-gfx1031.patch
-		  "${FILESDIR}"/${PN}-5.0.2-fix-arch-parse.patch
-		  "${FILESDIR}"/${PN}-5.0.2-use-ninja.patch
-		  "${FILESDIR}"/0001-Change-cmake-name-for-msgpack-5-release.patch
-	  )
+PATCHES=(
+	"${FILESDIR}"/${PN}-change-cmake-name-for-msgpack-cxx-6-release.patch
+	"${FILESDIR}"/${PN}-4.3.0-output-commands.patch
+	"${FILESDIR}"/${PN}-5.0.2-gfx1031.patch
+	"${FILESDIR}"/${PN}-5.0.2-fix-arch-parse.patch
+	"${FILESDIR}"/${PN}-5.0.2-use-ninja.patch
+)
 
 CMAKE_USE_DIR="${WORKDIR}/Source"
 

diff --git a/dev-util/Tensile/Tensile-5.4.2-r1.ebuild b/dev-util/Tensile/Tensile-5.4.2-r2.ebuild
similarity index 91%
rename from dev-util/Tensile/Tensile-5.4.2-r1.ebuild
rename to dev-util/Tensile/Tensile-5.4.2-r2.ebuild
index 8c23e68fdb21..c846dce60997 100644
--- a/dev-util/Tensile/Tensile-5.4.2-r1.ebuild
+++ b/dev-util/Tensile/Tensile-5.4.2-r2.ebuild
@@ -25,7 +25,7 @@ REQUIRED_USE="client? ( ${ROCM_REQUIRED_USE} )"
 RESTRICT="test"
 
 RDEPEND="${PYTHON_DEPS}
-	dev-cpp/msgpack-cxx
+	>=dev-cpp/msgpack-cxx-6.0.0
 	dev-python/pyyaml[${PYTHON_USEDEP}]
 	dev-python/msgpack[${PYTHON_USEDEP}]
 	dev-util/hip
@@ -34,12 +34,13 @@ RDEPEND="${PYTHON_DEPS}
 "
 DEPEND="${RDEPEND}"
 
-PATCHES=( "${FILESDIR}"/${PN}-4.3.0-output-commands.patch
-		  "${FILESDIR}"/${PN}-5.4.2-gfx1031.patch
-		  "${FILESDIR}"/${PN}-5.4.2-fix-arch-parse.patch
-		  "${FILESDIR}"/${PN}-5.4.2-use-ninja.patch
-		  "${FILESDIR}"/0001-Change-cmake-name-for-msgpack-5-release.patch
-	  )
+PATCHES=(
+	"${FILESDIR}"/${PN}-change-cmake-name-for-msgpack-cxx-6-release.patch
+	"${FILESDIR}"/${PN}-4.3.0-output-commands.patch
+	"${FILESDIR}"/${PN}-5.4.2-gfx1031.patch
+	"${FILESDIR}"/${PN}-5.4.2-fix-arch-parse.patch
+	"${FILESDIR}"/${PN}-5.4.2-use-ninja.patch
+)
 
 CMAKE_USE_DIR="${S}/${PN}/Source"
 

diff --git a/dev-util/Tensile/files/0001-Change-cmake-name-for-msgpack-5-release.patch b/dev-util/Tensile/files/0001-Change-cmake-name-for-msgpack-5-release.patch
deleted file mode 100644
index 7f8fb95123ee..000000000000
--- a/dev-util/Tensile/files/0001-Change-cmake-name-for-msgpack-5-release.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 66f5f943bbd0fd3b41b02ce7a563bed9f59f9c38 Mon Sep 17 00:00:00 2001
-From: Yiyang Wu <xgreenlandforwyy@gmail.com>
-Date: Sat, 11 Feb 2023 15:37:11 +0800
-Subject: [PATCH] Change cmake name for msgpack-5 release
-
----
- Tensile/Source/lib/CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Tensile/Source/lib/CMakeLists.txt b/Tensile/Source/lib/CMakeLists.txt
-index 47a5d15d..f1a6118b 100644
---- a/Tensile/Source/lib/CMakeLists.txt
-+++ b/Tensile/Source/lib/CMakeLists.txt
-@@ -97,7 +97,7 @@ if(TENSILE_USE_LLVM OR TENSILE_USE_MSGPACK)
- endif()
- 
- if(TENSILE_USE_MSGPACK)
--    find_package(msgpack REQUIRED)
-+    find_package(msgpackc-cxx REQUIRED)
-     target_compile_definitions(TensileHost PUBLIC -DTENSILE_MSGPACK=1)
- 
-     if(TARGET msgpackc-cxx)
--- 
-2.39.1
-

diff --git a/dev-util/Tensile/files/Tensile-change-cmake-name-for-msgpack-cxx-6-release.patch b/dev-util/Tensile/files/Tensile-change-cmake-name-for-msgpack-cxx-6-release.patch
new file mode 100644
index 000000000000..d8ac203781da
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-change-cmake-name-for-msgpack-cxx-6-release.patch
@@ -0,0 +1,13 @@
+Yiyang's original patch for msgpack-cxx-5 adapted to version 6.
+
+--- a/Tensile/Source/lib/CMakeLists.txt
++++ b/Tensile/Source/lib/CMakeLists.txt
+@@ -97,7 +97,7 @@ if(TENSILE_USE_LLVM OR TENSILE_USE_MSGPACK)
+ endif()
+ 
+ if(TENSILE_USE_MSGPACK)
+-    find_package(msgpack REQUIRED)
++    find_package(msgpack-cxx REQUIRED)
+     target_compile_definitions(TensileHost PUBLIC -DTENSILE_MSGPACK=1)
+ 
+     if(TARGET msgpackc-cxx)


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/, dev-util/Tensile/files/
@ 2023-11-27 14:35 Benda XU
  0 siblings, 0 replies; 6+ messages in thread
From: Benda XU @ 2023-11-27 14:35 UTC (permalink / raw
  To: gentoo-commits

commit:     02cb2430fcb5dbc70df96be5380228a8e47c8d80
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Wed Oct 18 18:42:05 2023 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Mon Nov 27 14:34:53 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=02cb2430

dev-util/Tensile: add 5.7.1

increase LLVM_MAX_SLOT to 17

Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 dev-util/Tensile/Manifest                          |   1 +
 dev-util/Tensile/Tensile-5.7.1-r1.ebuild           | 132 +++++++++++++++++++++
 .../Tensile-5.7.1-expand-isa-compatibility.patch   |  49 ++++++++
 .../Tensile/files/Tensile-5.7.1-gentoopath.patch   |  57 +++++++++
 4 files changed, 239 insertions(+)

diff --git a/dev-util/Tensile/Manifest b/dev-util/Tensile/Manifest
index 643f4fe5816c..4d93ffa204a1 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.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

diff --git a/dev-util/Tensile/Tensile-5.7.1-r1.ebuild b/dev-util/Tensile/Tensile-5.7.1-r1.ebuild
new file mode 100644
index 000000000000..709189734d4a
--- /dev/null
+++ b/dev-util/Tensile/Tensile-5.7.1-r1.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2023 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}
+inherit cmake distutils-r1 llvm prefix rocm
+
+LLVM_MAX_SLOT=17
+
+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)"
+IUSE="client test"
+REQUIRED_USE="client? ( ${ROCM_REQUIRED_USE} )"
+
+RESTRICT="!test? ( test )"
+
+RDEPEND="${PYTHON_DEPS}
+	>=dev-cpp/msgpack-cxx-6.0.0
+	dev-python/pyyaml[${PYTHON_USEDEP}]
+	dev-python/msgpack[${PYTHON_USEDEP}]
+	dev-util/hip
+	>=dev-util/rocm-smi-4.3.0
+	sys-devel/clang:${LLVM_MAX_SLOT}
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	test? (
+		dev-python/pytest-forked[${PYTHON_USEDEP}]
+		dev-python/pytest-xdist[${PYTHON_USEDEP}]
+		dev-python/filelock[${PYTHON_USEDEP}]
+	)
+"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-change-cmake-name-for-msgpack-cxx-6-release.patch
+	"${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}-5.7.1-expand-isa-compatibility.patch
+)
+
+CMAKE_USE_DIR="${S}/${PN}/Source"
+
+src_prepare() {
+	distutils-r1_src_prepare
+	sed -e "s,\@LLVM_PATH\@,$(get_llvm_prefix ${LLVM_MAX_SLOT}),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 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
+}
+
+# Test suite fails to start without this
+python_test() {
+	export ROCM_PATH="${EPREFIX}/usr"
+	epytest
+}

diff --git a/dev-util/Tensile/files/Tensile-5.7.1-expand-isa-compatibility.patch b/dev-util/Tensile/files/Tensile-5.7.1-expand-isa-compatibility.patch
new file mode 100644
index 000000000000..ebfc537c5c4d
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-5.7.1-expand-isa-compatibility.patch
@@ -0,0 +1,49 @@
+Allow Tensile to load the compatible kernels when running on
+architectures compatible with those ISAs.
+
+Based on patch from Cordell Bloor <cgmb@slerp.xyz>
+https://salsa.debian.org/rocm-team/rocblas/-/blob/master/debian/patches/0012-expand-isa-compatibility.patch
+
+--- 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>
+@@ -56,6 +58,31 @@ namespace Tensile
+         {
+             hipDeviceProp_t prop;
+             HIP_CHECK_EXC(hipGetDeviceProperties(&prop, deviceId));
++            // coerce to compatible arch
++            switch(prop.gcnArch)
++            {
++            case 902:
++            case 909:
++            case 912:
++                prop.gcnArch = 900;
++                std::strcpy(prop.gcnArchName, "gfx900");
++                break;
++            case 1011:
++            case 1012:
++            case 1013:
++                prop.gcnArch = 1010;
++                std::strcpy(prop.gcnArchName, "gfx1010");
++                break;
++            case 1031:
++            case 1032:
++            case 1033:
++            case 1034:
++            case 1035:
++            case 1036:
++                prop.gcnArch = 1030;
++                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-5.7.1-gentoopath.patch b/dev-util/Tensile/files/Tensile-5.7.1-gentoopath.patch
new file mode 100644
index 000000000000..c8bc360cc39b
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-5.7.1-gentoopath.patch
@@ -0,0 +1,57 @@
+Fix incorrect path in scripts and CMakeLists, in order to build tensile_client 
+
+--- a/HostLibraryTests/CMakeLists.txt
++++ b/HostLibraryTests/CMakeLists.txt
+@@ -139,7 +139,7 @@ set(test_sources ${test_sources}
+ )
+ 
+ if(TENSILE_USE_LLVM)
+-    find_package(LLVM REQUIRED CONFIG)
++    find_package(LLVM PATHS @LLVM_PATH@ REQUIRED CONFIG)
+ 
+     set(test_sources ${test_sources}
+         ContractionLibraryLoading_test.cpp
+--- a/Tensile/ClientWriter.py
++++ b/Tensile/ClientWriter.py
+@@ -176,7 +176,7 @@ def runClient(libraryLogicPath, forBenchmark, enableTileSelection, configPaths=N
+ 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"]
+--- a/Tensile/Common.py
++++ b/Tensile/Common.py
+@@ -2108,7 +2108,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:
+--- a/Tensile/GenerateSummations.py
++++ b/Tensile/GenerateSummations.py
+@@ -59,7 +59,7 @@ def createLibraryForBenchmark(logicPath, libraryPath, currentPath):
+     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", "--cxx-compiler=hipcc", "--library-format=yaml", \
+--- a/Tensile/Source/lib/CMakeLists.txt
++++ b/Tensile/Source/lib/CMakeLists.txt
+@@ -52,7 +52,7 @@ set(tensile_sources  ${tensile_sources}
+     )
+ 
+ if(TENSILE_USE_LLVM)
+-    find_package(LLVM REQUIRED CONFIG)
++    find_package(LLVM PATHS @LLVM_PATH@ REQUIRED CONFIG)
+ 
+     set(tensile_sources ${tensile_sources}
+         source/llvm/YAML.cpp


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-11-27 14:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-31 14:30 [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/, dev-util/Tensile/files/ Benda XU
  -- strict thread matches above, loose matches on Subject: below --
2023-11-27 14:35 Benda XU
2023-03-30 22:41 Marek Szuba
2023-02-01  1:52 Benda XU
2022-12-19 14:00 Andreas Sturmlechner
2022-03-05 20:51 Andrew Ammerlaan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox