From 43af034317bef4e3c8df748a4cd92cb50dbd4a1b Mon Sep 17 00:00:00 2001 From: Steffen Winter Date: Mon, 12 Feb 2024 13:21:55 +0100 Subject: [PATCH 1/3] fix: Can't detect librocm 6.0.x librocm reports it's version as 7.0.0.0 in the 6.0.x release series. --- src/linux/btop_collect.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp index 0dc59a81..73e8a89c 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -1344,7 +1344,8 @@ namespace Gpu { } else if (version.major == 5) { if ((rsmi_dev_gpu_clk_freq_get_v5 = (decltype(rsmi_dev_gpu_clk_freq_get_v5))load_rsmi_sym("rsmi_dev_gpu_clk_freq_get")) == nullptr) return false; - } else if (version.major == 6) { + // In the release tarballs of rocm 6.0.0 and 6.0.2 the version queried with rsmi_version_get is 7.0.0.0 + } else if (version.major == 6 || version.major == 7) { if ((rsmi_dev_gpu_clk_freq_get_v6 = (decltype(rsmi_dev_gpu_clk_freq_get_v6))load_rsmi_sym("rsmi_dev_gpu_clk_freq_get")) == nullptr) return false; } else { From c625d512e1c519e3b10e3355c89e213714821ae2 Mon Sep 17 00:00:00 2001 From: aristocratos Date: Mon, 12 Feb 2024 15:31:43 +0100 Subject: [PATCH 2/3] Add check for possible librocm_smi64.so.6 and check for version 7 in the function logic --- src/linux/btop_collect.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp index 73e8a89c..d273cc7f 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -724,12 +724,12 @@ namespace Cpu { if (fs::exists(bat_dir / "power_now")) { new_bat.power_now = bat_dir / "power_now"; } - else if ((fs::exists(bat_dir / "current_now")) and (fs::exists(bat_dir / "current_now"))) { + else if ((fs::exists(bat_dir / "current_now")) and (fs::exists(bat_dir / "current_now"))) { new_bat.current_now = bat_dir / "current_now"; new_bat.voltage_now = bat_dir / "voltage_now"; - } - else { - new_bat.use_power = false; + } + else { + new_bat.use_power = false; } if (fs::exists(bat_dir / "AC0/online")) new_bat.online = bat_dir / "AC0/online"; @@ -1285,6 +1285,7 @@ namespace Gpu { "librocm_smi64.so", "librocm_smi64.so.5", // fedora "librocm_smi64.so.1.0", // debian + "librocm_smi64.so.6" }; for (const auto& l : libRocAlts) { @@ -1449,7 +1450,7 @@ namespace Gpu { if constexpr(is_init) gpus_slice[i].supported_functions.gpu_clock = false; } else gpus_slice[i].gpu_clock_speed = (long long)frequencies.frequency[frequencies.current]/1000000; // Hz to MHz } - else if (version_major == 6) { + else if (version.major == 6 || version.major == 7) { rsmi_frequencies_t_v6 frequencies; result = rsmi_dev_gpu_clk_freq_get_v6(i, RSMI_CLK_TYPE_SYS, &frequencies); if (result != RSMI_STATUS_SUCCESS) { @@ -1468,7 +1469,7 @@ namespace Gpu { if constexpr(is_init) gpus_slice[i].supported_functions.mem_clock = false; } else gpus_slice[i].mem_clock_speed = (long long)frequencies.frequency[frequencies.current]/1000000; // Hz to MHz } - else if (version_major == 6) { + else if (version.major == 6 || version.major == 7) { rsmi_frequencies_t_v6 frequencies; result = rsmi_dev_gpu_clk_freq_get_v6(i, RSMI_CLK_TYPE_MEM, &frequencies); if (result != RSMI_STATUS_SUCCESS) { From bae006e94c513911b274b6de221914bb066f2028 Mon Sep 17 00:00:00 2001 From: aristocratos Date: Mon, 12 Feb 2024 15:37:31 +0100 Subject: [PATCH 3/3] Fixed variable names --- src/linux/btop_collect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp index d273cc7f..d500192d 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -1450,7 +1450,7 @@ namespace Gpu { if constexpr(is_init) gpus_slice[i].supported_functions.gpu_clock = false; } else gpus_slice[i].gpu_clock_speed = (long long)frequencies.frequency[frequencies.current]/1000000; // Hz to MHz } - else if (version.major == 6 || version.major == 7) { + else if (version_major == 6 || version_major == 7) { rsmi_frequencies_t_v6 frequencies; result = rsmi_dev_gpu_clk_freq_get_v6(i, RSMI_CLK_TYPE_SYS, &frequencies); if (result != RSMI_STATUS_SUCCESS) { @@ -1469,7 +1469,7 @@ namespace Gpu { if constexpr(is_init) gpus_slice[i].supported_functions.mem_clock = false; } else gpus_slice[i].mem_clock_speed = (long long)frequencies.frequency[frequencies.current]/1000000; // Hz to MHz } - else if (version.major == 6 || version.major == 7) { + else if (version_major == 6 || version_major == 7) { rsmi_frequencies_t_v6 frequencies; result = rsmi_dev_gpu_clk_freq_get_v6(i, RSMI_CLK_TYPE_MEM, &frequencies); if (result != RSMI_STATUS_SUCCESS) {