diff options
Diffstat (limited to 'dev-util/rocminfo/files')
-rw-r--r-- | dev-util/rocminfo/files/rocminfo-4.3.0-detect-builtin-amdgpu.patch | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/dev-util/rocminfo/files/rocminfo-4.3.0-detect-builtin-amdgpu.patch b/dev-util/rocminfo/files/rocminfo-4.3.0-detect-builtin-amdgpu.patch new file mode 100644 index 000000000000..a01eb3ec3909 --- /dev/null +++ b/dev-util/rocminfo/files/rocminfo-4.3.0-detect-builtin-amdgpu.patch @@ -0,0 +1,25 @@ +/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 +--- a/rocminfo.cc ++++ b/rocminfo.cc +@@ -1035,14 +1035,15 @@ 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); + } + + // Check if user belongs to the group for /dev/kfd (e.g. "video" or |