From 498dc0ab05ee2880021b750a70276d7436188be7 Mon Sep 17 00:00:00 2001 From: Ilya Zlobintsev Date: Sun, 26 Feb 2023 23:50:27 +0200 Subject: [PATCH] feat: bump amdgpu-sysfs for clear functionality --- Cargo.lock | 4 ++-- lact-daemon/Cargo.toml | 2 +- lact-daemon/src/server/gpu_controller/mod.rs | 11 +++++++++-- lact-schema/Cargo.toml | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4da6c2..e9af7b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,9 +25,9 @@ dependencies = [ [[package]] name = "amdgpu-sysfs" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae160ad9551e11cf5aa19fc78b590ee5f8ccfe07f983a99bead7a6680907da30" +checksum = "ba5905dc18461f166bcc7422c103ac633d5892fa0f8e1133fc59dd347d0fe7a1" dependencies = [ "enum_dispatch", "serde", diff --git a/lact-daemon/Cargo.toml b/lact-daemon/Cargo.toml index 2f31d67..b975780 100644 --- a/lact-daemon/Cargo.toml +++ b/lact-daemon/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -amdgpu-sysfs = { version = "0.9.5", features = ["serde"] } +amdgpu-sysfs = { version = "0.9.6", features = ["serde"] } anyhow = "1.0" bincode = "1.3" nix = "0.26" diff --git a/lact-daemon/src/server/gpu_controller/mod.rs b/lact-daemon/src/server/gpu_controller/mod.rs index 1844e34..680f029 100644 --- a/lact-daemon/src/server/gpu_controller/mod.rs +++ b/lact-daemon/src/server/gpu_controller/mod.rs @@ -11,8 +11,8 @@ use amdgpu_sysfs::{ }; use anyhow::{anyhow, Context}; use lact_schema::{ - ClocksInfo, ClocksTable, ClockspeedStats, DeviceInfo, DeviceStats, FanStats, GpuPciInfo, - LinkInfo, PciInfo, PerformanceLevel, PowerStats, VoltageStats, VramStats, + ClocksInfo, ClocksTable, ClocksTableGen, ClockspeedStats, DeviceInfo, DeviceStats, FanStats, + GpuPciInfo, LinkInfo, PciInfo, PerformanceLevel, PowerStats, VoltageStats, VramStats, }; use pciid_parser::Database; use std::{ @@ -347,6 +347,13 @@ impl GpuController { { let mut table = self.handle.get_clocks_table()?; + if let ClocksTableGen::Vega20(ref mut table) = table { + // Avoid writing settings to the clocks table except the user-specified ones + // There is an issue on some GPU models where the default values are actually outside of the allowed range + // See https://github.com/sibradzic/amdgpu-clocks/issues/32#issuecomment-829953519 (part 2) for an example + table.clear(); + } + if let Some(clockspeed) = config.max_core_clock { table.set_max_sclk(clockspeed)?; } diff --git a/lact-schema/Cargo.toml b/lact-schema/Cargo.toml index 50ec65f..c1c4b8d 100644 --- a/lact-schema/Cargo.toml +++ b/lact-schema/Cargo.toml @@ -4,7 +4,7 @@ version = "0.2.2" edition = "2021" [dependencies] -amdgpu-sysfs = { version = "0.9.5", features = ["serde"] } +amdgpu-sysfs = { version = "0.9.6", features = ["serde"] } serde = { version = "1.0", features = ["derive"] } indexmap = { version = "*", features = ["serde"] }