summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYiyang Wu <xgreenlandforwyy@gmail.com>2024-01-01 23:49:14 +0800
committerSam James <sam@gentoo.org>2024-06-26 10:18:52 +0100
commit97d1ea9a0785fefc9cb7d36379ca38e4e583a803 (patch)
tree987fe295be7e321bb23e0ffccff823579403f375 /dev-util/rocminfo
parentdev-libs/rocm-device-libs: add llvm-18 compatibility patch (diff)
downloadgentoo-97d1ea9a0785fefc9cb7d36379ca38e4e583a803.tar.gz
gentoo-97d1ea9a0785fefc9cb7d36379ca38e4e583a803.tar.bz2
gentoo-97d1ea9a0785fefc9cb7d36379ca38e4e583a803.zip
dev-util/rocminfo: patches for builtin amdgpu & python 3.12
Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-util/rocminfo')
-rw-r--r--dev-util/rocminfo/files/rocminfo-6.0.0-detect-builtin-amdgpu.patch33
-rw-r--r--dev-util/rocminfo/files/rocminfo-6.0.0_python-3.12.patch75
-rw-r--r--dev-util/rocminfo/rocminfo-5.7.1-r1.ebuild (renamed from dev-util/rocminfo/rocminfo-5.7.1.ebuild)7
-rw-r--r--dev-util/rocminfo/rocminfo-6.0.0-r1.ebuild (renamed from dev-util/rocminfo/rocminfo-6.0.0.ebuild)7
4 files changed, 116 insertions, 6 deletions
diff --git a/dev-util/rocminfo/files/rocminfo-6.0.0-detect-builtin-amdgpu.patch b/dev-util/rocminfo/files/rocminfo-6.0.0-detect-builtin-amdgpu.patch
new file mode 100644
index 000000000000..8956a790fbe1
--- /dev/null
+++ b/dev-util/rocminfo/files/rocminfo-6.0.0-detect-builtin-amdgpu.patch
@@ -0,0 +1,33 @@
+https://github.com/ROCm/rocminfo/pull/65
+From: YiyangWu <xgreenlandforwyy@gmail.com>
+Date: Wed, 18 Aug 2021 21:05:20 +0800
+Subject: [PATCH] Check /sys/module/amdgpu for ROCk instead of lsmod
+
+Closes: #42
+
+Signed-off-by: YiyangWu <xgreenlandforwyy@gmail.com>
+---
+ rocminfo.cc | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/rocminfo.cc b/rocminfo.cc
+index 8ed9111..78b3afd 100755
+--- a/rocminfo.cc
++++ b/rocminfo.cc
+@@ -1063,9 +1063,14 @@ int CheckInitialState(void) {
+ return -1;
+ }
+ } else {
+- printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n",
++ int module_dir;
++ module_dir = open("/sys/module/amdgpu", O_DIRECTORY);
++ if (module_dir < 0) {
++ printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n",
+ COL_RED, COL_RESET);
+- return -1;
++ return -1;
++ }
++ close(module_dir);
+ }
+
+ // Check if user belongs to the group for /dev/kfd (e.g. "video" or
diff --git a/dev-util/rocminfo/files/rocminfo-6.0.0_python-3.12.patch b/dev-util/rocminfo/files/rocminfo-6.0.0_python-3.12.patch
new file mode 100644
index 000000000000..9c4530b98b05
--- /dev/null
+++ b/dev-util/rocminfo/files/rocminfo-6.0.0_python-3.12.patch
@@ -0,0 +1,75 @@
+https://github.com/ROCm/rocminfo/pull/66
+From: Yiyang Wu <xgreenlandforwyy@gmail.com>
+Date: Mon, 1 Jan 2024 22:34:23 +0800
+Subject: [PATCH] Fix python3.12 SyntaxWarning: invalid escape sequence
+
+Use raw strings for regular expression
+
+Reference: https://docs.python.org/dev/whatsnew/3.12.html#other-language-changes
+---
+ rocm_agent_enumerator | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+Index: rocminfo-rocm-6.0.0/rocm_agent_enumerator
+===================================================================
+--- rocminfo-rocm-6.0.0.orig/rocm_agent_enumerator
++++ rocminfo-rocm-6.0.0/rocm_agent_enumerator
+@@ -81,7 +81,7 @@ def staticVars(**kwargs):
+ return func
+ return deco
+
+-@staticVars(search_term=re.compile("gfx[0-9a-fA-F]+"))
++@staticVars(search_term=re.compile(r"gfx[0-9a-fA-F]+"))
+ def getGCNISA(line, match_from_beginning = False):
+ if match_from_beginning is True:
+ result = getGCNISA.search_term.match(line)
+@@ -92,7 +92,7 @@ def getGCNISA(line, match_from_beginning
+ return result.group(0)
+ return None
+
+-@staticVars(search_name=re.compile("gfx[0-9a-fA-F]+(:[-+:\w]+)?"))
++@staticVars(search_name=re.compile(r"gfx[0-9a-fA-F]+(:[-+:\w]+)?"))
+ def getGCNArchName(line):
+ result = getGCNArchName.search_name.search(line)
+
+@@ -135,8 +135,8 @@ def readFromROCMINFO(search_arch_name =
+ break
+ # run rocminfo
+ rocminfo_output = subprocess.Popen(rocminfo_executable, stdout=subprocess.PIPE).communicate()[0].decode("utf-8").split('\n')
+- term1 = re.compile("Cannot allocate memory")
+- term2 = re.compile("HSA_STATUS_ERROR_OUT_OF_RESOURCES")
++ term1 = re.compile(r"Cannot allocate memory")
++ term2 = re.compile(r"HSA_STATUS_ERROR_OUT_OF_RESOURCES")
+ done = 1
+ for line in rocminfo_output:
+ if term1.search(line) is not None or term2.search(line) is not None:
+@@ -149,9 +149,9 @@ def readFromROCMINFO(search_arch_name =
+
+ # search AMDGCN gfx ISA
+ if search_arch_name is True:
+- line_search_term = re.compile("\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)")
++ line_search_term = re.compile(r"\A\s+Name:\s+(amdgcn-amd-amdhsa--gfx\d+)")
+ else:
+- line_search_term = re.compile("\A\s+Name:\s+(gfx\d+)")
++ line_search_term = re.compile(r"\A\s+Name:\s+(gfx\d+)")
+ for line in rocminfo_output:
+ if line_search_term.match(line) is not None:
+ if search_arch_name is True:
+@@ -172,7 +172,7 @@ def readFromLSPCI():
+ except:
+ lspci_output = []
+
+- target_search_term = re.compile("1002:\w+")
++ target_search_term = re.compile(r"1002:\w+")
+ for line in lspci_output:
+ search_result = target_search_term.search(line)
+ if search_result is not None:
+@@ -196,7 +196,7 @@ def readFromKFD():
+ if os.path.isdir(node_path):
+ prop_path = node_path + '/properties'
+ if os.path.isfile(prop_path) and os.access(prop_path, os.R_OK):
+- target_search_term = re.compile("gfx_target_version.+")
++ target_search_term = re.compile(r"gfx_target_version.+")
+ with open(prop_path) as f:
+ try:
+ line = f.readline()
diff --git a/dev-util/rocminfo/rocminfo-5.7.1.ebuild b/dev-util/rocminfo/rocminfo-5.7.1-r1.ebuild
index 296b859a1fd3..188bd037f938 100644
--- a/dev-util/rocminfo/rocminfo-5.7.1.ebuild
+++ b/dev-util/rocminfo/rocminfo-5.7.1-r1.ebuild
@@ -22,9 +22,10 @@ SLOT="0/$(ver_cut 1-2)"
RDEPEND=">=dev-libs/rocr-runtime-${PV}"
DEPEND="${RDEPEND}"
-#PATCHES=(
-# "${FILESDIR}/${PN}-5.5.1-detect-builtin-amdgpu.patch"
-#)
+PATCHES=(
+ "${FILESDIR}/${PN}-6.0.0-detect-builtin-amdgpu.patch"
+ "${FILESDIR}/${PN}-6.0.0_python-3.12.patch"
+)
src_prepare() {
sed -e "/CPACK_RESOURCE_FILE_LICENSE/d" -i CMakeLists.txt || die
diff --git a/dev-util/rocminfo/rocminfo-6.0.0.ebuild b/dev-util/rocminfo/rocminfo-6.0.0-r1.ebuild
index 296b859a1fd3..188bd037f938 100644
--- a/dev-util/rocminfo/rocminfo-6.0.0.ebuild
+++ b/dev-util/rocminfo/rocminfo-6.0.0-r1.ebuild
@@ -22,9 +22,10 @@ SLOT="0/$(ver_cut 1-2)"
RDEPEND=">=dev-libs/rocr-runtime-${PV}"
DEPEND="${RDEPEND}"
-#PATCHES=(
-# "${FILESDIR}/${PN}-5.5.1-detect-builtin-amdgpu.patch"
-#)
+PATCHES=(
+ "${FILESDIR}/${PN}-6.0.0-detect-builtin-amdgpu.patch"
+ "${FILESDIR}/${PN}-6.0.0_python-3.12.patch"
+)
src_prepare() {
sed -e "/CPACK_RESOURCE_FILE_LICENSE/d" -i CMakeLists.txt || die