Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Intel support #439

Merged
merged 29 commits into from
Jan 12, 2025
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
22bf725
WIP: add initial intel xe/i915 support
ilya-zlobintsev Dec 20, 2024
29f04bd
feat: basic gpu clock configuration
ilya-zlobintsev Dec 20, 2024
b832087
wip i915 freq controls
ilya-zlobintsev Dec 29, 2024
6d89c13
fix: applying frequency settings on i915
ilya-zlobintsev Dec 29, 2024
1795ec9
feat: intel DRM info
ilya-zlobintsev Dec 31, 2024
2def70c
feat: show EUs and subslices in UI
ilya-zlobintsev Dec 31, 2024
0f42435
Merge branch 'master' into feature/intel
ilya-zlobintsev Jan 1, 2025
bce6eb2
refactor: exclude all system-dependent info in tests with conditional…
ilya-zlobintsev Jan 1, 2025
3f24795
chore: ignore clippy errors on bindgen file
ilya-zlobintsev Jan 1, 2025
bf73acb
fix: more test fixes
ilya-zlobintsev Jan 1, 2025
02e4e40
feat: generate drm bindings for xe
ilya-zlobintsev Jan 1, 2025
9c100b0
wip
ilya-zlobintsev Jan 4, 2025
dfcfa8e
refactor: GPU controller initialization
ilya-zlobintsev Jan 4, 2025
e63e168
Merge branch 'master' into feature/intel
ilya-zlobintsev Jan 4, 2025
086ddae
fixes
ilya-zlobintsev Jan 4, 2025
8608f62
chore: disable currently unused xe headers
ilya-zlobintsev Jan 4, 2025
4e66975
feat: dynamically load libdrm for intel
ilya-zlobintsev Jan 4, 2025
5d16d67
chore: drop println
ilya-zlobintsev Jan 4, 2025
8994dff
Merge with master
ilya-zlobintsev Jan 5, 2025
141329c
Merge branch 'master' into feature/intel
ilya-zlobintsev Jan 5, 2025
14429fd
fix: tests
ilya-zlobintsev Jan 5, 2025
543265d
chore: avoid error in vulkan when running tests
ilya-zlobintsev Jan 5, 2025
c5d2996
feat: numerous i915 additions
ilya-zlobintsev Jan 11, 2025
9af6887
feat: show fan speed
ilya-zlobintsev Jan 11, 2025
204dcb4
feat: hwmon monitoring on xe
ilya-zlobintsev Jan 11, 2025
4a35ffb
fix: avoid crashing history graph on empty plot with throttling data
ilya-zlobintsev Jan 12, 2025
cb62412
feat: report pstates
ilya-zlobintsev Jan 12, 2025
a6889af
doc: update readme
ilya-zlobintsev Jan 12, 2025
eed67fa
chore: update API docs link
ilya-zlobintsev Jan 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: applying frequency settings on i915
ilya-zlobintsev committed Dec 29, 2024
commit 6d89c13927a645c106a894e1acc8463f2ad680a2
43 changes: 35 additions & 8 deletions lact-daemon/src/server/gpu_controller/intel.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ use std::{
path::{Path, PathBuf},
str::FromStr,
};
use tracing::{debug, error, info, warn};
use tracing::{debug, error, info, trace, warn};

enum DriverType {
Xe,
@@ -171,13 +171,25 @@ impl GpuController for IntelGpuController {
}

fn get_stats(&self, _gpu_config: Option<&config::Gpu>) -> DeviceStats {
let current_gfxclk = self.read_gt_file("freq0/cur_freq");
let current_gfxclk;
let gpu_clockspeed;

match self.driver_type {
DriverType::Xe => {
current_gfxclk = self.read_gt_file("freq0/cur_freq");
gpu_clockspeed = self
.read_gt_file("freq0/act_freq")
.filter(|freq| *freq != 0)
.or_else(|| current_gfxclk.map(u64::from));
}
DriverType::I915 => {
current_gfxclk = self.read_file("../gt_cur_freq_mhz");
gpu_clockspeed = self.read_file("../gt_act_freq_mhz");
}
}

let clockspeed = ClockspeedStats {
gpu_clockspeed: self
.read_gt_file("freq0/act_freq")
.filter(|freq| *freq != 0)
.or_else(|| current_gfxclk.map(u64::from)),
gpu_clockspeed,
current_gfxclk,
vram_clockspeed: None,
};
@@ -244,12 +256,27 @@ impl IntelGpuController {
self.tile_gts.first().map(PathBuf::as_ref)
}

fn sysfs_file_path(&self, path: impl AsRef<Path>) -> PathBuf {
let path = path.as_ref();

match path.strip_prefix("../") {
Ok(path_relative_to_parent) => self
.get_path()
.parent()
.expect("Device path has no parent")
.join(path_relative_to_parent),
Err(_) => self.get_path().join(path),
}
}

fn read_file<T>(&self, path: impl AsRef<Path>) -> Option<T>
where
T: FromStr,
T::Err: Display,
{
let file_path = self.get_path().join(path);
let file_path = self.sysfs_file_path(path);

trace!("Reading file from '{}'", file_path.display());

if file_path.exists() {
match fs::read_to_string(&file_path) {
@@ -271,7 +298,7 @@ impl IntelGpuController {
}

fn write_file(&self, path: impl AsRef<Path>, contents: &str) -> anyhow::Result<()> {
let file_path = self.get_path().join(path);
let file_path = self.sysfs_file_path(path);

if file_path.exists() {
fs::write(&file_path, contents)