Skip to content

fix(examine): enumerate every AMD adapter on WSL and enable fix-9 there - #1049

Open
harkgill-amd wants to merge 4 commits into
ROCm:mainfrom
harkgill-amd:harkgill/wsl-enumerate-every-amd-adapter
Open

harkgill-amd wants to merge 4 commits into
ROCm:mainfrom
harkgill-amd:harkgill/wsl-enumerate-every-amd-adapter

Conversation

@harkgill-amd

@harkgill-amd harkgill-amd commented Nov 11, 2026 •

Copy link
Copy Markdown

Why

Reported in ROCm/TheRock#9779: on WSL2 with a Ryzen iGPU and an RX 9070 XT, rocm examine reported detected_gfx_target: gfx1036 and compatible_therock_family: gfx103X-dgpu. In this iGPU + dGPU config, only the first adapter (iGPU) was reported while gpus[] was empty. rocm diagnose answered "no known misconfiguration matched".

The WSL probe already fetched and parsed the whole Windows adapter inventory, then kept only the driver version from it. With gpus empty, check_9_igpu_dgpu_collision was gated off WSL on the grounds that "WSL2 exposes no per-device topology to collide over", which was a consequence of the probe rather than of the platform.

What changes

probe_wsl now records every AMD adapter the host inventory names, and the iGPU/dGPU check runs on WSL. detect_wsl_host_displays returns the adapters and the driver version from one PowerShell call, where the inventory query previously ran twice.

rocm examine --json and gpus[]

before after
gpus [] two entries, in host order
has_apu / has_discrete_amd false / false true / true
// after
"gpus": [
  { "name": "AMD Radeon(TM) Graphics", "gfx_target": "gfx1036", "is_apu": true,  "is_amd": true },
  { "name": "AMD Radeon RX 9070 XT",   "gfx_target": "gfx1201", "is_apu": false, "is_amd": true }
]

rocm diagnose

Before, the top finding was fix-wsl-4-rocdxg-not-linked and the pairing was never mentioned. After:

#1 (fix-9-igpu-dgpu) [LIKELY score=65/100] iGPU enumerated alongside dGPU and destabilising the runtime
   - machine has both an AMD APU and an AMD discrete GPU
   - HIP_VISIBLE_DEVICES is unset; runtime sees BOTH GPUs
   note: Detected gfx targets: ["gfx1036", "gfx1201"]. Discrete GPU(s): ["gfx1201"];
         integrated APU(s): ["gfx1036"]. ...

This is the output Ubuntu already gives for the same hardware, so the change brings WSL to the bare-metal precedent instead of inventing a WSL-specific behaviour.

Open question for reviewers

This does not change detected_gfx_target, which still reports gfx1036 on this hardware. It does so on Ubuntu too, where detect_kfd_gfx_target_in takes the lowest-numbered KFD node. So rocm install sdk still resolves gfx103X-dgpu wheels for a gfx1201 card on both platforms.

Should we be prioritizing and listing the dGPU first in this case or leaving it up to the user to set a VISIBLE_DEVICES env var? parse_windows_display_gfx_target and preferred_amd_display already contain a ranking system, just need to add logic to favour dGPUs over iGPUs in the case where both have ROCm builds associated with thim.

Verification

  • cargo test -p rocm-core --lib passes 1500 tests with 0 failures. cargo check, cargo clippy and cargo fmt --check are clean across the workspace.
  • New tests cover both adapters being recorded with the iGPU listed first, an adapter the id table misses being identified by name (DEV_7448), an adapter neither table names being recorded with no APU verdict (DEV_73DF), and the WSL diagnose path asserting the finding's class and needs rather than only its presence.
  • only_these_entries_act_on_the_machine_and_only_on_these_platforms caught the missing fix/catalog.rs arm, exactly as it is meant to, and is updated.
  • Checked on real WSL2 hardware (Windows 11 with Ubuntu 24.04.5, two AMD dGPUs): gpus: [] before, both adapters with correct targets and has_discrete_amd: true after, while detected_gfx_target, compatible_therock_family, status and the driver fields are unchanged. That run is what caught the missing name-table tier, because the unit tests had passed on device ids that happened to be in the id table.
  • The iGPU plus dGPU A/B was done against a simulated host (e2e-test-hooks with ROCM_CLI_TEST_HOST_ROOT and a shimmed powershell.exe), stashing the patch to build an unpatched baseline and running both against the identical fixture.

Not verified: no machine with an AMD iGPU alongside an AMD dGPU was available, so that pairing is covered by unit tests and the simulated host only, never on real silicon. The full workspace test suite and the e2e-cucumber lanes were not run.

Checklist

  • If this PR fixes a bug, searched tests/e2e-cucumber/expectations.toml for the fixed ticket ID and removed/narrowed any now-stale xfail rows. No rows reference this area.
  • If this PR adds a new subcommand or subsystem, its domain implementation lives in its own file per docs/architecture.md. N/A, no new subcommand or subsystem.
  • If this PR adds, renames or removes a production source file, docs/architecture.md has the matching entry. N/A, nothing was added, renamed or removed; all eight files are modifications.
  • Every new or changed user-facing message was read against the code path that runs after it, and its test asserts the resulting state, not only the wording, per AGENTS.md §3. No message text changed. The new reachability of fix-9-igpu-dgpu on WSL is asserted by state (class, needs, and score over threshold), and two stale comments claiming WSL collects no GPU list are corrected rather than left to mislead.

@harkgill-amd
harkgill-amd requested a review from a team as a code owner November 11, 2026 22:22

@juhovainio juhovainio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through this against the current head. The direction looks right (listing every host AMD adapter instead of one is the correct fix for the examine symptom), but CI is red for reasons that are real regressions from this change, and a few behavior claims need tightening before merge.

Needs fixing before merge

  1. Generated artifacts are stale. Enabling fix-9 on WSL changes the catalog, but the outputs were not regenerated: the clippy job fails with "doctor-catalog.json is out of date" (cargo xtask catalog), and the Windows build/test and dash coverage jobs fail on eval_fixtures::what_is_committed_is_what_the_catalog_says because seven skill-eval replies.json fixtures changed (cargo xtask eval-fixtures; please read the resulting diff rather than just committing it).
  2. skills/rocm-doctor/reference.md still says fix-9 is linux/windows, in both the table row and the "(Linux and Windows)" prose. That file is an e2e fixture that rocm_doctor_skill.feature compares against rocm fix, so that scenario will fail once the catalog is regenerated. The CLI is the source of truth, so update the doc to match.
  3. No scenario for the user-visible change. rocm examine --json now lists several adapters on WSL and rocm diagnose now reports fix-9 there, but the PR only lists unit tests and a manual run, and gives no reason a scenario is not needed. The comment around line 82 of tests/e2e-cucumber/features/diagnose.feature ("fix-9 does not apply on WSL2 ...") is now false and needs updating along with whatever scenario it justifies. Please add or update a scenario, or say in the PR text why none applies and which lane exercises it.
  4. The commit has no Signed-off-by and is not GitHub-Verified, so the commit signatures gate fails. It needs git commit -s with signing enabled.

Worth addressing / questions

  • The new gpus[] comes from the Windows host inventory, not from what the WSL guest's runtime can enumerate. A host iGPU the distro does not expose would still produce "runtime sees BOTH GPUs", and --device-index N is then applied against host order. wsl_usable_indices in gpu_visibility.rs still returns a single device, so it disagrees with the new list. Either gate on guest evidence or state the limitation.
  • Several comments still say WSL has no GPU list: the header above CHECKERS and check_20 in diagnose/catalog.rs, the DIAGNOSE_ONLY_ON_LINUX_AND_WINDOWS note in fix/catalog.rs, and gpu_visibility.rs. With gpus[] filled, check_20_gpu_unsupported_by_rocm may now be enableable on WSL too, or its reason needs rewording.
  • The new amd_displays doc comment was inserted into the middle of the existing amd_display_count doc (see inline), so amd_display_count lost its own doc.
  • detect_wsl_host_displays (trim, missing id becomes an empty string, one-call driver plus adapters) has no direct test; only record_host_adapters is covered, with hand-built adapters. The unidentified-adapter fixture uses DEV_73DF named "AMD Radeon(TM) Graphics", which is not a pairing real hardware produces.
  • detect_wsl_host_driver is now a thin wrapper; please confirm it still has a non-test caller so -D warnings does not trip on dead code.
  • The open question about detected_gfx_target still resolving to gfx1036 on an iGPU+dGPU host is honestly flagged and fine as a follow-up.

The E2E lane failures (Strix Halo WSL2/Windows/Ubuntu, MI300X) were still in progress when I looked, so I could not tell whether they are the same stale artifacts or something else.

(check_8_wheel_rocm_mismatch, &["linux", "windows", "wsl"]),
// Not "wsl": WSL2 exposes no per-device topology to collide over.
(check_9_igpu_dgpu_collision, &["linux", "windows"]),
(check_9_igpu_dgpu_collision, &["linux", "windows", "wsl"]),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enabling check 9 on wsl needs the generated outputs regenerated (cargo xtask catalog for doctor-catalog.json, cargo xtask eval-fixtures) and skills/rocm-doctor/reference.md updated (table row and the "Linux and Windows" prose); clippy and the Windows xtask test fail on these today. The header comment above CHECKERS and the check_20 comment in this file still say WSL has no GPU list.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done on all four. cargo xtask catalog and cargo xtask eval-fixtures are regenerated and committed.

Updated all stale references to WSL having no GPU list.

/// vendor, so the rows also hold devices like "AMD Bluetooth Capture Audio
/// Device" and "Intel(R) UHD Graphics". A row counts only with an AMD PCI
/// device id (`PCI\VEN_1002`) or a marketing name `rocm examine` recognizes.
/// The listed rows that are AMD GPUs, by the test

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new amd_displays doc was inserted into the middle of the existing amd_display_count doc, so the two paragraphs run together and amd_display_count lost its own doc. Please split them.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. amd_displays now has its own doc above its own fn, and amd_display_count's original paragraph is restored above the count.

/// unlike `probe_gpus_windows`: `check_9_igpu_dgpu_collision` pairs an APU with a
/// discrete card, so calling an unidentified part discrete would invent that
/// pairing. An APU keyword match still counts as integrated with no target.
fn record_host_adapters(e: &mut Examination, adapters: &[crate::WslHostDisplayAdapter]) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These entries come from the Windows host inventory, not from what the WSL guest runtime enumerates, yet fix-9 now says the runtime sees both GPUs and --device-index is applied against host order. Can a host iGPU that is not exposed to the distro occur, and does wsl_usable_indices (still one device) now disagree with gpus[]? Consider gating on guest evidence or noting the limitation.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can a host iGPU that is not exposed to the distro occur

Yes, though this was more of an issue in older (<10) ROCm releases. WSL used to only enumerate nodes that were present in a pre-defined hardware mapping so there could be cases where Windows list != WSL list.

That's no longer the case on newer TheRock builds where WSL runtime will get GPU info directly from the driver instead of the intermediary mapping.

From what I understand, rocm-cli reports gpu lists both prior and post rocm install. In this case, we could,

  1. No ROCm SDK - report Windows list
  2. ROCm SDK installed - compare existing Windows list with runtime list - overwrite with the latter in case of discrepancy.

This seems to be what's already done on Ubuntu with lspci (pre ROCm) then KFD (post ROCm). Let me know what you think.

@harkgill-amd
harkgill-amd force-pushed the harkgill/wsl-enumerate-every-amd-adapter branch from e7a7321 to e9dc4c7 Compare November 13, 2026 17:18
Signed-off-by: Harkirat Gill <harkirat.gill@amd.com>
…t comments

Signed-off-by: Harkirat Gill <harkirat.gill@amd.com>
… GPU in an e2e scenario

Signed-off-by: Harkirat Gill <harkirat.gill@amd.com>
…dex matches position

Signed-off-by: Harkirat Gill <harkirat.gill@amd.com>
@harkgill-amd
harkgill-amd force-pushed the harkgill/wsl-enumerate-every-amd-adapter branch from d15ca40 to f8bf13f Compare November 16, 2026 21:33

@juhovainio juhovainio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things I'd like settled before this merges; the rest are smaller.

Blocking

  1. Host-derived gpus can make the shared WSL checks over-report. On WSL, gpus now comes from the Windows host inventory, while usable_amd_gpu_indices (gpu_visibility.rs) still reports a single device there. Shared wsl-scoped checks that read gpus (check_1, check_8, ...) can now fire on an adapter the guest runtime never exposes, e.g. the gfx1036 iGPU when only the dGPU is visible. the_shared_checks_under_report_on_wsl_rather_than_over_report was edited to run with empty gpus, so the invariant it names is no longer pinned for the populated case. Please add a populated-gpus, healthy-host test asserting which shared checks may fire, or narrow which checks use host-derived adapters. The comment for leaving check_20 off WSL ("host inventory rather than what the guest can open") applies equally to the checks that were left on.

  2. fix-9's "runtime sees BOTH GPUs" claim isn't backed by guest-side evidence. The finding tells the user the collision is live and to pass --device-index N, where N is a host-inventory order index. Nothing shows the host order matches the HIP ordinal under ROCDXG, or that the runtime enumerates the iGPU at all. The added unit test only pins the fix class and the argument name, not that the advice is true. Either gate fix-9 on guest evidence (e.g. rocminfo reporting >= 2 agents) or soften the wording on WSL.

Non-blocking

  • No scenario exercises the fix-9 finding on WSL: diagnose-08/diagnose-16 stay skipped there, and the WSL lanes have a single iGPU so none can produce the pair. The PR text should say which lane covers it, and that the examine scenario runs only on the gated WSL+GPU lane.
  • Duplicate or virtual AMD-named display rows would each become a gpus[] entry and can fabricate an APU+dGPU pair; a test with a duplicated row is warranted.
  • The unidentified-adapter test depends on DEV_73DF staying out of the id table; use an obviously synthetic id.
  • WslHostDisplayAdapter is pub and re-exported; pub(crate) looks sufficient.
  • The examine-49 step name overpromises relative to what it asserts.
  • Docs sync (README, docs/testing.md, docs/manual-testing.md) for any "no GPU topology on WSL" claims should be grepped; the PR doesn't say the new tests were shown to fail with their target broken.
  • detected_gfx_target is still gfx1036, so rocm install sdk keeps picking the wrong wheel family for the gfx1201 card from TheRock#9779. The PR body already flags this as open; please confirm a follow-up exists.

CI is green on the current head.

(check_8_wheel_rocm_mismatch, &["linux", "windows", "wsl"]),
// Not "wsl": WSL2 exposes no per-device topology to collide over.
(check_9_igpu_dgpu_collision, &["linux", "windows"]),
(check_9_igpu_dgpu_collision, &["linux", "windows", "wsl"]),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check_9 now runs on WSL on evidence from the Windows host inventory, while usable_amd_gpu_indices still reports one device there. What shows the guest runtime enumerates both adapters, and that a host-order --device-index N matches the HIP ordinal? Please back the "runtime sees BOTH GPUs" finding with guest-side evidence or soften it on WSL.

e.env
.insert("PATH".to_owned(), "/opt/rocm/bin:/usr/bin".to_owned());
assert!(e.gpus.is_empty(), "WSL collects no GPU topology");
assert!(e.gpus.is_empty(), "this fixture records no adapters");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test now only covers the empty-gpus case. With gpus populated from the host inventory the shared wsl checks (check_1, check_8, ...) can name an adapter the runtime never sees; please add a populated-gpus healthy-host test so the under-report-not-over-report invariant stays pinned.

{
Some(target) => (target.to_owned(), Some(super::gfx_is_apu_family(target))),
None => match super::linux_gpus::classify_amd_marketing_name(&adapter.name) {
(target, false) if target.is_empty() => (target, None),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test where the inventory lists the same physical adapter twice (or a virtual AMD-named display); as written each row becomes a gpus[] entry and can fabricate an APU+dGPU pair.

/// `Some(false)` would read as "discrete" and could invent the second half
/// of an iGPU/dGPU pair out of a part nothing recognized.
#[test]
fn an_unidentified_adapter_is_recorded_without_an_apu_verdict() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This depends on DEV_73DF staying absent from the id table (it is an RX 6700 XT id). Use an obviously synthetic id (e.g. DEV_FFFF) for the unidentified case.

/// [`WslHostDriverProbe`] can say "the host was never asked", which a
/// per-adapter `Option<String>` could not.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct WslHostDisplayAdapter {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only used inside rocm-core; pub plus the lib.rs re-export widens the public API. pub(crate) unless external use is intended.

Scenario: examine-49 - The machine-readable report lists the host's AMD GPUs on WSL
Given the CLI is running in WSL
When the user inspects the system both for reading and for scripting
Then it lists every AMD GPU the Windows host reports

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The step says "every AMD GPU the Windows host reports" but only asserts non-empty and is_amd. Please rename so the scenario doesn't overpromise.

# shared code and stays covered by the mock and Linux GPU lanes.
# with nothing installed. fix-9 now applies on WSL2 as well, so the wrong-platform
# refusal no longer stops the run there, but this scenario has not been run on a
# WSL2 lane and stays a skip there until it has. The gate is shared code and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix-9 now applies on WSL but diagnose-08/16 remain skipped there; no scenario or lane exercises the iGPU/dGPU finding on WSL (the WSL lane has a single iGPU). Please state in the PR which lane covers this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants