diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-08-06 20:10:31 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-08-06 20:10:31 +0100 |
commit | 944b3df0f275eea0fd7808913d72a0b280df0c33 (patch) | |
tree | ec33697fafd5ce7028b7619baef7a6d27bb74362 /dev-util/rocminfo/files | |
parent | 7e17b5aabc330abb894f2b90bef0e3fcbcd180d2 (diff) |
gentoo auto-resync : 06:08:2022 - 20:10:30
Diffstat (limited to 'dev-util/rocminfo/files')
-rw-r--r-- | dev-util/rocminfo/files/rocminfo-5.1.3-detect-builtin-amdgpu.patch | 50 |
1 files changed, 50 insertions, 0 deletions
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 <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 | 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") |