mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-16 14:29:05 -07:00
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>
This commit is contained in:
@@ -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
|
||||
75
dev-util/rocminfo/files/rocminfo-6.0.0_python-3.12.patch
Normal file
75
dev-util/rocminfo/files/rocminfo-6.0.0_python-3.12.patch
Normal file
@@ -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()
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user