Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0329d96
fix(examine): report amdkfd_loaded when kfd is built into the kernel
tomastola Oct 15, 2026
4a1414d
test(examine): cover the amdkfd_loaded wiring and the kfd scenarios
tomastola Oct 15, 2026
8ecd070
refactor(examine): decide amdkfd_loaded at a single call site
tomastola Oct 15, 2026
ea4b420
docs(examine): say what amdkfd_loaded means now
tomastola Oct 16, 2026
7a366fa
fix(examine): report amdgpu_loaded when amdgpu is built into the kernel
tomastola Oct 16, 2026
a02b0af
refactor(examine): share one module-or-host check; kfd on the host im…
tomastola Oct 26, 2026
bf58a98
test(examine): renumber the built-in amdgpu scenario to examine-33
tomastola Oct 27, 2026
7071210
fix(examine): take a built-in amdgpu from the PCI driver, not /sys/mo…
tomastola Oct 27, 2026
d7652d0
test(examine): pin that kfd on the host alone implies amdgpu_loaded
tomastola Oct 27, 2026
22bc07f
docs(examine): say kfd is linked into amdgpu on current kernels only
tomastola Oct 27, 2026
c5ebdd8
test(examine): match each amdgpu-missing evidence line verbatim
tomastola Oct 27, 2026
4a758f7
test(examine): pin which host signal answers which driver field
tomastola Oct 27, 2026
be07af9
test(examine): cover kfd answering both drivers with no module list
tomastola Oct 27, 2026
b99e9ac
docs: list the driver-presence reads behind the simulated host root
tomastola Oct 27, 2026
66c3734
test(examine): share the fake-executable PATH fixture
tomastola Oct 27, 2026
a2ac4d1
test(examine): hand the wiring tests their module list
tomastola Oct 28, 2026
7e406af
test(examine): pin the module-list names in driver_states
tomastola Oct 30, 2026
6c8661c
test(examine): hold the host-root lock in the repo-scan tests
tomastola Oct 30, 2026
50224ab
ci: count the three probe_modules_reports tests in the host-root comment
tomastola Oct 30, 2026
e0115c8
Merge branch 'main' into fix-examine-kfd-builtin
tomastola Nov 3, 2026
5a14086
docs(examine): say amdgpu_loaded is the driver present, not a GPU bound
tomastola Nov 4, 2026
279738c
test(examine): plant examine-33's ROCm install with plant_unmanaged_rocm
tomastola Nov 4, 2026
f760905
Merge branch 'main' into fix-examine-kfd-builtin
tomastola Nov 6, 2026
9a03d73
Merge branch 'main' into fix-examine-kfd-builtin
tomastola Nov 6, 2026
2ba18c0
Merge branch 'main' into fix-examine-kfd-builtin
tomastola Nov 9, 2026
40e8d19
Merge branch 'main' into fix-examine-kfd-builtin
tomastola Nov 9, 2026
ffe1098
test(examine): hold the host-root lock in the last repo-scan test
tomastola Nov 9, 2026
8f678e2
test(examine): tie the amdgpu-missing evidence phrases to diagnose
tomastola Nov 10, 2026
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
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,11 @@ jobs:
# fields and the distro name, in
# `os_release_reads_follow_the_simulated_host_root` and, for the
# `/usr/lib/os-release` fallback, in
# `os_release_reads_fall_back_to_usr_lib_when_etc_is_absent`). The other routed
# `os_release_reads_fall_back_to_usr_lib_when_etc_is_absent`), and the
# driver-presence reads `/sys/class/kfd/kfd`, `/dev/kfd` and
# `/sys/bus/pci/drivers/amdgpu` (`kfd_present_on_host`,
# `amdgpu_present_on_host`, `driver_states` and the three
# `probe_modules_reports_*` tests). The other routed
# reads (`/dev/dri`, `/sys/class/drm`, `/sys/module/amdgpu`, the other
# `/proc` files, the modprobe directories, the `/usr/lib/wsl/lib` and
# ROCDXG checks) have no planted-root unit assertion; they are covered
Expand Down
2 changes: 1 addition & 1 deletion crates/rocm-core/src/diagnose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mod windows;
mod wsl;

pub use engine::{VLLM_IMPORT_CANONICAL_SYMPTOM, VLLM_OOM_CANONICAL_SYMPTOM};
pub use linux::dkms_driver_plan_is_supported;
pub use linux::{AMDGPU_MISSING_EVIDENCE, dkms_driver_plan_is_supported};
pub use report::{render_report_text, upstream_route};

/// At/above this score a diagnosis is treated as a real match.
Expand Down
67 changes: 64 additions & 3 deletions crates/rocm-core/src/diagnose/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ use super::scoring::{
use super::{Diagnosis, Fix};
use crate::examine::Examination;

/// The phrase `check_3_rocm_kernel_unsupported` puts in its evidence when
/// `amdgpu_loaded` is `Some(false)` and ROCm is installed.
const AMDGPU_KERNEL_MODULE_NOT_LOADED: &str = "the amdgpu kernel module is not loaded";
/// The evidence line `check_5_amdgpu_blacklisted` adds when `amdgpu_loaded` is
/// `Some(false)`.
const AMDGPU_MODULE_NOT_LOADED: &str = "amdgpu module is not loaded";
/// The start of the evidence line `check_5_amdgpu_blacklisted` adds when Secure
/// Boot is enabled and `amdgpu_loaded` is `Some(false)`.
const SECURE_BOOT_BLOCKED_AMDGPU: &str = "Secure Boot is enabled and amdgpu didn't load";

/// One phrase per evidence line that only `amdgpu_loaded == Some(false)` produces.
///
/// The checks build their lines from these same constants, so a test that asserts
/// a diagnosis cites none of them (the e2e scenario for a built-in `amdgpu`)
/// cannot drift from the wording and pass vacuously.
pub const AMDGPU_MISSING_EVIDENCE: [&str; 3] = [
AMDGPU_KERNEL_MODULE_NOT_LOADED,
AMDGPU_MODULE_NOT_LOADED,
SECURE_BOOT_BLOCKED_AMDGPU,
];

pub(super) fn check_3_rocm_kernel_unsupported(e: &Examination, symptom: &str) -> Diagnosis {
let mut score = 0;
let mut evidence = Vec::new();
Expand All @@ -24,7 +45,7 @@ pub(super) fn check_3_rocm_kernel_unsupported(e: &Examination, symptom: &str) ->
if !rocm_version.is_empty() && e.amdgpu_loaded == Some(false) {
score += 30;
evidence.push(format!(
"ROCm {rocm_version} is installed but the amdgpu kernel module is not loaded; this is typical when DKMS failed against an unsupported kernel."
"ROCm {rocm_version} is installed but {AMDGPU_KERNEL_MODULE_NOT_LOADED}; this is typical when DKMS failed against an unsupported kernel."
));
}

Expand Down Expand Up @@ -140,15 +161,15 @@ pub(super) fn check_5_amdgpu_blacklisted(e: &Examination, symptom: &str) -> Diag
}
if e.amdgpu_loaded == Some(false) {
score += 35;
evidence.push("amdgpu module is not loaded".to_owned());
evidence.push(AMDGPU_MODULE_NOT_LOADED.to_owned());
}
if e.rocminfo_status == "not-loaded" {
score += 25;
evidence.push("rocminfo says 'ROCk module is NOT loaded'".to_owned());
}
if e.secure_boot == "enabled" && e.amdgpu_loaded == Some(false) {
score += 10;
evidence.push("Secure Boot is enabled and amdgpu didn't load -- DKMS modules are often blocked until you sign them or disable Secure Boot.".to_owned());
evidence.push(format!("{SECURE_BOOT_BLOCKED_AMDGPU} -- DKMS modules are often blocked until you sign them or disable Secure Boot."));
}
let (kw_score, kw_ev) = keyword_score(symptom, KEYWORDS_MODULE_NOT_LOADED);
score += kw_score;
Expand Down Expand Up @@ -649,6 +670,46 @@ mod tests {
use crate::diagnose::{HIGH_CONFIDENCE, MIN_SCORE_FOR_MATCH, diagnose, render_report_text};
use crate::examine::{Device, Gpu};

#[test]
fn every_amdgpu_missing_phrase_is_in_the_evidence_the_checks_produce() {
let mut e = linux_base();
e.rocm_version = "7.1.0".to_owned();
e.amdgpu_loaded = Some(false);
e.secure_boot = "enabled".to_owned();
let lines: Vec<String> = [
check_3_rocm_kernel_unsupported(&e, ""),
check_5_amdgpu_blacklisted(&e, ""),
]
.into_iter()
.flat_map(|d| d.evidence)
.collect();
for phrase in AMDGPU_MISSING_EVIDENCE {
assert!(
lines.iter().any(|l| l.contains(phrase)),
"no evidence line contains {phrase:?}: {lines:#?}"
);
}
}

#[test]
fn built_in_amdgpu_produces_none_of_the_amdgpu_missing_phrases() {
let mut e = linux_base();
e.rocm_version = "7.1.0".to_owned();
e.amdgpu_loaded = Some(true);
e.secure_boot = "enabled".to_owned();
for d in [
check_3_rocm_kernel_unsupported(&e, ""),
check_5_amdgpu_blacklisted(&e, ""),
] {
for line in &d.evidence {
assert!(
!AMDGPU_MISSING_EVIDENCE.iter().any(|p| line.contains(p)),
"{line}"
);
}
}
}

#[test]
fn render_group_missing_is_diagnosed() {
let mut e = linux_base();
Expand Down
14 changes: 14 additions & 0 deletions crates/rocm-core/src/examine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,22 @@ pub struct Examination {
pub has_discrete_amd: bool,

// driver / runtime (Linux)
/// amdgpu is present: listed as a module, or registered as a PCI driver
/// (`/sys/bus/pci/drivers/amdgpu`), which it is whether amdgpu is loaded
/// as a module or built into the kernel (where it never appears in
/// `lsmod`), or kfd is present on the host (kfd is linked into amdgpu).
///
/// This is the driver being present, not a GPU being bound to it: a
/// built-in driver registers at boot with or without a matching GPU, as a
/// loaded module does when `modprobe`d on any machine. Whether there is an
/// AMD GPU is `has_amd_gpu`. `diagnose` reads only `Some(false)`, as a
/// module that failed to load (DKMS, a blacklist, Secure Boot), none of
/// which can stop a driver that is present.
pub amdgpu_loaded: Option<bool>,
pub amdgpu_blacklisted_in: Vec<String>,
/// kfd is available: as a separate `amdkfd` module on kernels before 4.20
/// (where kfd was merged into `amdgpu.ko`), or through `/sys/class/kfd/kfd`
/// or `/dev/kfd` on current ones. The name predates the merge.
pub amdkfd_loaded: Option<bool>,
pub secure_boot: String,
pub iommu_kernel_param: String,
Expand Down
Loading
Loading