From 944b3df0f275eea0fd7808913d72a0b280df0c33 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 6 Aug 2022 20:10:31 +0100 Subject: gentoo auto-resync : 06:08:2022 - 20:10:30 --- .../rocminfo-5.1.3-detect-builtin-amdgpu.patch | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 dev-util/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch (limited to 'dev-util/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch') diff --git a/dev-util/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch b/dev-util/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch new file mode 100644 index 000000000000..5d0b2ed284bd --- /dev/null +++ b/dev-util/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch @@ -0,0 +1,50 @@ +/sys/module/amdgpu instead of lsmod for builtin amdgpu kernel module + +https://github.com/RadeonOpenCompute/rocminfo/pull/43 +https://github.com/RadeonOpenCompute/rocminfo/issues/42 +From ea4f017ed035928b1970e2589b02ec9b348c863e Mon Sep 17 00:00:00 2001 +From: YiyangWu +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 +--- + rocminfo.cc | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/rocminfo.cc b/rocminfo.cc +index 871f406..58c847d 100755 +--- a/rocminfo.cc ++++ b/rocminfo.cc +@@ -995,6 +995,8 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { + err = AcquireAgentInfo(agent, &agent_i); + RET_IF_HSA_ERR(err); + ++ std::string ind(kIndentSize, ' '); ++ + printLabel("*******", true); + std::string agent_ind("Agent "); + agent_ind += std::to_string(*agent_number).c_str(); +@@ -1031,16 +1033,16 @@ AcquireAndDisplayAgentInfo(hsa_agent_t agent, void* data) { + + int CheckInitialState(void) { + // Check kernel module for ROCk is loaded +- FILE *fd = popen("lsmod | grep amdgpu", "r"); +- char buf[16]; +- if (fread (buf, 1, sizeof (buf), fd) == 0) { ++ 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; + } else { + printf("%sROCk module is loaded%s\n", COL_WHT, COL_RESET); ++ close(module_dir); + } +- pclose(fd); + + // Check if user belongs to the group for /dev/kfd (e.g. "video" or + // "render") -- cgit v1.2.3