Repository navigation
fix(wsl): give examine, serve and the probe one answer about WSL2 - #220
Conversation
Three places decided whether a host was WSL2, and they used different evidence. The install summary asked for /dev/dxg or "microsoft" in /proc/version; the JSON probe asked for "microsoft" or "wsl" in /proc/version, or $WSL_DISTRO_NAME. A host with /dev/dxg and a kernel string naming neither was WSL to one and not the other, so `rocm examine` and `rocm examine --json` could disagree about the platform they were describing. The e2e harness derives is_wsl for its whole expectation matrix by reading one of them. There is now one predicate, the union of every signal any of them used. A false positive costs a route-out note; a false negative runs bare-metal driver checks against a platform with no amdgpu module and reports nonsense. `serve` was a third answer, and a worse one. It counted KFD topology nodes and amdgpu DRM cards -- neither of which exists on WSL2 -- and `linux_kfd_gpu_node_count` reads "topology unreadable AND no /dev/kfd" as an authoritative zero rather than as unknown. That is precisely the WSL2 shape, so a machine whose own `examine` said `wsl_rocdxg_ready` was refused a GPU-required launch for having no GPU. It now asks the plumbing WSL2 actually uses, via the same readiness rule the report prints, so the two cannot contradict each other in either direction. The probe also stopped before its framework step on WSL2. The driver probes are rightly skipped there -- modprobe, the render group and /dev/kfd say nothing about a platform that does not use them -- but PyTorch on WSL2 is a supported, documented configuration, and a user asking which ROCm build their torch has was told nothing at all. That one probe now runs before routing out. On this WSL2 box it turns an empty framework_notes into "torch import failed: ModuleNotFoundError" plus "No llama.cpp binary on PATH" -- the actual answer. The predicate is split from the machine reads so the union can be tested, including the two shapes that split the old implementations. Signed-off-by: Eugene Volen <Eugene.Volen@amd.com>
|
Reviewed this against the live code, not just the diff, and the three-implementations-into-one claim holds up exactly as described.
One thing worth naming but not blocking: CI is green across every lane. The PR is upfront about the verification gap (no WSL runner in CI, and the Looks safe to approve after final validation. |
tests/e2e-cucumber/expectations.tomlfor the fixed ticket ID and removed/narrowed any now-stale xfail rows. No row references this behaviour — there is no WSL lane in CI (see below).Summary
Three places decided whether a host was WSL2, on different evidence:
detect_wsl_summary)/dev/dxgormicrosoftin/proc/versionprobe_os)microsoftorwslin/proc/version, or$WSL_DISTRO_NAMEserve(probe_usable_amd_gpu_indices)So a host with
/dev/dxgand a kernel string naming neither was WSL to one and not the other, androcm examinecould contradictrocm examine --jsonabout the platform it was describing. The e2e harness derivesis_wslfor its entire expectation matrix by scraping one of them.There is now one predicate, the union of every signal any of them used. A false positive costs a route-out note; a false negative runs bare-metal driver checks against a platform with no amdgpu module and reports nonsense.
serverefusing on a machineexaminecalled readylinux_kfd_gpu_node_countreturnsSome(0)— an authoritative zero, not "unknown" — when the topology directory is unreadable and/dev/kfdis absent. That is exactly the WSL2 shape, so a GPU-required launch was refused on a machine whose ownexaminereportedwsl_rocdxg_ready.Verified from the code rather than taken from the report: on this WSL2 box
/dev/kfd,/sys/class/kfdand/dev/dxgare all absent while/sys/class/drmexists, which lands on that branch.servenow asks the plumbing WSL2 actually uses, through the same readiness rule the report prints — extracted toWslSummary::rocdxg_readyso there is one source. Ready means a device, not-ready means none, and both match whatexaminesays.HIP_VISIBLE_DEVICESstill applies on top.The probe gave up before the frameworks
Deferred here from #218. The driver probes are rightly skipped on WSL2 — modprobe, the render group and
/dev/kfdsay nothing about a platform that does not use them. But PyTorch on WSL2 is a supported, documented configuration, and stopping before the framework probe meant--jsoncould never say which ROCm build a user's torch was compiled against.That one probe now runs before routing out. Measured on this box, diffing the document before and after — the only field that changes:
An actual answer instead of silence.
Cost, stated plainly:
rocm diagnoseon WSL2 now pays a Python interpreter start it previously skipped, and then declares itself out of scope as before. On any other platform it already paid that cost. Worth it forexamine, arguably not fordiagnose; if a reviewer disagrees, the cleaner fix is fordiagnoseto requestFrameworkProbe::Skip, which #218 makes expressible.Test plan
The predicate is split from the machine reads so the union can be tested. Seven new tests:
rocdxg_readyrequires the whole chain, asserted by breaking each link in turn — any one missing and a GPU launch cannot work, soservemust not be told it can;HIP_VISIBLE_DEVICESstill hides it.cargo test -p rocm-core: 264 pass. Failures are the known WSL2-localproc_lifecycle::tests::tree_*pair and the pre-existingproviders::tests::local_provider_*/therockflakes, all of which reproduce onmain.cargo fmt --all --check, workspaceclippy --all-targets -D warningsand the prek hygiene hooks are clean.Verification gap. There is no WSL runner in CI, so none of this is exercised by any lane — the coverage is the unit tests plus manual verification on this WSL2 box. The
servehalf in particular cannot be proven end to end here, because this box has no/dev/dxg: it is a WSL2 install without GPU plumbing, soservecorrectly refuses both before and after. Someone with a working ROCm-on-WSL2 setup should confirm the reported symptom is gone.cargo xtask e2ereports the twodiagnosescenarios failing — the known WSL2-local noise that #216 fixes with@requires-bare-metaland this branch does not carry, not a regression from this change.🤖 Generated with Claude Code