Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
76faf1b
test(rocm-core): pin both PATH lookups' answers before they are merged
jussielo-amd Nov 6, 2026
d0535d4
refactor(rocm-core): one PATH lookup for the summary and the examinat…
jussielo-amd Nov 6, 2026
4e1b384
test(e2e): hold the host summary and the examination level on whether…
jussielo-amd Nov 6, 2026
502ef7f
docs: record the PATH lookup decision in the host-probing note
jussielo-amd Nov 6, 2026
b6a3346
test(e2e): add the control that shows examine-36 really runs from its…
jussielo-amd Nov 6, 2026
03bee1c
docs(rocm-core): re-wrap the probe list in the host_gpu module doc
jussielo-amd Nov 6, 2026
849a45a
Merge remote-tracking branch 'origin/main' into rf-905a
jussielo-amd Nov 6, 2026
84b6332
test(e2e): resolve the runner's relative PATH entries from the harnes…
jussielo-amd Nov 6, 2026
1cba168
Merge remote-tracking branch 'origin/main' into rf-905a
jussielo-amd Nov 9, 2026
5c2df85
test(e2e): leave a bare rocm name for PATH to resolve when a scenario…
jussielo-amd Nov 9, 2026
0c85d5f
test(e2e): drop a runner PATH entry only when it holds a rocminfo fil…
jussielo-amd Nov 9, 2026
5e5946d
fix(rocm-core): test an absolute PATH candidate once, so the lookup a…
jussielo-amd Nov 9, 2026
2a7a2e3
docs: say which PATHEXT spellings the framework probe cannot run and …
jussielo-amd Nov 9, 2026
2208f53
docs: fix a cited test name in the host-probing note and record how d…
jussielo-amd Nov 9, 2026
c50c6ba
test(rocm-core): make the System32 candidate test non-vacuous, check …
jussielo-amd Nov 9, 2026
f4659ff
test(rocm-core): drop the test that read the host-probing note from i…
jussielo-amd Nov 9, 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
7 changes: 7 additions & 0 deletions crates/rocm-core/src/examine/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ fn runtime_library_path_env(
}

fn probe_pytorch_on_path(e: &mut Examination) {
// On Windows `which` also accepts any `PATHEXT` spelling (`python.PY`, `.PS1`),
// while the probe starts the bare name through `Command`, which only starts an
// `.exe`: the same caveat as in `probe_llama_cpp`.
let py = if which("python") {
"python"
} else if which("python3") {
Expand Down Expand Up @@ -222,6 +225,10 @@ fn record_pytorch_probe(e: &mut Examination, rc: i32, out: &str, err: &str) {
}

fn probe_llama_cpp(e: &mut Examination) {
// `which` follows `PATHEXT` on Windows, so a name can read as found through an
// extension this probe cannot run (`llama-cli.PS1`): the probe starts the bare
// name through `Command`, which only starts an `.exe`. The report can then
// name a binary it cannot start; the later run fails and says so.
let binary = ["llama-cli", "llama-server", "main"]
.into_iter()
.find(|name| which(name));
Expand Down
14 changes: 7 additions & 7 deletions crates/rocm-core/src/host_gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
//! [`crate::confirm`] and is re-exported here too, so the
//! `crate::host_gpu::interactive_terminal` path keeps resolving.
//!
//! The probes live in child modules: `capture` (optional-command capture and the
//! tool-on-`PATH` lookup), `os_facts` (kernel, distro, CPU and RAM), `linux`
//! (sysfs, KFD and DRM), `gpu_visibility` (which GPUs this process may use),
//! `windows_inventory` (the Windows display-adapter inventory), `wsl` (WSL
//! detection and the Windows host driver as seen from the guest), `render` (the
//! `rocm examine` text of an `ExamineSummary`), `diagnostics` (the GPU
//! detection diagnostics text) and `engine_default` (the default serve engine).
//! The probes live in child modules: `capture` (optional-command capture),
//! `os_facts` (kernel, distro, CPU and RAM), `linux` (sysfs, KFD and DRM),
//! `gpu_visibility` (which GPUs this process may use), `windows_inventory` (the
//! Windows display-adapter inventory), `wsl` (WSL detection and the Windows host
//! driver as seen from the guest), `render` (the `rocm examine` text of an
//! `ExamineSummary`), `diagnostics` (the GPU detection diagnostics text) and
//! `engine_default` (the default serve engine).
//!
//! The `examine` child modules and `fix.rs` still reach several items here
//! through `lib.rs`'s flat `crate::` re-export paths rather than
Expand Down
61 changes: 5 additions & 56 deletions crates/rocm-core/src/host_gpu/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
//! Optional-command capture for the host probes.
//!
//! Runs a tool that may not be installed under a short timeout and keeps its
//! stdout only on success, resolving the program the way the platform does
//! (`PATHEXT` and the fixed Windows system locations included). A missing,
//! slow or failing tool reads as `None`, never as an error.
//! stdout only on success, trying each spelling of the program that
//! [`crate::probe_exec::tool_path_candidates`] gives (`PATHEXT` and the fixed
//! Windows system locations included). A missing, slow or failing tool reads as
//! `None`, never as an error.

use crate::runtime_is_windows;
use crate::probe_exec::tool_path_candidates;
use std::io::Read;
use std::path::Path;
use std::process::{Command, Stdio};
Expand Down Expand Up @@ -111,55 +112,3 @@ fn debug_command_capture_failure(program: &Path, stage: &str, detail: &str) {
program.display()
);
}

pub(super) fn tool_on_path(program: &str) -> bool {
std::env::var_os("PATH").is_some_and(|path| {
std::env::split_paths(&path).any(|dir| {
tool_path_candidates(program)
.into_iter()
.any(|name| dir.join(name).is_file())
})
})
}

pub(super) fn tool_path_candidates(program: &str) -> Vec<String> {
let path = Path::new(program);
if path.extension().is_some() || !runtime_is_windows() {
return vec![program.to_owned()];
}
let mut names = Vec::new();
names.push(program.to_owned());
let pathext = std::env::var("PATHEXT").unwrap_or_else(|_| ".COM;.EXE;.BAT;.CMD".to_owned());
for ext in pathext
.split(';')
.map(str::trim)
.filter(|ext| !ext.is_empty())
{
names.push(format!("{program}{ext}"));
names.push(format!("{program}{}", ext.to_ascii_lowercase()));
}
names.extend(windows_absolute_tool_candidates(program));
names.sort();
names.dedup();
names
}

fn windows_absolute_tool_candidates(program: &str) -> Vec<String> {
if !runtime_is_windows() {
return Vec::new();
}
let program = program.trim().to_ascii_lowercase();
let system_root = std::env::var("SystemRoot")
.or_else(|_| std::env::var("WINDIR"))
.unwrap_or_else(|_| r"C:\Windows".to_owned());
match program.as_str() {
"cmd" | "cmd.exe" => vec![format!(r"{system_root}\System32\cmd.exe")],
"pnputil" | "pnputil.exe" => vec![format!(r"{system_root}\System32\pnputil.exe")],
"powershell" | "powershell.exe" => vec![
format!(r"{system_root}\System32\WindowsPowerShell\v1.0\powershell.exe"),
"powershell.exe".to_owned(),
],
"pwsh" | "pwsh.exe" => vec!["pwsh.exe".to_owned()],
_ => Vec::new(),
}
}
4 changes: 2 additions & 2 deletions crates/rocm-core/src/host_gpu/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
//! The text `rocm install sdk` prints when it cannot resolve a GPU: what the
//! detection saw, and on Windows the raw output of each inventory query.

#[cfg(windows)]
use super::capture::tool_path_candidates;
use super::detect_host_gpu_summary;
use super::linux::{detect_linux_primary_gpu_name, detect_linux_sysfs_gfx_target};
#[cfg(windows)]
Expand All @@ -21,6 +19,8 @@ use crate::gfx_target::{
amd_pci_device_id_from_pnp_id, gfx_target_from_amd_marketing_name,
gfx_target_from_amd_pci_device_id,
};
#[cfg(windows)]
use crate::probe_exec::tool_path_candidates;
use crate::{runtime_is_linux, runtime_is_windows, runtime_os_name};
#[cfg(windows)]
use std::io::Read;
Expand Down
9 changes: 4 additions & 5 deletions crates/rocm-core/src/host_gpu/wsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
//! WSL detection and the Windows host driver as seen from the guest: the WSL2
//! signals, the librocdxg chain, and the local and WSL host-driver probes.

use super::capture::{
capture_optional_command, capture_optional_command_with_timeout, tool_on_path,
};
use super::capture::{capture_optional_command, capture_optional_command_with_timeout};
use super::windows_inventory::{
WINDOWS_INVENTORY_QUERY_TIMEOUT, WINDOWS_VIDEO_CONTROLLER_INVENTORY_SCRIPT,
WindowsExamineInventory, detect_windows_examine_inventory_with_driver_facts,
parse_windows_examine_inventory,
};
use super::{DriverSummary, WslSummary};
use crate::gfx_target::parse_windows_display_gfx_target;
use crate::probe_exec::which;
use crate::{discover_rocm_installs, host_path, runtime_is_linux, runtime_is_windows};
use std::fs;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -372,8 +371,8 @@ pub(crate) fn detect_wsl_summary() -> Option<WslSummary> {
// The roots are already re-rooted through `host_path`, so this existence check
// takes the path as given.
let librocdxg_beside_runtime = librocdxg_beside_runtime(&roots, Path::exists);
let rocminfo = tool_on_path("rocminfo");
let cargo = tool_on_path("cargo");
let rocminfo = which("rocminfo");
let cargo = which("cargo");
let missing = missing_plumbing(
dxg_device,
dxcore,
Expand Down
Loading
Loading