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

commit:     dd65c43ed711ff1bb33d4bd6e705de5d9fa47528
Author:     YiyangWu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Sun Mar 13 13:18:42 2022 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 07:33:49 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd65c43e

dev-util/Tensile: FHS and benchmark feature

The previous Tensile package installs non-python files
in python site directory. This change move Config files
to /usr/share. Various patches are applied for correcting
paths.

Also, enable gfx1031 target so people can run benchmark
on navi22 GPUs.

Closes: https://github.com/gentoo/gentoo/pull/24537
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 dev-util/Tensile/Tensile-4.3.0-r1.ebuild           |  86 +++++++++++++++
 dev-util/Tensile/Tensile-4.3.0.ebuild              |  74 -------------
 .../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 +++++++++++++++++++++
 .../Tensile/files/Tensile-4.3.0-use-ninja.patch    |  21 ++++
 6 files changed, 300 insertions(+), 74 deletions(-)

diff --git a/dev-util/Tensile/Tensile-4.3.0-r1.ebuild b/dev-util/Tensile/Tensile-4.3.0-r1.ebuild
new file mode 100644
index 000000000000..143867819d04
--- /dev/null
+++ b/dev-util/Tensile/Tensile-4.3.0-r1.ebuild
@@ -0,0 +1,86 @@
+# 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}]
+	>=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
+		  "${FILESDIR}"/${PN}-4.3.0-gentoopath.patch
+	  )
+
+src_prepare() {
+	distutils-r1_src_prepare
+
+	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
+	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/Tensile-4.3.0.ebuild b/dev-util/Tensile/Tensile-4.3.0.ebuild
deleted file mode 100644
index cf33fb19cf10..000000000000
--- a/dev-util/Tensile/Tensile-4.3.0.ebuild
+++ /dev/null
@@ -1,74 +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
-
-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-fix-arch-parse.patch b/dev-util/Tensile/files/Tensile-4.3.0-fix-arch-parse.patch
new file mode 100644
index 000000000000..01b94b32cb6e
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-4.3.0-fix-arch-parse.patch
@@ -0,0 +1,12 @@
+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
new file mode 100644
index 000000000000..6fda0ddc6a8d
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-4.3.0-gentoopath.patch
@@ -0,0 +1,62 @@
+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 /opt/gentoo/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"] = "/opt/gentoo/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
new file mode 100644
index 000000000000..99abceb7c44d
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-4.3.0-gfx1031.patch
@@ -0,0 +1,119 @@
+--- 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-use-ninja.patch b/dev-util/Tensile/files/Tensile-4.3.0-use-ninja.patch
new file mode 100644
index 000000000000..6645efd72fb1
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-4.3.0-use-ninja.patch
@@ -0,0 +1,21 @@
+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] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/files/, dev-util/Tensile/
@ 2022-03-27  3:12 Benda XU
  0 siblings, 0 replies; 10+ messages in thread
From: Benda XU @ 2022-03-27  3:12 UTC (permalink / raw
  To: gentoo-commits

commit:     14d25dadca383910e28865144a2316fe302dbf96
Author:     YiyangWu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Thu Mar 24 13:00:38 2022 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 03:12:52 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14d25dad

dev-util/Tensile: fix hardcoded EPREFIX in gentoopath.patch

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 dev-util/Tensile/Tensile-4.3.0-r1.ebuild              | 4 ++--
 dev-util/Tensile/files/Tensile-4.3.0-gentoopath.patch | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dev-util/Tensile/Tensile-4.3.0-r1.ebuild b/dev-util/Tensile/Tensile-4.3.0-r1.ebuild
index 143867819d04..91bbbda89785 100644
--- a/dev-util/Tensile/Tensile-4.3.0-r1.ebuild
+++ b/dev-util/Tensile/Tensile-4.3.0-r1.ebuild
@@ -5,7 +5,7 @@ EAPI=8
 
 PYTHON_COMPAT=( python3_{8..10} )
 DISTUTILS_USE_PEP517=setuptools
-inherit distutils-r1
+inherit distutils-r1 prefix
 
 DESCRIPTION="Stretching GPU performance for GEMMs and tensor contractions"
 HOMEPAGE="https://github.com/ROCmSoftwarePlatform/Tensile"
@@ -33,11 +33,11 @@ PATCHES=( "${FILESDIR}"/${PN}-4.3.0-output-commands.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
-		  "${FILESDIR}"/${PN}-4.3.0-gentoopath.patch
 	  )
 
 src_prepare() {
 	distutils-r1_src_prepare
+	eapply $(prefixify_ro "${FILESDIR}"/${PN}-4.3.0-gentoopath.patch)
 
 	pushd ${PN} || die
 

diff --git a/dev-util/Tensile/files/Tensile-4.3.0-gentoopath.patch b/dev-util/Tensile/files/Tensile-4.3.0-gentoopath.patch
index 6fda0ddc6a8d..da135e3b38ee 100644
--- a/dev-util/Tensile/files/Tensile-4.3.0-gentoopath.patch
+++ b/dev-util/Tensile/files/Tensile-4.3.0-gentoopath.patch
@@ -17,7 +17,7 @@ Index: Tensile-rocm-4.3.0/Tensile/Source/lib/CMakeLists.txt
  
  if(TENSILE_USE_LLVM)
 -    find_package(LLVM 13.0 QUIET CONFIG)
-+    find_package(LLVM PATHS /opt/gentoo/usr/lib/llvm/roc 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)
@@ -30,7 +30,7 @@ Index: Tensile-rocm-4.3.0/Tensile/Common.py
        print2(" %24s: %8s (unspecified)" % (key, defaultValue))
  
 -  globalParameters["ROCmPath"] = "/opt/rocm"
-+  globalParameters["ROCmPath"] = "/opt/gentoo/usr"
++  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:


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

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/files/, dev-util/Tensile/
@ 2022-03-27  3:12 Benda XU
  0 siblings, 0 replies; 10+ messages in thread
From: Benda XU @ 2022-03-27  3:12 UTC (permalink / raw
  To: gentoo-commits

commit:     f4aae2060ce38589b7fc56c5fcd165b291ffa986
Author:     YiyangWu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Tue Mar 22 09:27:48 2022 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 03:12:51 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4aae206

dev-util/Tensile: bump version to 5.0.2

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 dev-util/Tensile/Manifest                          |   2 +
 dev-util/Tensile/Tensile-5.0.2.ebuild              |  83 ++++++++++++++++
 .../files/Tensile-5.0.2-fix-arch-parse.patch       |  12 +++
 .../Tensile/files/Tensile-5.0.2-gentoopath.patch   |  75 +++++++++++++++
 dev-util/Tensile/files/Tensile-5.0.2-gfx1031.patch | 104 +++++++++++++++++++++
 .../Tensile/files/Tensile-5.0.2-use-ninja.patch    |  21 +++++
 6 files changed, 297 insertions(+)

diff --git a/dev-util/Tensile/Manifest b/dev-util/Tensile/Manifest
index fd4cac044af8..c3e8f48bab20 100644
--- a/dev-util/Tensile/Manifest
+++ b/dev-util/Tensile/Manifest
@@ -1 +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

diff --git a/dev-util/Tensile/Tensile-5.0.2.ebuild b/dev-util/Tensile/Tensile-5.0.2.ebuild
new file mode 100644
index 000000000000..1210cd769aa5
--- /dev/null
+++ b/dev-util/Tensile/Tensile-5.0.2.ebuild
@@ -0,0 +1,83 @@
+# 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
+		https://github.com/littlewu2508/littlewu2508.github.io/raw/main/gentoo-distfiles/${P}-PR1419.patch.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}-5.0.2-gfx1031.patch
+		  "${FILESDIR}"/${PN}-5.0.2-fix-arch-parse.patch
+		  "${FILESDIR}"/${PN}-5.0.2-use-ninja.patch
+		  "${WORKDIR}"/${PN}-5.0.2-PR1419.patch
+	  )
+
+CMAKE_USE_DIR="${WORKDIR}/Source"
+
+src_prepare() {
+	distutils-r1_src_prepare
+	eapply $(prefixify_ro "${FILESDIR}"/${PN}-5.0.2-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)/" -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
+	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.0.2-fix-arch-parse.patch b/dev-util/Tensile/files/Tensile-5.0.2-fix-arch-parse.patch
new file mode 100644
index 000000000000..47bee8819c44
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-5.0.2-fix-arch-parse.patch
@@ -0,0 +1,12 @@
+Index: Tensile-rocm-5.0.1/Tensile/Tensile.py
+===================================================================
+--- Tensile-rocm-5.0.1.orig/Tensile/Tensile.py
++++ Tensile-rocm-5.0.1/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-5.0.2-gentoopath.patch b/dev-util/Tensile/files/Tensile-5.0.2-gentoopath.patch
new file mode 100644
index 000000000000..b8b59af5184e
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-5.0.2-gentoopath.patch
@@ -0,0 +1,75 @@
+Fix incorrect path in scripts and CMakeLists, in order to build tensile_client 
+===================================================================
+--- Tensile-rocm-5.0.2.orig/Tensile/Source/client/CMakeLists.txt
++++ Tensile-rocm-5.0.2/Tensile/Source/client/CMakeLists.txt
+@@ -56,3 +56,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-5.0.2/Tensile/Source/lib/CMakeLists.txt
+===================================================================
+--- Tensile-rocm-5.0.2.orig/Tensile/Source/lib/CMakeLists.txt
++++ Tensile-rocm-5.0.2/Tensile/Source/lib/CMakeLists.txt
+@@ -47,7 +47,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-5.0.2/Tensile/Common.py
+===================================================================
+--- Tensile-rocm-5.0.2.orig/Tensile/Common.py
++++ Tensile-rocm-5.0.2/Tensile/Common.py
+@@ -1873,7 +1873,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.0.2/Tensile/ClientWriter.py
+===================================================================
+--- Tensile-rocm-5.0.2.orig/Tensile/ClientWriter.py
++++ Tensile-rocm-5.0.2/Tensile/ClientWriter.py
+@@ -205,7 +205,7 @@ def getBuildClientLibraryScript(buildPat
+   import io
+   runScriptFile = io.StringIO()
+ 
+-  callCreateLibraryCmd = globalParameters["ScriptPath"] + "/bin/TensileCreateLibrary"
++  callCreateLibraryCmd = "TensileCreateLibrary"
+ 
+ 
+   if globalParameters["MergeFiles"]:
+Index: Tensile-rocm-5.0.2/Tensile/GenerateSummations.py
+===================================================================
+--- Tensile-rocm-5.0.2.orig/Tensile/GenerateSummations.py
++++ Tensile-rocm-5.0.2/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", "--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.0.2/HostLibraryTests/CMakeLists.txt
+===================================================================
+--- Tensile-rocm-5.0.2.orig/HostLibraryTests/CMakeLists.txt
++++ Tensile-rocm-5.0.2/HostLibraryTests/CMakeLists.txt
+@@ -135,7 +135,7 @@ set(test_sources ${test_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)

diff --git a/dev-util/Tensile/files/Tensile-5.0.2-gfx1031.patch b/dev-util/Tensile/files/Tensile-5.0.2-gfx1031.patch
new file mode 100644
index 000000000000..17925cfd49e0
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-5.0.2-gfx1031.patch
@@ -0,0 +1,104 @@
+Index: Tensile-rocm-5.0.1/pytest.ini
+===================================================================
+--- Tensile-rocm-5.0.1.orig/pytest.ini
++++ Tensile-rocm-5.0.1/pytest.ini
+@@ -87,6 +87,7 @@ markers =
+  xfail-gfx1011: architecture
+  xfail-gfx1012: architecture
+  xfail-gfx1030: architecture
++ xfail-gfx1031: architecture
+  skip-gfx000:  architecture
+  skip-gfx900:  architecture
+  skip-gfx906:  architecture
+@@ -96,3 +97,4 @@ markers =
+  skip-gfx1011: architecture
+  skip-gfx1012: architecture
+  skip-gfx1030: architecture
++ skip-gfx1031: architecture
+Index: Tensile-rocm-5.0.1/Tensile/Common.py
+===================================================================
+--- Tensile-rocm-5.0.1.orig/Tensile/Common.py
++++ Tensile-rocm-5.0.1/Tensile/Common.py
+@@ -198,7 +198,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)] # 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)] # 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.
+@@ -264,7 +264,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'
+ }
+ 
+ def getArchitectureName(gfxName):
+Index: Tensile-rocm-5.0.1/Tensile/KernelWriterAssembly.py
+===================================================================
+--- Tensile-rocm-5.0.1.orig/Tensile/KernelWriterAssembly.py
++++ Tensile-rocm-5.0.1/Tensile/KernelWriterAssembly.py
+@@ -2364,7 +2364,7 @@ class KernelWriterAssembly(KernelWriter)
+ 
+     # 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):
++      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):
+         for b in range(0, kernel["ThreadTile1"]):
+           for a in range(0, kernel["ThreadTile0"]):
+             for iui in range(0, innerUnroll):
+Index: Tensile-rocm-5.0.1/Tensile/Source/CMakeLists.txt
+===================================================================
+--- Tensile-rocm-5.0.1.orig/Tensile/Source/CMakeLists.txt
++++ Tensile-rocm-5.0.1/Tensile/Source/CMakeLists.txt
+@@ -47,7 +47,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 CACHE STRING "GPU architectures")
++  set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack- gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 CACHE STRING "GPU architectures")
+ else()
+   set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906 gfx908 gfx90a CACHE STRING "GPU architectures")
+ endif()
+Index: Tensile-rocm-5.0.1/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
+===================================================================
+--- Tensile-rocm-5.0.1.orig/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
++++ Tensile-rocm-5.0.1/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
+@@ -62,7 +62,8 @@ namespace Tensile
+             gfx1010 = 1010,
+             gfx1011 = 1011,
+             gfx1012 = 1012,
+-            gfx1030 = 1030
++            gfx1030 = 1030,
++            gfx1031 = 1031
+         };
+ 
+         AMDGPU();
+Index: Tensile-rocm-5.0.1/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp
+===================================================================
+--- Tensile-rocm-5.0.1.orig/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp
++++ Tensile-rocm-5.0.1/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);
+             }
+         };
+     } // namespace Serialization
+Index: Tensile-rocm-5.0.1/Tensile/Source/lib/source/AMDGPU.cpp
+===================================================================
+--- Tensile-rocm-5.0.1.orig/Tensile/Source/lib/source/AMDGPU.cpp
++++ Tensile-rocm-5.0.1/Tensile/Source/lib/source/AMDGPU.cpp
+@@ -82,6 +82,8 @@ namespace Tensile
+             return stream << "gfx1012";
+         case AMDGPU::Processor::gfx1030:
+             return stream << "gfx1030";
++        case AMDGPU::Processor::gfx1031:
++            return stream << "gfx1031";
+         }
+         return stream;
+     }

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
new file mode 100644
index 000000000000..485ec992d808
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-5.0.2-use-ninja.patch
@@ -0,0 +1,21 @@
+diff --git a/Tensile/ClientExecutable.py b/Tensile/ClientExecutable.py
+index ca3809f..2d1d83b 100644
+--- a/Tensile/ClientExecutable.py
++++ b/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] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/files/, dev-util/Tensile/
@ 2022-07-08 17:29 Benda XU
  0 siblings, 0 replies; 10+ messages in thread
From: Benda XU @ 2022-07-08 17:29 UTC (permalink / raw
  To: gentoo-commits

commit:     6f3b1d45da1bce917f473f74ff32586cc38018ea
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Fri Jul  8 12:55:57 2022 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Fri Jul  8 17:28:05 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f3b1d45

dev-util/Tensile: backport patch to control multiprocess

Reference: https://github.com/ROCmSoftwarePlatform/Tensile/commit/25b1621549f9b120462988913e657684645be79d
Bugs: https://bugs.gentoo.org/852236
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 ...ensile-5.0.2.ebuild => Tensile-5.0.2-r1.ebuild} |  1 +
 .../files/Tensile-5.0.2-adjust-parallel.patch      | 65 ++++++++++++++++++++++
 2 files changed, 66 insertions(+)

diff --git a/dev-util/Tensile/Tensile-5.0.2.ebuild b/dev-util/Tensile/Tensile-5.0.2-r1.ebuild
similarity index 98%
rename from dev-util/Tensile/Tensile-5.0.2.ebuild
rename to dev-util/Tensile/Tensile-5.0.2-r1.ebuild
index c9240e233281..5bb9a3f21927 100644
--- a/dev-util/Tensile/Tensile-5.0.2.ebuild
+++ b/dev-util/Tensile/Tensile-5.0.2-r1.ebuild
@@ -33,6 +33,7 @@ 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}"/${PN}-5.0.2-adjust-parallel.patch
 		  "${WORKDIR}"/${PN}-5.0.2-PR1419.patch
 	  )
 

diff --git a/dev-util/Tensile/files/Tensile-5.0.2-adjust-parallel.patch b/dev-util/Tensile/files/Tensile-5.0.2-adjust-parallel.patch
new file mode 100644
index 000000000000..b96429232c78
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-5.0.2-adjust-parallel.patch
@@ -0,0 +1,65 @@
+From 25b1621549f9b120462988913e657684645be79d Mon Sep 17 00:00:00 2001
+From: Lee Ringham <lringham@amd.com>
+Date: Tue, 2 Nov 2021 14:43:07 -0600
+Subject: [PATCH] Added better control of parallelism to control memory usage
+
+---
+ Tensile/Source/TensileCreateLibrary.cmake | 7 +++++--
+ Tensile/cmake/TensileConfig.cmake         | 5 +++++
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/Tensile/Source/TensileCreateLibrary.cmake b/Tensile/Source/TensileCreateLibrary.cmake
+index 1dbacf41df..996f365bcf 100644
+--- a/Tensile/Source/TensileCreateLibrary.cmake
++++ b/Tensile/Source/TensileCreateLibrary.cmake
+@@ -33,7 +33,8 @@ function(TensileCreateLibraryCmake
+     Tensile_LIBRARY_FORMAT
+     Tensile_MERGE_FILES
+     Tensile_SHORT_FILE_NAMES
+-    Tensile_LIBRARY_PRINT_DEBUG )
++    Tensile_LIBRARY_PRINT_DEBUG
++    Tensile_CPU_THREADS )
+ 
+ # make Tensile_PACKAGE_LIBRARY and optional parameter
+ # to avoid breaking applications which us this
+@@ -51,6 +52,7 @@ function(TensileCreateLibraryCmake
+   message(STATUS "Tensile_COMPILER            from TensileCreateLibraryCmake : ${Tensile_COMPILER}")
+   message(STATUS "Tensile_ARCHITECTURE        from TensileCreateLibraryCmake : ${Tensile_ARCHITECTURE}")
+   message(STATUS "Tensile_LIBRARY_FORMAT      from TensileCreateLibraryCmake : ${Tensile_LIBRARY_FORMAT}")
++  message(STATUS "Tensile_CPU_THREADS         from TensileCreateLibraryCmake : ${Tensile_CPU_THREADS}")
+ 
+   #execute_process(COMMAND chmod 755 ${Tensile_ROOT}/bin/TensileCreateLibrary)
+   #execute_process(COMMAND chmod 755 ${Tensile_ROOT}/bin/Tensile)
+@@ -89,7 +91,8 @@ function(TensileCreateLibraryCmake
+   set(Tensile_CREATE_COMMAND ${Tensile_CREATE_COMMAND} "--code-object-version=${Tensile_CODE_OBJECT_VERSION}")
+   set(Tensile_CREATE_COMMAND ${Tensile_CREATE_COMMAND} "--cxx-compiler=${Tensile_COMPILER}")
+   set(Tensile_CREATE_COMMAND ${Tensile_CREATE_COMMAND} "--library-format=${Tensile_LIBRARY_FORMAT}")
+-
++  set(Tensile_CREATE_COMMAND ${Tensile_CREATE_COMMAND} "--jobs=${Tensile_CPU_THREADS}")
++  
+   # TensileLibraryWriter positional arguments
+   set(Tensile_CREATE_COMMAND ${Tensile_CREATE_COMMAND}
+     ${Tensile_LOGIC_PATH}
+diff --git a/Tensile/cmake/TensileConfig.cmake b/Tensile/cmake/TensileConfig.cmake
+index 0ac8517c2c..fa8cb96305 100644
+--- a/Tensile/cmake/TensileConfig.cmake
++++ b/Tensile/cmake/TensileConfig.cmake
+@@ -112,6 +112,7 @@ function(TensileCreateLibraryFiles
+        LIBRARY_FORMAT
+        TENSILE_ROOT
+        VAR_PREFIX
++       CPU_THREADS
+        )
+ 
+   # Multi value settings
+@@ -184,6 +185,10 @@ function(TensileCreateLibraryFiles
+     set(Options ${Options} "--cmake-cxx-compiler=${Tensile_COMPILER_PATH}")
+   endif()
+ 
++  if(Tensile_CPU_THREADS)
++    set(Options ${Options} "--jobs=${Tensile_CPU_THREADS}")
++  endif()
++
+   if(Tensile_LIBRARY_FORMAT)
+     set(Options ${Options} "--library-format=${Tensile_LIBRARY_FORMAT}")
+     if(Tensile_LIBRARY_FORMAT MATCHES "yaml")


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

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/files/, dev-util/Tensile/
@ 2022-09-22  1:08 Benda XU
  0 siblings, 0 replies; 10+ messages in thread
From: Benda XU @ 2022-09-22  1:08 UTC (permalink / raw
  To: gentoo-commits

commit:     a31808f3051758ccde8604944e1559ce92ef8ec4
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Tue Jun 21 08:38:05 2022 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Thu Sep 22 01:06:33 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a31808f3

dev-util/Tensile: add 5.1.3, switch to vanilla clang-14

enable py3.11 as well.
No need to rebuild when hip upgrade since hip is just used at runtime.

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.0.2-r2.ebuild           |  2 +-
 ...ensile-5.0.2-r2.ebuild => Tensile-5.1.3.ebuild} | 16 +++--
 .../Tensile/files/Tensile-5.1.3-gentoopath.patch   | 75 ++++++++++++++++++++++
 4 files changed, 86 insertions(+), 8 deletions(-)

diff --git a/dev-util/Tensile/Manifest b/dev-util/Tensile/Manifest
index c3e8f48bab20..3b51748fa904 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-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-5.0.2-r2.ebuild b/dev-util/Tensile/Tensile-5.0.2-r2.ebuild
index 38854fd0c269..22d3a6cee451 100644
--- a/dev-util/Tensile/Tensile-5.0.2-r2.ebuild
+++ b/dev-util/Tensile/Tensile-5.0.2-r2.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{8..10} )
+PYTHON_COMPAT=( python3_{8..11} )
 DISTUTILS_USE_PEP517=setuptools
 inherit distutils-r1 prefix
 

diff --git a/dev-util/Tensile/Tensile-5.0.2-r2.ebuild b/dev-util/Tensile/Tensile-5.1.3.ebuild
similarity index 86%
copy from dev-util/Tensile/Tensile-5.0.2-r2.ebuild
copy to dev-util/Tensile/Tensile-5.1.3.ebuild
index 38854fd0c269..f2a39a52dbbb 100644
--- a/dev-util/Tensile/Tensile-5.0.2-r2.ebuild
+++ b/dev-util/Tensile/Tensile-5.1.3.ebuild
@@ -3,14 +3,16 @@
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{8..10} )
+PYTHON_COMPAT=( python3_{8..11} )
 DISTUTILS_USE_PEP517=setuptools
-inherit distutils-r1 prefix
+inherit distutils-r1 llvm prefix
+
+LLVM_MAX_SLOT=14
 
 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
-		https://github.com/littlewu2508/littlewu2508.github.io/raw/main/gentoo-distfiles/${P}-PR1419.patch.gz"
+		https://github.com/littlewu2508/littlewu2508.github.io/raw/main/gentoo-distfiles/${PN}-5.0.2-PR1419.patch.gz"
 S="${WORKDIR}/${PN}-rocm-${PV}"
 
 LICENSE="MIT"
@@ -24,24 +26,24 @@ RDEPEND="${PYTHON_DEPS}
 	dev-python/pyyaml[${PYTHON_USEDEP}]
 	dev-python/msgpack[${PYTHON_USEDEP}]
 	>=dev-util/rocm-smi-4.3.0
+	>=sys-devel/clang-14.0.6-r1:${LLVM_MAX_SLOT}=
 "
 DEPEND="${RDEPEND}
-	dev-util/hip:=
+	dev-util/hip
 "
 
 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}"/${PN}-5.0.2-adjust-parallel.patch
-		  "${WORKDIR}"/${PN}-5.0.2-PR1419.patch
 	  )
 
 CMAKE_USE_DIR="${WORKDIR}/Source"
 
 src_prepare() {
 	distutils-r1_src_prepare
-	eapply $(prefixify_ro "${FILESDIR}"/${PN}-5.0.2-gentoopath.patch)
+	sed -e "s,\@LLVM_PATH\@,$(get_llvm_prefix ${LLVM_MAX_SLOT}),g" "${FILESDIR}"/${PN}-5.1.3-gentoopath.patch > "${S}"/gentoopath.patch || die
+	eapply $(prefixify_ro "${S}"/gentoopath.patch)
 
 	pushd ${PN} || die
 

diff --git a/dev-util/Tensile/files/Tensile-5.1.3-gentoopath.patch b/dev-util/Tensile/files/Tensile-5.1.3-gentoopath.patch
new file mode 100644
index 000000000000..2f41bf3aa715
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-5.1.3-gentoopath.patch
@@ -0,0 +1,75 @@
+Fix incorrect path in scripts and CMakeLists, in order to build tensile_client 
+===================================================================
+--- Tensile-rocm-5.0.2.orig/Tensile/Source/client/CMakeLists.txt
++++ Tensile-rocm-5.0.2/Tensile/Source/client/CMakeLists.txt
+@@ -56,3 +56,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-5.0.2/Tensile/Source/lib/CMakeLists.txt
+===================================================================
+--- Tensile-rocm-5.0.2.orig/Tensile/Source/lib/CMakeLists.txt
++++ Tensile-rocm-5.0.2/Tensile/Source/lib/CMakeLists.txt
+@@ -47,7 +47,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.0.2/Tensile/Common.py
+===================================================================
+--- Tensile-rocm-5.0.2.orig/Tensile/Common.py
++++ Tensile-rocm-5.0.2/Tensile/Common.py
+@@ -1873,7 +1873,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.0.2/Tensile/ClientWriter.py
+===================================================================
+--- Tensile-rocm-5.0.2.orig/Tensile/ClientWriter.py
++++ Tensile-rocm-5.0.2/Tensile/ClientWriter.py
+@@ -205,7 +205,7 @@ def getBuildClientLibraryScript(buildPat
+   import io
+   runScriptFile = io.StringIO()
+ 
+-  callCreateLibraryCmd = globalParameters["ScriptPath"] + "/bin/TensileCreateLibrary"
++  callCreateLibraryCmd = "TensileCreateLibrary"
+ 
+ 
+   if globalParameters["MergeFiles"]:
+Index: Tensile-rocm-5.0.2/Tensile/GenerateSummations.py
+===================================================================
+--- Tensile-rocm-5.0.2.orig/Tensile/GenerateSummations.py
++++ Tensile-rocm-5.0.2/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", "--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.0.2/HostLibraryTests/CMakeLists.txt
+===================================================================
+--- Tensile-rocm-5.0.2.orig/HostLibraryTests/CMakeLists.txt
++++ Tensile-rocm-5.0.2/HostLibraryTests/CMakeLists.txt
+@@ -135,7 +135,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)


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

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/files/, dev-util/Tensile/
@ 2023-02-01  9:53 Andreas Sturmlechner
  0 siblings, 0 replies; 10+ messages in thread
From: Andreas Sturmlechner @ 2023-02-01  9:53 UTC (permalink / raw
  To: gentoo-commits

commit:     cf07867772891238e3f4f3e69199718ebadd5514
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 24 22:21:30 2023 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Feb  1 09:52:49 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf078677

dev-util/Tensile: drop 5.0.2-r2

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

 dev-util/Tensile/Manifest                          |  1 -
 dev-util/Tensile/Tensile-5.0.2-r2.ebuild           | 84 ----------------------
 .../files/Tensile-5.0.2-adjust-parallel.patch      | 65 -----------------
 .../Tensile/files/Tensile-5.0.2-gentoopath.patch   | 75 -------------------
 4 files changed, 225 deletions(-)

diff --git a/dev-util/Tensile/Manifest b/dev-util/Tensile/Manifest
index dd1df20ec814..643f4fe5816c 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-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.0.2-r2.ebuild b/dev-util/Tensile/Tensile-5.0.2-r2.ebuild
deleted file mode 100644
index 52b12f4f07d3..000000000000
--- a/dev-util/Tensile/Tensile-5.0.2-r2.ebuild
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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
-		https://github.com/littlewu2508/littlewu2508.github.io/raw/main/gentoo-distfiles/${P}-PR1419.patch.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:=
-"
-
-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}"/${PN}-5.0.2-adjust-parallel.patch
-		  "${WORKDIR}"/${PN}-5.0.2-PR1419.patch
-	  )
-
-CMAKE_USE_DIR="${WORKDIR}/Source"
-
-src_prepare() {
-	distutils-r1_src_prepare
-	eapply $(prefixify_ro "${FILESDIR}"/${PN}-5.0.2-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)/" -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.0.2-adjust-parallel.patch b/dev-util/Tensile/files/Tensile-5.0.2-adjust-parallel.patch
deleted file mode 100644
index b96429232c78..000000000000
--- a/dev-util/Tensile/files/Tensile-5.0.2-adjust-parallel.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 25b1621549f9b120462988913e657684645be79d Mon Sep 17 00:00:00 2001
-From: Lee Ringham <lringham@amd.com>
-Date: Tue, 2 Nov 2021 14:43:07 -0600
-Subject: [PATCH] Added better control of parallelism to control memory usage
-
----
- Tensile/Source/TensileCreateLibrary.cmake | 7 +++++--
- Tensile/cmake/TensileConfig.cmake         | 5 +++++
- 2 files changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/Tensile/Source/TensileCreateLibrary.cmake b/Tensile/Source/TensileCreateLibrary.cmake
-index 1dbacf41df..996f365bcf 100644
---- a/Tensile/Source/TensileCreateLibrary.cmake
-+++ b/Tensile/Source/TensileCreateLibrary.cmake
-@@ -33,7 +33,8 @@ function(TensileCreateLibraryCmake
-     Tensile_LIBRARY_FORMAT
-     Tensile_MERGE_FILES
-     Tensile_SHORT_FILE_NAMES
--    Tensile_LIBRARY_PRINT_DEBUG )
-+    Tensile_LIBRARY_PRINT_DEBUG
-+    Tensile_CPU_THREADS )
- 
- # make Tensile_PACKAGE_LIBRARY and optional parameter
- # to avoid breaking applications which us this
-@@ -51,6 +52,7 @@ function(TensileCreateLibraryCmake
-   message(STATUS "Tensile_COMPILER            from TensileCreateLibraryCmake : ${Tensile_COMPILER}")
-   message(STATUS "Tensile_ARCHITECTURE        from TensileCreateLibraryCmake : ${Tensile_ARCHITECTURE}")
-   message(STATUS "Tensile_LIBRARY_FORMAT      from TensileCreateLibraryCmake : ${Tensile_LIBRARY_FORMAT}")
-+  message(STATUS "Tensile_CPU_THREADS         from TensileCreateLibraryCmake : ${Tensile_CPU_THREADS}")
- 
-   #execute_process(COMMAND chmod 755 ${Tensile_ROOT}/bin/TensileCreateLibrary)
-   #execute_process(COMMAND chmod 755 ${Tensile_ROOT}/bin/Tensile)
-@@ -89,7 +91,8 @@ function(TensileCreateLibraryCmake
-   set(Tensile_CREATE_COMMAND ${Tensile_CREATE_COMMAND} "--code-object-version=${Tensile_CODE_OBJECT_VERSION}")
-   set(Tensile_CREATE_COMMAND ${Tensile_CREATE_COMMAND} "--cxx-compiler=${Tensile_COMPILER}")
-   set(Tensile_CREATE_COMMAND ${Tensile_CREATE_COMMAND} "--library-format=${Tensile_LIBRARY_FORMAT}")
--
-+  set(Tensile_CREATE_COMMAND ${Tensile_CREATE_COMMAND} "--jobs=${Tensile_CPU_THREADS}")
-+  
-   # TensileLibraryWriter positional arguments
-   set(Tensile_CREATE_COMMAND ${Tensile_CREATE_COMMAND}
-     ${Tensile_LOGIC_PATH}
-diff --git a/Tensile/cmake/TensileConfig.cmake b/Tensile/cmake/TensileConfig.cmake
-index 0ac8517c2c..fa8cb96305 100644
---- a/Tensile/cmake/TensileConfig.cmake
-+++ b/Tensile/cmake/TensileConfig.cmake
-@@ -112,6 +112,7 @@ function(TensileCreateLibraryFiles
-        LIBRARY_FORMAT
-        TENSILE_ROOT
-        VAR_PREFIX
-+       CPU_THREADS
-        )
- 
-   # Multi value settings
-@@ -184,6 +185,10 @@ function(TensileCreateLibraryFiles
-     set(Options ${Options} "--cmake-cxx-compiler=${Tensile_COMPILER_PATH}")
-   endif()
- 
-+  if(Tensile_CPU_THREADS)
-+    set(Options ${Options} "--jobs=${Tensile_CPU_THREADS}")
-+  endif()
-+
-   if(Tensile_LIBRARY_FORMAT)
-     set(Options ${Options} "--library-format=${Tensile_LIBRARY_FORMAT}")
-     if(Tensile_LIBRARY_FORMAT MATCHES "yaml")

diff --git a/dev-util/Tensile/files/Tensile-5.0.2-gentoopath.patch b/dev-util/Tensile/files/Tensile-5.0.2-gentoopath.patch
deleted file mode 100644
index b8b59af5184e..000000000000
--- a/dev-util/Tensile/files/Tensile-5.0.2-gentoopath.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-Fix incorrect path in scripts and CMakeLists, in order to build tensile_client 
-===================================================================
---- Tensile-rocm-5.0.2.orig/Tensile/Source/client/CMakeLists.txt
-+++ Tensile-rocm-5.0.2/Tensile/Source/client/CMakeLists.txt
-@@ -56,3 +56,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-5.0.2/Tensile/Source/lib/CMakeLists.txt
-===================================================================
---- Tensile-rocm-5.0.2.orig/Tensile/Source/lib/CMakeLists.txt
-+++ Tensile-rocm-5.0.2/Tensile/Source/lib/CMakeLists.txt
-@@ -47,7 +47,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-5.0.2/Tensile/Common.py
-===================================================================
---- Tensile-rocm-5.0.2.orig/Tensile/Common.py
-+++ Tensile-rocm-5.0.2/Tensile/Common.py
-@@ -1873,7 +1873,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.0.2/Tensile/ClientWriter.py
-===================================================================
---- Tensile-rocm-5.0.2.orig/Tensile/ClientWriter.py
-+++ Tensile-rocm-5.0.2/Tensile/ClientWriter.py
-@@ -205,7 +205,7 @@ def getBuildClientLibraryScript(buildPat
-   import io
-   runScriptFile = io.StringIO()
- 
--  callCreateLibraryCmd = globalParameters["ScriptPath"] + "/bin/TensileCreateLibrary"
-+  callCreateLibraryCmd = "TensileCreateLibrary"
- 
- 
-   if globalParameters["MergeFiles"]:
-Index: Tensile-rocm-5.0.2/Tensile/GenerateSummations.py
-===================================================================
---- Tensile-rocm-5.0.2.orig/Tensile/GenerateSummations.py
-+++ Tensile-rocm-5.0.2/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", "--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.0.2/HostLibraryTests/CMakeLists.txt
-===================================================================
---- Tensile-rocm-5.0.2.orig/HostLibraryTests/CMakeLists.txt
-+++ Tensile-rocm-5.0.2/HostLibraryTests/CMakeLists.txt
-@@ -135,7 +135,7 @@ set(test_sources ${test_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)


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

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/files/, dev-util/Tensile/
@ 2023-02-24 16:50 Marek Szuba
  0 siblings, 0 replies; 10+ messages in thread
From: Marek Szuba @ 2023-02-24 16:50 UTC (permalink / raw
  To: gentoo-commits

commit:     81aebd088f646095930f961c38fae6a769c21328
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Sat Feb 11 09:14:03 2023 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Fri Feb 24 16:49:47 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=81aebd08

dev-util/Tensile: support >=dev-cpp/msgpack-cxx-5.0.0

Closes: https://bugs.gentoo.org/893544
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 dev-util/Tensile/Tensile-5.1.3-r1.ebuild           |  9 ++++----
 dev-util/Tensile/Tensile-5.4.2.ebuild              |  9 ++++----
 ...1-Change-cmake-name-for-msgpack-5-release.patch | 25 ++++++++++++++++++++++
 3 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/dev-util/Tensile/Tensile-5.1.3-r1.ebuild b/dev-util/Tensile/Tensile-5.1.3-r1.ebuild
index 3105b82b83a7..2f487059341f 100644
--- a/dev-util/Tensile/Tensile-5.1.3-r1.ebuild
+++ b/dev-util/Tensile/Tensile-5.1.3-r1.ebuild
@@ -23,19 +23,20 @@ SLOT="0/$(ver_cut 1-2)"
 RESTRICT="test"
 
 RDEPEND="${PYTHON_DEPS}
-	sys-devel/clang:${LLVM_MAX_SLOT}
+	dev-cpp/msgpack-cxx
 	dev-python/pyyaml[${PYTHON_USEDEP}]
 	dev-python/msgpack[${PYTHON_USEDEP}]
-	>=dev-util/rocm-smi-4.3.0
-"
-DEPEND="${RDEPEND}
 	dev-util/hip
+	sys-devel/clang:${LLVM_MAX_SLOT}
+	>=dev-util/rocm-smi-4.3.0
 "
+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
 	  )
 
 CMAKE_USE_DIR="${WORKDIR}/Source"

diff --git a/dev-util/Tensile/Tensile-5.4.2.ebuild b/dev-util/Tensile/Tensile-5.4.2.ebuild
index 1e347fdcee56..9a12444e7abf 100644
--- a/dev-util/Tensile/Tensile-5.4.2.ebuild
+++ b/dev-util/Tensile/Tensile-5.4.2.ebuild
@@ -22,19 +22,20 @@ SLOT="0/$(ver_cut 1-2)"
 RESTRICT="test"
 
 RDEPEND="${PYTHON_DEPS}
-	sys-devel/clang:${LLVM_MAX_SLOT}
+	dev-cpp/msgpack-cxx
 	dev-python/pyyaml[${PYTHON_USEDEP}]
 	dev-python/msgpack[${PYTHON_USEDEP}]
-	>=dev-util/rocm-smi-4.3.0
-"
-DEPEND="${RDEPEND}
 	dev-util/hip
+	>=dev-util/rocm-smi-4.3.0
+	sys-devel/clang:${LLVM_MAX_SLOT}
 "
+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
 	  )
 
 CMAKE_USE_DIR="${WORKDIR}/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
new file mode 100644
index 000000000000..7f8fb95123ee
--- /dev/null
+++ b/dev-util/Tensile/files/0001-Change-cmake-name-for-msgpack-5-release.patch
@@ -0,0 +1,25 @@
+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
+


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

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/files/, dev-util/Tensile/
@ 2023-02-24 16:50 Marek Szuba
  0 siblings, 0 replies; 10+ messages in thread
From: Marek Szuba @ 2023-02-24 16:50 UTC (permalink / raw
  To: gentoo-commits

commit:     523d7b2ee32d79b44796efa2c08f0b897c633801
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Sat Feb 11 10:43:46 2023 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Fri Feb 24 16:49:51 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=523d7b2e

dev-util/Tensile: add client USE to compile tensile_client

tensile_client is for running benchmarks. By default, Tensile contains a
whole set of scripts to configure and compile tensile_client via cmake
for very benchmark. This commit enables a use flag to compile and
install this executable, so at runtime benchmark won't need to compile
again.

Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 dev-util/Tensile/Tensile-5.4.2.ebuild              | 32 +++++++++++++++++++--
 ...01-Detect-prebuilt-tensile_client-in-PATH.patch | 33 ++++++++++++++++++++++
 dev-util/Tensile/metadata.xml                      |  3 ++
 3 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/dev-util/Tensile/Tensile-5.4.2.ebuild b/dev-util/Tensile/Tensile-5.4.2.ebuild
index 9a12444e7abf..8c23e68fdb21 100644
--- a/dev-util/Tensile/Tensile-5.4.2.ebuild
+++ b/dev-util/Tensile/Tensile-5.4.2.ebuild
@@ -5,7 +5,8 @@ EAPI=8
 
 PYTHON_COMPAT=( python3_{10..11} )
 DISTUTILS_USE_PEP517=setuptools
-inherit distutils-r1 llvm prefix
+ROCM_VERSION=${PV}
+inherit cmake distutils-r1 llvm prefix rocm
 
 LLVM_MAX_SLOT=15
 
@@ -17,6 +18,8 @@ S="${WORKDIR}/${PN}-rocm-${PV}"
 LICENSE="MIT"
 KEYWORDS="~amd64"
 SLOT="0/$(ver_cut 1-2)"
+IUSE="client"
+REQUIRED_USE="client? ( ${ROCM_REQUIRED_USE} )"
 
 # Not compatible with recent versions of pytest
 RESTRICT="test"
@@ -38,7 +41,7 @@ PATCHES=( "${FILESDIR}"/${PN}-4.3.0-output-commands.patch
 		  "${FILESDIR}"/0001-Change-cmake-name-for-msgpack-5-release.patch
 	  )
 
-CMAKE_USE_DIR="${WORKDIR}/Source"
+CMAKE_USE_DIR="${S}/${PN}/Source"
 
 src_prepare() {
 	distutils-r1_src_prepare
@@ -68,6 +71,26 @@ src_prepare() {
 	popd || die
 
 	sed -e "/package_data/d" -e "/data_files/d" -i setup.py || die
+	use client && PATCHES= cmake_src_prepare  # do not apply patches again in cmake_src_prepare
+}
+
+src_configure() {
+	distutils-r1_src_configure
+	if use client; then
+		local mycmakeargs=(
+			-DCMAKE_SKIP_RPATH=ON
+			-DTENSILE_USE_MSGPACK=ON
+			-DTENSILE_USE_LLVM=ON
+			-DTensile_LIBRARY_FORMAT=msgpack
+			-DAMDGPU_TARGETS="$(get_amdgpu_flags)"
+		)
+		CXX=hipcc cmake_src_configure
+	fi
+}
+
+src_compile() {
+	distutils-r1_src_compile
+	use client && cmake_src_compile
 }
 
 python_install() {
@@ -87,4 +110,9 @@ src_install() {
 	doins -r Configs Perf ReplacementKernels ReplacementKernels-cov3 Source CustomKernels
 	insinto /usr/$(get_libdir)/cmake/${PN}
 	doins cmake/*.cmake
+
+	if use client; then
+		pushd "${BUILD_DIR}" || die
+		dobin client/tensile_client
+	fi
 }

diff --git a/dev-util/Tensile/files/0001-Detect-prebuilt-tensile_client-in-PATH.patch b/dev-util/Tensile/files/0001-Detect-prebuilt-tensile_client-in-PATH.patch
new file mode 100644
index 000000000000..116711db44fc
--- /dev/null
+++ b/dev-util/Tensile/files/0001-Detect-prebuilt-tensile_client-in-PATH.patch
@@ -0,0 +1,33 @@
+From 3c806ec52f46d0a1f770f524d1e4f0ffeb8809c2 Mon Sep 17 00:00:00 2001
+From: Yiyang Wu <xgreenlandforwyy@gmail.com>
+Date: Sat, 11 Feb 2023 17:48:08 +0800
+Subject: [PATCH] Detect prebuilt tensile_client in PATH
+
+---
+ Tensile/Tensile.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/Tensile/Tensile.py b/Tensile/Tensile.py
+index 961ea88f..123f8a7a 100644
+--- a/Tensile/Tensile.py
++++ b/Tensile/Tensile.py
+@@ -38,6 +38,7 @@ from . import LibraryIO
+ from . import LibraryLogic
+ from . import __version__
+ from datetime import datetime
++from shutil import which
+ 
+ 
+ ###############################################################################
+@@ -127,7 +128,7 @@ def addCommonArguments(argParser):
+         action="store", help="select which library format to use")
+     argParser.add_argument("--client-build-path", default=None)
+     argParser.add_argument("--client-lock", default=None)
+-    argParser.add_argument("--prebuilt-client", default=None)
++    argParser.add_argument("--prebuilt-client", default=which("tensile_client"))
+ 
+     argParser.add_argument("--global-parameters", nargs="+", type=splitExtraParameters, default=[])
+ 
+-- 
+2.39.1
+

diff --git a/dev-util/Tensile/metadata.xml b/dev-util/Tensile/metadata.xml
index 97a4d2e3c600..32364cb13b06 100644
--- a/dev-util/Tensile/metadata.xml
+++ b/dev-util/Tensile/metadata.xml
@@ -8,4 +8,7 @@
   <upstream>
     <remote-id type="github">ROCmSoftwarePlatform/Tensile</remote-id>
   </upstream>
+  <use>
+    <flag name="client">Build and install tensile_client executable to run benchmarks and tune GPU GEMM</flag>
+  </use>
 </pkgmetadata>


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

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/files/, dev-util/Tensile/
@ 2024-03-08 19:22 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2024-03-08 19:22 UTC (permalink / raw
  To: gentoo-commits

commit:     67229b0667ae0b9a3553b47cea1d8c9fd7056fa2
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Wed Mar  6 17:45:11 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar  8 19:21:59 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=67229b06

dev-util/Tensile: fix compilation of rocBLAS by propagating MSGPACK_NO_BOOST definition

Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...ile-5.7.1-r1.ebuild => Tensile-5.7.1-r2.ebuild} |  3 ++-
 .../Tensile-5.7.1-fix-msgpack-dependency.patch     | 29 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/dev-util/Tensile/Tensile-5.7.1-r1.ebuild b/dev-util/Tensile/Tensile-5.7.1-r2.ebuild
similarity index 97%
rename from dev-util/Tensile/Tensile-5.7.1-r1.ebuild
rename to dev-util/Tensile/Tensile-5.7.1-r2.ebuild
index 7534e358736f..94b4aac75b1b 100644
--- a/dev-util/Tensile/Tensile-5.7.1-r1.ebuild
+++ b/dev-util/Tensile/Tensile-5.7.1-r2.ebuild
@@ -24,6 +24,7 @@ REQUIRED_USE="client? ( ${ROCM_REQUIRED_USE} )"
 RESTRICT="!test? ( test )"
 
 RDEPEND="${PYTHON_DEPS}
+	client? ( dev-libs/boost )
 	>=dev-cpp/msgpack-cxx-6.0.0
 	dev-python/pyyaml[${PYTHON_USEDEP}]
 	dev-python/msgpack[${PYTHON_USEDEP}]
@@ -43,11 +44,11 @@ BDEPEND="
 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
+	"${FILESDIR}"/${PN}-5.7.1-fix-msgpack-dependency.patch
 )
 
 CMAKE_USE_DIR="${S}/${PN}/Source"

diff --git a/dev-util/Tensile/files/Tensile-5.7.1-fix-msgpack-dependency.patch b/dev-util/Tensile/files/Tensile-5.7.1-fix-msgpack-dependency.patch
new file mode 100644
index 000000000000..f6f3f0e24c1a
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-5.7.1-fix-msgpack-dependency.patch
@@ -0,0 +1,29 @@
+Gentoo uses "msgpack-cxx" as library name and adds important
+MSGPACK_NO_BOOST compile definition when msgpack-cxx us installed with USE=-boost
+--- a/Tensile/Source/lib/CMakeLists.txt
++++ b/Tensile/Source/lib/CMakeLists.txt
+@@ -98,22 +98,9 @@ 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)
+-        get_target_property(msgpack_inc msgpackc-cxx INTERFACE_INCLUDE_DIRECTORIES)
+-    elseif(TARGET msgpackc)
+-        get_target_property(msgpack_inc msgpackc INTERFACE_INCLUDE_DIRECTORIES)
+-    endif()
+-
+-    if(DEFINED msgpack_inc)
+-        # include C++ headers manually
+-        # External header includes included as system files
+-        target_include_directories(TensileHost 
+-            SYSTEM PRIVATE $<BUILD_INTERFACE:${msgpack_inc}>
+-        )
+-    endif()
++    target_link_libraries(TensileHost PRIVATE msgpack-cxx)
+ endif()
+ 
+ if(TENSILE_USE_LLVM)


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

* [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/files/, dev-util/Tensile/
@ 2024-11-09 21:08 Patrick Lauer
  0 siblings, 0 replies; 10+ messages in thread
From: Patrick Lauer @ 2024-11-09 21:08 UTC (permalink / raw
  To: gentoo-commits

commit:     7fb8049f065a12165c5664e74b7cb422f1346949
Author:     Patrick Lauer <patrick <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  9 21:04:45 2024 +0000
Commit:     Patrick Lauer <patrick <AT> gentoo <DOT> org>
CommitDate: Sat Nov  9 21:08:24 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7fb8049f

dev-util/Tensile: Fix runtime behaviour

Similar to https://github.com/ROCm/Tensile/pull/1898

Fixes rocBLAS failing, no idea why above code was
merged but fell out during refactoring and why is
everything so horrible

Signed-off-by: Patrick Lauer <patrick <AT> gentoo.org>

 dev-util/Tensile/Tensile-6.1.1-r1.ebuild           | 140 +++++++++++++++++++++
 .../files/Tensile-6.1.1-ignore-asm-cap.patch       |  11 ++
 2 files changed, 151 insertions(+)

diff --git a/dev-util/Tensile/Tensile-6.1.1-r1.ebuild b/dev-util/Tensile/Tensile-6.1.1-r1.ebuild
new file mode 100644
index 000000000000..f10408b60b93
--- /dev/null
+++ b/dev-util/Tensile/Tensile-6.1.1-r1.ebuild
@@ -0,0 +1,140 @@
+# Copyright 1999-2024 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}
+LLVM_COMPAT=( 18 )
+
+inherit cmake distutils-r1 llvm-r1 prefix rocm
+
+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"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+IUSE="client test"
+REQUIRED_USE="client? ( ${ROCM_REQUIRED_USE} )"
+
+RESTRICT="!test? ( test )"
+
+RDEPEND="${PYTHON_DEPS}
+	client? ( dev-libs/boost )
+	>=dev-cpp/msgpack-cxx-6.0.0
+	dev-python/pyyaml[${PYTHON_USEDEP}]
+	dev-python/msgpack[${PYTHON_USEDEP}]
+	dev-python/joblib[${PYTHON_USEDEP}]
+	=dev-util/hip-6*
+	>=dev-util/rocm-smi-4.3.0
+	$(llvm_gen_dep '
+		sys-devel/clang:${LLVM_SLOT}
+	')
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	test? (
+		dev-python/pytest-forked[${PYTHON_USEDEP}]
+		dev-python/pytest-xdist[${PYTHON_USEDEP}]
+		dev-python/filelock[${PYTHON_USEDEP}]
+		dev-python/joblib[${PYTHON_USEDEP}]
+	)
+"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+	"${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}-6.1.1-fix-msgpack-dependency.patch
+	"${FILESDIR}"/${PN}-6.0.2-expand-isa-compatibility.patch
+	"${FILESDIR}"/${PN}-6.1.1-ignore-asm-cap.patch
+)
+
+CMAKE_USE_DIR="${S}/${PN}/Source"
+
+src_prepare() {
+	distutils-r1_src_prepare
+	sed -e "s,\@LLVM_PATH\@,$(get_llvm_prefix),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() {
+	rocm_use_hipcc
+
+	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)"
+		)
+		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 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-6.1.1-ignore-asm-cap.patch b/dev-util/Tensile/files/Tensile-6.1.1-ignore-asm-cap.patch
new file mode 100644
index 000000000000..b0ad3b276fba
--- /dev/null
+++ b/dev-util/Tensile/files/Tensile-6.1.1-ignore-asm-cap.patch
@@ -0,0 +1,11 @@
+--- a/Tensile/Common.py	2024-11-09 20:38:11.186998794 -0000
++++ b/Tensile/Common.py	2024-11-09 20:43:18.524804845 -0000
+@@ -2030,7 +2030,7 @@
+     if len(compilerVer) >= 2:
+       ignoreCacheCheck = ignoreCacheCheck or \
+                          compilerVer[0] < 5 or \
+-                         (compilerVer[0] == 5 and compilerVer[1] <= 2) 
++                         (compilerVer[0] == 6 and compilerVer[1] <= 1)
+       
+     if not derivedAsmCaps["SupportedISA"] and CACHED_ASM_CAPS[isaVersion]["SupportedISA"]:
+       printWarning("Architecture {} not supported by ROCm {}".format(isaVersion, globalParameters['HipClangVersion']))


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

end of thread, other threads:[~2024-11-09 21:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-24 16:50 [gentoo-commits] repo/gentoo:master commit in: dev-util/Tensile/files/, dev-util/Tensile/ Marek Szuba
  -- strict thread matches above, loose matches on Subject: below --
2024-11-09 21:08 Patrick Lauer
2024-03-08 19:22 Sam James
2023-02-24 16:50 Marek Szuba
2023-02-01  9:53 Andreas Sturmlechner
2022-09-22  1:08 Benda XU
2022-07-08 17:29 Benda XU
2022-03-27  3:12 Benda XU
2022-03-27  3:12 Benda XU
2022-03-20  7:33 Benda XU

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