Skip to content
Merged
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,20 @@ you what it couldn't find instead.
#### Driver installation

`install driver` installs the AMD kernel driver on Linux, using DKMS or a native
package.
package. On bare metal it defaults to the floating `latest` amdgpu release;
set `ROCM_CLI_AMDGPU_DRIVER_VERSION` to pin a specific one. This replaces the
older `ROCM_CLI_AMDGPU_VERSION`/`ROCM_CLI_AMDGPU_PACKAGE_RELEASE` pair, which
pinned a fixed default and are no longer read; the plan is refused while either is still set,
so an old pin is never silently turned into `latest`.

On Ubuntu 26.04, the amdgpu driver ships in-tree and `repo.radeon.com` does not
yet publish a matching DKMS repo, so `install driver` reports a non-mutating
`supported: false` plan instead and directs you to `apt install rocm` for the
userspace ROCm stack.

Approving (`--yes`) a plan that is `supported: false` (Ubuntu 26.04, an
undocumented distro, or a refused version override) installs nothing and exits
non-zero, after printing the plan.

On Windows, `install driver` is validate-only: it installs and changes nothing,
with or without `--yes`, and it starts no driver command. It prints the AMD
Expand Down
1,354 changes: 1,085 additions & 269 deletions apps/rocm/src/driver_install.rs

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions apps/rocm/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10879,12 +10879,13 @@ pub(crate) mod tests {
}
}

/// Clear the two AMD driver-install override vars for the duration of the
/// test, so a value exported in the developer's or runner's shell cannot
/// leak into a plan and make its resolved `repo_version`/package release
/// disagree with the assertion.
/// Clear the AMD driver-version override for the duration of the test, so
/// a value exported in the developer's or runner's shell cannot leak into
/// a plan and make its resolved `repo_version_expr` disagree with the
/// assertion.
pub(crate) fn with_amd_overrides_cleared() -> Self {
let mut env = Self::new();
env.clear("ROCM_CLI_AMDGPU_DRIVER_VERSION");
env.clear("ROCM_CLI_AMDGPU_VERSION");
env.clear("ROCM_CLI_AMDGPU_PACKAGE_RELEASE");
env
Expand Down
22 changes: 22 additions & 0 deletions apps/rocm/src/remote/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,28 @@ mod tests {
assert!(!examination.os_family.is_empty());
}

#[test]
fn distro_id_like_survives_the_remote_round_trip() {
// A remote examination is only ever seen through JSON, so if this
// field didn't round-trip, the ID_LIKE fallback would silently never
// fire for `rocm remote doctor`.
let mut value: serde_json::Value = serde_json::from_str(&examine_json()).unwrap();
value.as_object_mut().unwrap().insert(
"distro_id_like".to_owned(),
serde_json::json!("rhel fedora"),
);
let parsed = parse_examination(&value.to_string()).expect("examined");
assert_eq!(parsed.distro_id_like, "rhel fedora");
}

#[test]
fn a_remote_on_an_older_cli_without_distro_id_like_still_parses() {
let mut value: serde_json::Value = serde_json::from_str(&examine_json()).unwrap();
value.as_object_mut().unwrap().remove("distro_id_like");
let parsed = parse_examination(&value.to_string()).expect("older remote must parse");
assert_eq!(parsed.distro_id_like, "");
}

#[test]
fn a_remote_on_another_version_says_so_instead_of_failing_obscurely() {
let error = parse_examination(r#"{"unexpected": true}"#)
Expand Down
5 changes: 2 additions & 3 deletions apps/rocm/src/runtime_install_finalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@ pub(crate) const fn empty_as_unknown(value: &str) -> &str {
/// when the former is absent (per `os-release(5)`).
///
/// Deliberately not routed through `rocm_core::host_path`: every caller builds
/// a package-manager plan (`apt`, `dnf`, `amdgpu-install`) that then runs
/// against the real machine, so a simulated host root must not choose its
/// distro. The descriptive distro name `examine` reports comes from
/// a package-manager plan (`apt`, `dnf`, `zypper`) that then runs against the
/// real machine, so a simulated host root must not choose its distro. The descriptive distro name `examine` reports comes from
/// `ExamineSummary::gather`'s `distro` field, which does follow a simulated
/// root.
pub(crate) fn real_os_release() -> rocm_core::hardware_root::OsRelease {
Expand Down
1,263 changes: 1,222 additions & 41 deletions crates/rocm-core/src/diagnose.rs

Large diffs are not rendered by default.

Loading
Loading