Skip to content

fix(examine): identify AMD GPUs by device id and one name table, and never downgrade an APU verdict (ROCMAI-534) - #521

Open
rominf wants to merge 4 commits into
mainfrom
fix-amd-apu-classification
Open

rominf wants to merge 4 commits into
mainfrom
fix-amd-apu-classification

Conversation

@rominf

@rominf rominf commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator
  • 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.
  • 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 changes; examine-49, examine-50 and examine-51 assert the reported state.

Fixes #520

The problem

rocm examine reports each AMD GPU's gfx_target and is_apu. What a user sees follows from the same classification: rocm diagnose raises fix-9-igpu-dgpu from is_apu, only on a host with both an integrated and a discrete AMD GPU; and on a single-GPU host whose target is an APU family (whose "VRAM" is a carve-out of system RAM), rocm serve withholds its low-VRAM warning and rocm diagnose --model does not judge the fit against the carve-out. Those two ask vram_capacity_is_meaningful, which calls gfx_is_apu_family on the detected target rather than reading is_apu, so for them it is the predicate below that changes the answer. On main several integrated GPUs come out with no target, the wrong target, or as discrete:

  • The Linux PCI scan ignores the [1002:xxxx] device id lspci -nn prints, so a GPU pci.ids cannot name (Device) gets no target and the "not an APU" default.
  • examine keeps its own name table beside the crate's shared one. It calls Krackan Point gfx1150 (its device id 1114 and the 860M/840M it sells as say gfx1152, a different TheRock family), and its APU_KEYWORDS list says "APU" for Renoir, Cezanne and the other codenames without ever naming a target.
  • Raven Ridge (gfx902), Picasso/Raven2 (gfx909) and Mendocino (gfx1037) are not classified as integrated at all.
  • A GPU whose target comes only from the kernel's KFD topology keeps the PCI scan's "not an APU" guess, or no verdict at all when there is no PCI row. So a Raven Ridge laptop with a discrete card reports no integrated GPU, and a ROCm container with no pciutils reports neither kind.
  • A rocminfo agent or hipInfo line overwrites is_apu with gfx_is_apu_family, which answers false both for a discrete card and for a target it has never heard of, so reading more evidence can turn an identified APU into a discrete card.

What changes

All of it is in the modules main split examine.rs and host_gpu.rs into: linux_gpus.rs, windows.rs, gfx_target.rs and windows_inventory.rs.

  • The Linux PCI scan asks the device id first, then the name, the way the Windows probe already asks the PNP id first.
  • One name table. examine's copy and APU_KEYWORDS are deleted. classify_amd_marketing_name asks gfx_target_from_amd_marketing_name and derives is_apu from the target. The shared table gains the codenames lspci prints: Strix Halo, Ryzen AI Max, Strix Point, Krackan (gfx1152), Phoenix1–4, Hawk Point, Rembrandt, Raphael, Mendocino (gfx1037, listed ahead of the 610M row), VanGogh / Custom GPU 0405, Renoir, Cezanne, Lucienne and Barcelo.
  • gfx902, gfx909 and gfx1037 are integrated in gfx_is_apu_family. No lookup table produces them; they arrive from KFD's packed gfx_target_version (90002, 90009, 100307).
  • Three-way verdict. gfx_apu_verdict answers Some(true), Some(false) (from DISCRETE_GFX_TARGETS) or None for a target nothing classifies. It strips feature and generic-target suffixes once, before either half, so gfx90c-generic is an APU like gfx1036-generic.
  • Better evidence never makes the answer worse. The rocminfo and hipInfo folds revise is_apu only when the target's packaging is known; an unknown target leaves the earlier verdict standing. (The rocminfo half is latent until examine: gfx_target is empty for every GPU even though rocminfo lists them → ISA Name: lines overwrite the agent name #393: today the parser drops every agent on a real host.)
  • The kernel topology decides the verdict of a row it names. apply_kernel_gpu_membership sets is_apu from the KFD target for a row the PCI scan left without a target, and for a topology-only placeholder; the sysfs fallback does the same. A target nothing classifies leaves the scan's verdict, or None.
  • No verdict from a guessed name pairing. rocminfo agents are still paired with GPUs by position (examine: rocminfo agents are paired to lspci entries by index, which can mislabel both GPUs #508). A row that still has no verdict takes the agent's marketing name only when one AMD GPU and one agent are listed; on a multi-GPU host it stays unknown, per AGENTS.md §6. An agent whose target is classified still revises the verdict of the row it is paired with, by position, as it does on main.
  • Install side keeps ROCMAI-542: detect gfx90c (Renoir/Cezanne Vega iGPUs) and stop mapping it to gfx90X-dcgpu #648's ranking. Now that the name table can name gfx90c by codename, parse_windows_display_gfx_target and preferred_amd_display rank a name-identified gfx90c below every other recognised adapter, as they already did for a PCI-identified one, and above an adapter nothing recognises.

What a user can see

  • rocm examine --json on Linux: a GPU lspci names only Device now carries its target when the device id is in the table; Krackan Point reports gfx1152 (was gfx1150); Renoir/Cezanne/Lucienne/Barcelo/Mendocino rows named by codename carry a target (were empty); Mendocino now reports gfx1037 and is_apu: true (was empty and false); a Raven Ridge or Picasso iGPU with amdgpu loaded reports is_apu: true.
  • rocm examine --json on Windows without a HIP SDK: a GPU whose PNP id is not in the device-id table is now named from the shared table, so for example an RX 7900 XTX reports gfx1100 in gpus[] (was empty), matching summary.detected_gfx_target.
  • rocm diagnose can now raise fix-9-igpu-dgpu on those hybrid hosts, and on a single-GPU host whose detected target is gfx902, gfx909 or gfx1037 rocm serve stops warning about VRAM and rocm diagnose --model stops measuring the fit against the carve-out.
  • The install-side family choice does not change for any host main already recognised; a codename-named gfx90c is ranked exactly as a PCI-id-named one.

docs/host-probing.md recorded this name-table convergence as pending on this PR; its "Marketing name to gfx target" section now records it as delivered, with the three scenarios below.

Deliberate trade-offs and known gaps

  • An AMD PCI row that nothing identifies is still reported as discrete (Some(false)), not unknown. None would silence fix-9-igpu-dgpu beside every discrete card the tables do not name (RX 5000, Vega, Radeon VII) on the hybrid host it exists for; the cost is a wrong has_discrete_amd on an iGPU-only host whose row nothing identifies, where the check still cannot fire because has_apu is false. Documented on classify_amd_marketing_name and run through diagnose() by an_unidentifiable_pci_row_is_reported_as_discrete_and_this_is_what_that_costs.
  • gfx942 is listed discrete. It covers MI300X and the MI300A APU; the target cannot tell them apart and MI300X is what ROCm hosts run. So the rule this PR delivers is "a target nothing classifies never downgrades a verdict", not "an APU verdict is never downgraded" for every part.
  • Raven Ridge / Picasso before amdgpu loads still report an empty gfx_target and is_apu: false: their device ids (15dd, 15d8) are in no table, and this PR does not add them. The device-id table is shared with the install side, where normalize_therock_family would put a gfx902 into the data-center gfx90X-dcgpu family, and 15dd covers both Raven (gfx902) and Raven2 (gfx909) by revision. Tracked in therock: Raven Ridge and Picasso APUs (gfx902, gfx909) are filed under a datacenter package family #519 (install family) and examine: lspci cannot name a GPU that pci.ids does not know, though the device id is on the line #507 (device-id rows). docs/manual-testing.md states the gap.
  • rocminfo still pairs agents with GPUs by position, so on a multi-GPU host a mispaired agent can still label a card with another card's target, and when that target is classified it also sets the card's verdict, including Some(false) over an APU. What this PR protects is narrower: a target nothing classifies, or a marketing name on an ambiguous pairing, never changes a verdict. Pairing by PCI address is examine: rocminfo agents are paired to lspci entries by index, which can mislabel both GPUs #508.

Assumptions, stated

  • gfx902/gfx909/gfx1037 are APUs. Source: LLVM's AMDGPU target list (Raven, Raven2, Mendocino), cross-checked with KFD gfx_target_version 90002, 90009 and 100307.
  • There is no "Radeon 8045S". The Strix Halo names are 8060S, 8050S and 8040S (8040S: Ryzen AI Max PRO 380). The deleted table's 8045s was never a product; the shared table already carried 8040s.
  • A Windows Mendocino named only "Radeon(TM) 610M" reads as gfx1036 by name; its device id 1506 is not in the device-id table (examine: lspci cannot name a GPU that pci.ids does not know, though the device id is on the line #507). On the install side that is as on main. In examine it is a change: main's own name table did not know 610M, so the row had no target and, with a HIP SDK installed, hipInfo filled in gfx1037. Now the name-derived gfx1036 counts as identified, so the hipInfo line no longer replaces it, and on a host with another unidentified AMD adapter that line can go to that adapter instead. Both targets are APUs, so is_apu is true either way.

Test plan

Scenarios (AGENTS.md §3), all @requires-os:linux with a simulated host, so they run on every Linux lane, GPU or not (examine.feature):

  • examine-49 (@id:examine-tells-integrated-gpus-from-discrete-ones): a stand-in lspci lists five AMD GPUs, rocminfo lists no agents, the host root has no topology. The RX 7900 XTX is answered by its name, the Raphael iGPU by its device id alone, Krackan Point and Renoir by their device ids, Mendocino by its codename alone.
  • examine-50 (@id:examine-classifies-an-igpu-from-the-kernel-topology): a Raven Ridge iGPU and an unnamed card whose PCI rows resolve nothing; the KFD topology's gfx902 and gfx1102 must make one integrated and the other discrete.
  • examine-51 (@id:examine-classifies-gpus-only-the-kernel-lists): no PCI rows at all; two topology-only GPUs (gfx1151, gfx1201) must still come out integrated and discrete.

Unit and property tests, mutation-checked (restoring the old behaviour fails the listed tests):

Mutation Fails
rocminfo fold: unconditional overwrite rocminfo_never_downgrades_an_apu_verdict (property), folding_in_rocminfo_only_ever_adds_knowledge, a_rembrandt_laptop_keeps_its_apu_verdict_through_every_probe
hipInfo fold: unconditional overwrite a_hipinfo_target_revises_a_verdict_only_when_its_packaging_is_known
lspci scan reads the name only lspci_scan_prefers_the_device_id_to_the_name, an_lspci_row_is_classified_by_its_device_id_when_its_name_says_nothing
Windows probe (examine or install side) resolves from the name only examine_and_the_install_probe_read_a_windows_row_alike (property; green on main's corpus, red now that it draws generic-name rows)
a name-paired agent decides a verdict on a multi-GPU host a_kernel_topology_gpu_is_classified_from_the_evidence_there_is
rocminfo fold no longer revises a verdict from a known target the_rocminfo_fold_on_both_sides_of_the_isa_name_defect, folding_in_rocminfo_only_ever_adds_knowledge
delete or retarget any codename row added to the name table each_codename_row_names_its_own_target
device-id parser drops the ] check, or takes the first [1002: the_lspci_device_id_is_read_from_the_amd_vendor_tag
-generic suffix not stripped before the Vega match an_unclassified_target_has_no_apu_verdict
Krackan back to gfx1150 examine_names_a_gpu_by_its_codename_from_the_shared_table
install-side name guard removed (either site) windows_display_parser_does_not_let_a_named_vega_igpu_hide_a_discrete_card

The property harness (examine_gpu_proptests.rs) is built from real lspci lines, rocminfo blocks, Windows rows and marketing names, and asserts floors on how much of each corpus its generators reach.

Gate. The full local gate ran on 8b69b0a9 (the two reviewed commits, rebased on a09c9204):

  • cargo fmt --all --check; cargo clippy --locked --workspace --all-targets -- -D warnings; cargo clippy --locked -p e2e-cucumber --test e2e -- -D warnings; cargo xtask check-module-size; cargo xtask check-architecture-doc.
  • cargo test --locked --workspace --all-targets --no-fail-fast: green apart from four tests this host fails on any branch: service_control::tests::stop_of_a_container_engine_is_unconfirmed_when_the_engine_stop_fails, the two build_metadata git_watch_paths_* tests, and the Lemonade restoring_the_packaged_pins_never_reuses_another_writers_temp_file timing probe ("inconclusive ... this host is too slow" under full-suite load; it passes run alone).
  • The three scenarios (then numbered examine-43 to examine-45) and main's neighbouring examine-42 via cargo xtask e2e. With gfx_apu_verdict forced to "unknown", the two kernel-topology scenarios fail.
  • scripts/smoke_local.py runs through the CLI and rocmd bridge steps and stops at the rocmd sandbox step, which this host's bwrap cannot set up (loopback: Failed RTM_NEWADDR: Operation not permitted), unrelated to this change.

Since then main was merged in (da2906f4, which renumbered the scenarios) and 3115e327 corrected comments and docs only. On 3115e327: cargo fmt --all --check, cargo clippy -p rocm-core --all-targets -- -D warnings, the rocm-core examine unit tests, feature_naming and cargo xtask check-architecture-doc pass, and examine-49, examine-50 and examine-51 run via cargo xtask e2e. CI on this head covers the rest of the workspace.

Not run here: Windows clippy and tests (no Windows toolchain on this host); the Windows-only code paths changed are parse_gpus_windows_output, fill_unidentified_gpus_from_hipinfo and preferred_amd_display, all driven by unit tests on Linux and run on the windows-build-and-test job. No real hybrid APU+dGPU, Raven or Mendocino hardware was available; the scenarios simulate them.

Related

@rominf
rominf requested a review from a team as a code owner October 2, 2026 15:13
@rominf
rominf requested a review from michaelroy-amd October 2, 2026 15:13

@volen-silo volen-silo 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 carefully, mostly because the description makes strong claims about what the tests guarantee. The production logic holds up well — I traced the "never downgrade" rule through both branches of the rocminfo fold, the hipInfo fold, the sysfs fallback and the probe ordering in probe_with_interpreter, and I could not find a path where it pins a verdict optimistically high, nor a currently-shipping part whose classification silently flips. Keying packaging off the target instead of a prefix rule is clearly the right call, and the drift guard that sweeps all 65,536 device ids plus the marketing table is a genuinely good piece of defensive design. cargo test -p rocm-core --lib is green here at 478 passed.

What I'd like changed is on the test side, and one small thing in the Windows probe. The headline is that the 2048-case property named for this PR's central invariant — rocminfo_never_downgrades_an_apu_verdict — cannot fail under the mutation it is named for. Its generator only draws corpus devices whose targets are all present in GFX_TARGET_PACKAGING, and on exactly those inputs the new conditional overwrite and the old unconditional one agree by construction. I reproduced the mutation: restoring the unconditional overwrite does fail a test, so the table in the description is literally true, but the only thing that fails is the hand-written example folding_in_rocminfo_only_ever_adds_knowledge. The property stays green. Given how much weight the description puts on the property harness, that gap is worth closing before merge rather than after.

The rest are smaller: a reach floor that is > 0 where its four neighbours are fractions of the draw count (and four more measured counters with no floor at all), a determinism assertion that compares a pure function to itself, a fallback in the Windows probe that cannot produce a different answer than the call it follows, and one marketing pattern that was quietly dropped when examine started delegating to the crate table. Details inline.

A few things I suspected and could not make stick, in case it saves anyone re-checking them: extract_lspci_device_id handles the bracket shapes lspci -nn -D actually emits, including the nameless Device row and non-AMD vendor tags; the base-token extraction in gfx_target_packaging copes with feature suffixes, -generic and case; the positional pairing of rocminfo agents to PCI rows is unchanged in effect by this PR even though it is still positional; the new bare gfx90c family name does not trip any suffix-matching consumer, and preferred_serve_engine_for_therock_family correctly stops recommending vLLM for it; and nothing in the e2e expectations, the remote-ssh fixture, the CI lane hardware or the docs describes the old behaviour and goes stale.

/// a worse answer.
#[test]
fn rocminfo_never_downgrades_an_apu_verdict(
device in proptest::sample::select(apu_lspci_devices()),

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 property is named for the invariant the PR is built around, but it cannot observe the fix.

apu_lspci_devices() only yields AMD_LSPCI_DEVICES entries with is_apu == true, and every target those entries carry (gfx90c, gfx1033, gfx1035, gfx1036, gfx1103, gfx1150, gfx1152) is in GFX_TARGET_PACKAGING. The agent fed to apply_rocminfo_gpu_agents below is device.2, the same device's own target. So on every input this generator can produce, gfx_target_packaging(..) returns Some(..) and the new conditional overwrite computes exactly what the old unconditional gpu.is_apu = Some(gfx_is_apu_family(&gfx)) computed. The two versions are indistinguishable across the property's entire domain.

I restored the unconditional overwrite to check: all 2048 cases pass, and the only failure in the suite is the example folding_in_rocminfo_only_ever_adds_knowledge. That example's unknown-target sub-case (gfx1154) is therefore the sole guard on this fix — weaken or delete it and the regression returns with the property suite still green.

The fix is to put an unrecognised target in the property's reach: either widen the generator so the agent target can be one GFX_TARGET_PACKAGING does not classify while the PCI row still resolves an APU, or add a sibling property that does. As written the property asserts something true but vacuous.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed: the property could not fail under the mutation it was named for. Fixed in 9ef5574 (branch rebuilt on main; see the PR comment).

rocminfo_never_downgrades_an_apu_verdict now draws the agent's target from agent_target_for(device_target). That is the device's own target three times in four, and otherwise one of UNCLASSIFIED_GFX_TARGETS (gfx1170, gfx1180, gfx1260, gfx1300), targets the crate does not classify.

  • every_target_a_lookup_table_produces_has_an_apu_verdict asserts that those four really have no verdict, so the draw cannot silently become a known target. (This caught a real problem while rebuilding: I first used gfx1154, which the gfx115x arm classifies as an APU.)
  • generator_reach_is_measured_and_sufficient puts a floor of 12.5% on the unclassified draws. The measured rate is 26%.

Mutation: restoring the unconditional gpu.is_apu = Some(gfx_is_apu_family(&gfx)) in the rocminfo fold now fails the property, plus folding_in_rocminfo_only_ever_adds_knowledge and a_rembrandt_laptop_keeps_its_apu_verdict_through_every_probe. Before, only the example failed.

"the lspci corpus barely samples APU silicon"
);
assert!(
lspci_gfx_resolved > 0,

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 floor is > 0 where the three above it are DRAWS/2, DRAWS/3 and DRAWS/4. A generator that resolved a gfx target on one lucky draw in 4096 would satisfy it, so it does not actually protect against the reach regression the comment above describes ("a generator that reaches none of these is worthless" is exactly what it encodes, and no more). Since every entry in AMD_LSPCI_DEVICES has a known target, > DRAWS/4 alongside lspci_apu_device looks achievable.

Related, in the same test: lspci_classified_apu, marketing_examine, marketing_install and marketing_apu_truth are all counted and printed but never asserted on. The PR description says measured reach is "asserted as floors so the harness cannot rot", which is true of four counters and not of the other four. Either give them floors or drop them from the print so the test's coverage claim matches what it enforces.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 9ef5574. Every counter the test prints now has a floor, and the floors sit well under the measured rates (2048 draws):

region measured floor
lspci name parsed 100% 50%
lspci enumerated GPU class 50% 33%
lspci APU silicon 61% 25%
lspci scanned as an APU 26% 16.7%
lspci gfx target resolved 42% 25% (was > 0)
marketing name resolved 92% 50%
marketing APU silicon 65% 33%
rocminfo unclassified agent target 26% 12.5%

The "scanned as an APU" and "resolved" counters now come from the real apply_lspci_gpus fold rather than the name classifier, so they measure what the PCI scan produces. The marketing_install and marketing_both counters are gone: examine now asks the same name table as the install side, so comparing the two would always agree.

prop_assert_eq!(&name, &extract_lspci_name(&line));
let verdict = classify_amd_marketing_name(&name);
prop_assert_eq!(&verdict, &classify_amd_marketing_name(&name));
prop_assert_eq!(gfx_is_apu_family(&verdict.0), gfx_is_apu_family(&verdict.0));

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.

Both sides of this are the same call on the same argument, so it cannot fail. The three assertions above it have the same shape, which is deliberate — the test is named for determinism — but gfx_is_apu_family, extract_lspci_name and classify_amd_marketing_name are pure functions over &str with no interior mutability and no randomness, so determinism is a property of the language here rather than of this code. What the test genuinely buys is totality: none of the classifiers panic on a mutated line. That is worth having, but the name and doc comment promise more than the body can deliver, and this last line adds nothing the preceding one did not. I'd either drop it and rename the test to say it is a no-panic sweep, or make the determinism half meaningful by comparing against a value captured before some state change.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, the determinism half was vacuous. Fixed in 9ef5574. The test is now classifiers_never_panic_on_a_mutated_lspci_line.

  • It drops every self-comparison.
  • It runs each classifier (is_lspci_gpu_line, extract_lspci_device_id, the name classifier, gfx_apu_verdict) and also the real apply_lspci_gpus fold that composes them, on each mutated line.
  • The one assertion it makes is about the fold's output: a single line never enumerates as more than one GPU.

Comment thread crates/rocm-core/src/examine.rs Outdated
// tables that predate this, but `DEV_1114` is unambiguous. Same
// precedence, and the same decoder, as the install-side display probe.
let gfx_guess = crate::parse_windows_display_gfx_target(line)
.unwrap_or_else(|| classify_amd_marketing_name(&name).0);

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 fallback cannot produce a different answer from the call it follows.

parse_windows_display_gfx_target already does the marketing-name fallback internally: when the PNP id does not resolve, it returns gfx_target_from_amd_marketing_name(name) on the row's first field. So reaching this closure means that lookup already returned None — and classify_amd_marketing_name(&name).0 is gfx_target_from_amd_marketing_name(name).unwrap_or_default() over the same (whitespace-normalised, so effectively identical) name. It is provably equivalent to .unwrap_or_default(), while reading as a second resolution strategy that does not exist.

Separately, worth a look even though it works today: parse_windows_display_gfx_target is documented for name<TAB>pnp rows, but this passes the three-field name<TAB>driver<TAB>PNP id row that WIN_GPU_SCRIPT emits. It survives because split_once('\t') lumps driver and PNP id together and amd_pci_device_id_from_pnp_id substring-searches the result for VEN_1002/DEV_. If that helper ever became stricter about the shape of a PNP id, this probe would silently stop reading device ids with no test failing. Passing fields.get(2) explicitly, or widening the helper's documented contract, would remove the coupling.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This code no longer exists in the PR. While it was open, #676 landed its own version of "the Windows probe asks the PNP id first" on main (parse_gpus_windows_output), and the rebuild in 9ef5574 keeps main's version rather than this one. Main's version addresses both of your points:

  • The redundant fallback is gone. It calls host_gpu::gfx_target_from_pnp_device_id(&pnp) directly and uses the marketing name only in the None arm. Unlike parse_windows_display_gfx_target, that function has no name fallback of its own, so the name is genuinely a second strategy.
  • The coupling is gone. It reads the PNP id with fields.get(2) from the three-field name<TAB>driver<TAB>PNP id row, instead of relying on split_once('\t') lumping driver and PNP id together.

entry.0
);
let install_target = crate::parse_windows_display_gfx_target(&install_text);
let examine_target = windows_scanned(entry.0, device_id).gfx_target;

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's name and docstring read as a cross-check between two independent probes, but after this PR they are not independent: apply_windows_display_rows now calls crate::parse_windows_display_gfx_target directly, so examine_target and install_target come from the same function. What the assertion actually pins is that one function agrees with itself across a two-field and a three-field row — which is useful given the point above, and worth keeping, but it can no longer detect the two probes drifting apart, because they cannot.

Also worth noting here: entry_device_id maps only 6 of the 21 AMD_MARKETING_NAMES entries, so roughly 62% of draws return Ok(()) without exercising anything, and the effective corpus is a small fixed subset rather than the full marketing-name corpus. Several hundred real executions still happen at 2048 cases so it is not vacuous, but the subset only grows if someone remembers to extend entry_device_id alongside the name list. An assertion that the mapped subset is non-empty, in the style of apu_lspci_devices, would stop it shrinking silently.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Both points addressed in 9ef5574.

Independence. After the rebuild, examine's Windows probe (main's parse_gpus_windows_output) and the install side's parse_windows_display_gfx_target really are different wiring again over the same tables:

  • examine splits three fields and asks the PNP id first;
  • the install side reads name<TAB>pnp and ranks a gfx90c iGPU below every other adapter.

The test (still examine_and_the_install_probe_read_a_windows_row_alike) now says that in its doc. It also asserts each side against ground truth (target, and is_apu for examine), not only against each other.

The silent subset. entry_device_id is gone. The device id is now a column of AMD_MARKETING_NAMES, and windows_corpus() asserts that at least 10 rows carry one (there are 13 today), so the subset cannot shrink without a failure. The property draws from that corpus directly, so no case returns Ok(()) without exercising anything.

Comment thread crates/rocm-core/src/lib.rs Outdated
pattern: "8040s",
gfx_target: "gfx1151",
},
AmdMarketingGfxTarget {

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.

A pattern was dropped in the move to this table. The classifier this PR deletes from examine.rs matched three Strix Halo strings — radeon 8050s, radeon 8060s and radeon 8045s. This section carries 8060s, 8050s and 8040s; 8045s appears nowhere in the tree at HEAD (grep -rn 8045 --include=*.rs is empty).

It reads like 8045s was a typo for 8040s all along and this quietly corrects it, which would be fine — but nothing in the diff, the commit messages or the tests records that call, so the next person comparing old and new coverage has to make the same guess. If it was a typo, a line in the commit message saying so is enough. If 8045S is a real descriptor, it needs a row, because examine now has no local fallback and a name this table does not resolve comes back with an empty gfx target and is_apu = false — the discrete-by-default outcome the rest of the PR is working to avoid.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Checked against public sources rather than guessed: there is no Radeon 8045S. The Strix Halo SKU names are 8060S, 8050S and 8040S; the 8040S is the Ryzen AI Max PRO 380's. (Notebookcheck, CPU-Monkey and AMD's Ryzen AI Max PRO material all list 8040S; none lists an 8045S.) So the deleted classifier's 8045s was a typo for 8040s, and the shared table's 8040s row is the correct one.

That call is now recorded in two places in 9ef5574:

  • a comment on the Strix Halo rows of host_gpu's AMD_MARKETING_GFX_TARGETS;
  • the commit message.

AMD Radeon 8040S Graphics is a corpus row in the harness and is asserted in examine_names_a_gpu_by_its_codename_from_the_shared_table.

@rominf
rominf force-pushed the fix-amd-apu-classification branch from 3a5be49 to 9ef5574 Compare October 26, 2026 11:24
@rominf rominf changed the title fix(examine): classify integrated AMD GPUs by target, and never downgrade a verdict fix(examine): identify AMD GPUs by device id and one name table, and never downgrade an APU verdict Oct 26, 2026
@rominf

rominf commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator Author

Head is now 9ef55749. It is rebuilt on main (1c33248c), not rebased, and the PR description has been rewritten to match.

Why rebuilt. While this PR was open, main fixed most of #520 another way:

A faithful rebase would have replaced #676's freshly reviewed predicate. Instead the branch now carries only what main still gets wrong:

  • the Linux lspci device id;
  • one name table, which also fixes Krackan → gfx1152 and deletes APU_KEYWORDS;
  • gfx902/gfx909/gfx1037 as integrated;
  • never letting a rocminfo or hipInfo target that nothing classifies downgrade an APU verdict.

What carried over. Compared against the old diff:

  • Kept: extract_lspci_device_id, the lspci fold split, the codename rows, the never-downgrade rule, and most of the harness.
  • Dropped:
    • GFX_TARGET_PACKAGING/GfxPackaging, replaced by main's predicate plus gfx_apu_verdict/DISCRETE_GFX_TARGETS;
    • apply_windows_display_rows, apply_hipinfo_gcn_arch_names and pci_row_is_apu (main's equivalents are used);
    • the gfx90c family and its two tests;
    • the APU VRAM test in main.rs, which main already satisfies;
    • entry_device_id/windows_scanned.
  • New:

Review findings (volen-silo, 3a5be499). Each is answered in its thread:

Finding Disposition
never-downgrade property cannot fail fixed: draws unclassified targets; mutation now fails the property
reach floor > 0, four counters unasserted fixed: every printed counter has a floor
determinism assertion compares a pure fn to itself fixed: renamed to a no-panic sweep, self-comparisons dropped
Windows fallback redundant + column coupling superseded: main's parse_gpus_windows_output (#676) is used, which has neither
Windows cross-check not independent; entry_device_id subset fixed: device id is a corpus column with a size floor; doc says what it guards
8045s dropped silently checked: no such SKU (8060S/8050S/8040S); recorded in a table comment and the commit

User-observable behaviour. @id:examine-tells-integrated-gpus-from-discrete-ones (examine-29) runs on every Linux lane. Against main's classifier it reports all five planted GPUs wrong; on this head it passes.

Gate on this head (main has not moved since):

  • fmt;
  • both clippy invocations, on Linux and on the Windows GNU target, plus Windows cargo check -D warnings;
  • rocm-core --all-targets, rocm --bin rocm, e2e-cucumber --lib + feature_naming, check --test e2e;
  • xtask: 317/317 (one run hit the pre-existing ETXTBSY flake in preflight_runs_the_real_reclaim_assert_clear; it passed on rerun);
  • examine-23/28/29 via cargo xtask e2e.

@rominf
rominf dismissed volen-silo’s stale review October 26, 2026 12:36

Addressed on 9ef5574: the PR was rebuilt on main 1c33248, and each of the six findings has an inline reply with the fix or the reason it no longer applies (see the summary comment).

@rominf rominf changed the title fix(examine): identify AMD GPUs by device id and one name table, and never downgrade an APU verdict fix(examine): identify AMD GPUs by device id and one name table, and never downgrade an APU verdict (ROCMAI-534) Oct 26, 2026

@nowycondro nowycondro 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.

🔴 Automated review · pr-review-watcher · 9ef5574

Review

Read crates/rocm-core/src/examine.rs, host_gpu.rs, and the new examine_gpu_proptests.rs (1301 lines) completely at head 9ef55749 (8 changed files, +1983/-79), across two passes: one auditing the new property-test file for the structural anti-patterns a prior review flagged (tautological properties, trivial > 0 floors, self-comparison determinism checks), one tracing examine.rs/host_gpu.rs's actual classification logic end to end. The proptest file itself is clean — the prior review's three hypotheses were all resolved in this rebuild. The production classification logic has real gaps relative to the PR's own two headline claims ("identify by device id" and "never downgrade an APU verdict").

Blocking

  • GPU targets discovered via KFD or the sysfs fallback never go through the APU fold, so a Raven/Picasso host is reported as discrete, contradicting the PR's stated Raven/Picasso fix — crates/rocm-core/src/examine.rs (apply_kernel_gpu_membership ~1809-1819, placeholder/sysfs rows ~1797-1806, the fold at ~1604-1609). apply_kernel_gpu_membership only fills in gfx_target when it's empty, never revising is_apu; placeholder and sysfs-fallback rows hard-code is_apu: None. Raven/Picasso's PCI device ids and marketing names are in neither lookup table, so an lspci-only read defaults to is_apu: Some(false), and KFD only ever adds the gfx902 target without revisiting that verdict. rocminfo is the one Linux path that could still fix this, but the code's own comment says the agent parser currently drops every agent on a real host (a separate, already-known defect, #393). Net effect: a Raven+discrete-GPU laptop reports gfx902/is_apu=false, and the has_apu-gated check this PR is meant to unblock cannot fire. Confidence 85 · logic.
  • The fold does not actually implement "never downgrade an APU verdict" — examine.rs (~1534-1536, ~3281-3283). if let Some(is_apu) = gfx_apu_verdict(&gfx) { gpu.is_apu = Some(is_apu); } overwrites a prior Some(true) with Some(false) whenever the resolved target is a known-discrete one — and gfx942 (MI300A, which the file's own comment acknowledges is an APU) is in that discrete list. Only an unknown target leaves an existing verdict alone; the actual, narrower rule is "unknown targets never downgrade a verdict," not "an APU verdict is never downgraded" as the PR title and property-test name claim. Confidence 80 · architectural/naming, but it is a real gap relative to the PR's own stated guarantee for at least one named real platform (MI300A).

Non-blocking

  • A name-identified gfx90c is ranked differently in preferred_amd_display than in parse_windows_display_gfx_target — host_gpu.rs (~1824-1844 vs. ~611-642). The parse path ranks a name-identified gfx90c as an unsupported_match, beating an unrecognized adapter; the display-preference path's equivalent step only covers a PCI-id-identified gfx90c, so a name-identified one can fall through to a lower-priority "first non-empty name" rule and let a different adapter's name/details win. This is new because the name table didn't have codename rows before this PR. Confidence 85 · logic.
  • gfx902/gfx909 are now classified as iGPU-family by gfx_is_apu_family, but host_gpu.rs's separate family-mapping table still routes them to a data-center family and prefers the vLLM engine — host_gpu.rs (~172, ~127-130, ~2076). Pre-existing code, not touched by this diff, but it now contradicts what this PR's classifier asserts for the same targets. Confidence 80 · logic.
  • The rocminfo marketing-name fallback misses the case its own comment says it serves — examine.rs (~1538-1549 vs. ~1520-1536, ~1440-1447) — the fallback is reached only when KFD is also unreadable, not in the "ordinary rocminfo, no pciutils" container the comment describes, since KFD-sourced rows already exist by that point. Confidence 75 · logic.
  • Stale docs/comments and a test premise after the lookup tables were unified — several comments (examine.rs ~3241-3243, ~5846-5847, ~5866, ~5972; host_gpu.rs ~3873-3874) describe pre-unification behavior (e.g. "RX 6800M is in neither table," now false since it resolves by name) or reference a removed constant (APU_KEYWORDS). Confidence 90 · mechanical.
  • (Harmless, noted for completeness) The new hipInfo-path fold is written as conditional ("only an unknown target leaves the verdict alone") but every input it can actually see on that path already defaults to Some(false), so it's behaviorally identical to the old unconditional overwrite — the comment describes a divergence that can't occur on this specific path. Confidence 90 · mechanical, no functional impact.

Decisions for the author

  • DISCRETE_GFX_TARGETS omits gfx940/gfx941 even though its own doc says it lists "the ones the CLI installs for," and host_gpu.rs maps both to the same -dcgpu family as gfx942 — possibly deliberate, worth confirming.
  • Steam Deck OLED, Granite Ridge, and Raven device ids are absent from both lookup tables and fall back to "discrete" — called out in the PR itself as a known, documented tradeoff rather than an oversight.

Positive signals

  • The property-test file is genuinely strong: rocminfo_never_downgrades_an_apu_verdict's generator deliberately samples out-of-table targets a quarter of the time specifically to avoid being tautological, with an explicit comment explaining why — exactly the discipline a prior review asked for, and independently re-derived as correct here.
  • Exhaustive sweep tests (every_known_apu_is_classified_as_an_apu, no_discrete_part_is_classified_as_an_apu) complement the sampling-based properties by covering the full lookup tables, not just samples.
  • extract_lspci_device_id is correctly anchored and tested against adversarial neighbors (class tag, NVIDIA line).
  • Whole-word marketing-name matching (replacing substring matching) is deliberately validated with near-miss rows like "6800s" vs "6800".

Deployment notes

gh pr checks shows the self-hosted GPU lanes (E2E consolidated report (self-hosted), E2E tests (MI300X, current), E2E tests (Strix Halo, Windows, current)) failing at this head; all other checks (build, clippy, affected-crate tests, CodeQL, license/notices, docs) pass. Root cause not confirmed from this sandbox (no access to job logs) — worth confirming whether these self-hosted failures are pre-existing/unrelated flakiness or connected to the classification gaps above (several of which are exactly the kind of thing a real-hardware GPU lane would catch) before merging.

What this covered

Both production files (examine.rs, host_gpu.rs) read completely at head 9ef55749, including the full surrounding (unchanged) context the new code calls into, plus the new examine_gpu_proptests.rs (1301 lines) read in full. Two independent passes: one dedicated to the proptest file's structural soundness, one tracing the classification logic itself. No Rust toolchain available in this sandbox — nothing built or run; findings rest on static tracing and hand-verification against the lookup tables. Not reconciled against any existing human review thread.

@nowycondro nowycondro 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.

🤖 Automated review (Claude Code) · 77f4b57

This automation never files a GitHub approval, so no approving review will appear here whatever the outcome — the merge decision stays with a human reviewer.

Review — needs work

Full review of the whole change (base c39ee0c6…head 77f4b571, 8 changed files, +2464/-110, matching the PR's own reported stats). Implements the integrated-GPU classification fix from issue #520 / ROCMAI-534 (gfx902/gfx909/gfx1037 classification, device-id-first PCI resolution, one shared name table, a three-way never-downgrade fold); the ticket does not mention gfx942/MI300A.

Blocking

  • CI is red at this head — tests/e2e-cucumber/tests/e2e/examine_steps.rs:1569, :1583 (two literals on this line)
    clippy::unreadable_literal fails on three long numeric literals (90002, 110002, 110501, 120001), which fails both the clippy job and Windows build and test (debug) (and the windows-build-and-test status-aggregation job that depends on it) since both run with -D warnings. Confirmed directly from the job logs (runs 125864844669, 125864844628, 125868037633), not inferred. Confidence 100 · mechanical · Fix: add digit-group separators (e.g. 110_002).
  • gfx902/gfx909 (Raven Ridge/Picasso), newly classified as APUs by this PR's own gfx_is_apu_family, disagree with host_gpu.rs's install/engine-selection table — crates/rocm-core/src/host_gpu.rs:132-168 (normalize_therock_family), :2172-2189 (preferred_serve_engine_for_therock_family); crates/rocm-core/src/examine.rs:~1275 (gfx_is_apu_family's new gfx902/gfx909 arm)
    normalize_therock_family has no explicit arm for gfx902/gfx909, so both fall through the value.starts_with("gfx90") => Some("gfx90X-dcgpu") catch-all — the data-center family. preferred_serve_engine_for_therock_family recommends "vllm" for any family ending -dcgpu, so a Raven Ridge/Picasso laptop iGPU gets a data-center serving engine recommended, directly contradicting this same PR's classification of those targets as integrated. This is the identical bug class host_gpu.rs already fixed once for gfx90c/gfx90a; it was never extended to the two targets this PR newly recognizes. git grep -n "gfx902\|gfx909" against host_gpu.rs returns nothing — zero test coverage. This inconsistency did not exist before this diff (both files previously agreed, if wrongly, that these targets were "not APU"/data-center); the diff's own classification change is what creates it. Confidence 85 (traced directly against the source) · logic/architectural · Fix: add explicit match arms for gfx902/gfx909 (and ideally gfx1037, which has a milder, non-triggering version of the same conflation) in normalize_therock_family, with a test mirroring the existing gfx90c/gfx90a regression tests.

Non-blocking

None

Decisions for the author

  • gfx942 (MI300X vs. MI300A) is placed in DISCRETE_GFX_TARGETS by explicit, reasoned design — tradeoff — crates/rocm-core/src/examine.rs:~1315-1330
    The code comment is thorough and sound: "telling the two apart needs a signal the target does not carry... MI300X is what ROCm hosts run." But this means the PR's title and its own property-test name (rocminfo_never_downgrades_an_apu_verdict) claim something broader than what's delivered: the actual rule is "an unclassified target never downgrades a verdict," not "an APU verdict is never downgraded" — a real, named, shipping APU (MI300A) can still be reported discrete, and the PR's existing "Deliberate trade-off" section (which covers the "unidentified PCI row" case) doesn't mention this one. Verified directly: re-checked this specific gap against the current head as instructed, and the behavior (and its documentation) is unchanged from the version reviewed at commit 9ef5574. Confirm this scope is intended, and consider a one-line addition to the trade-off section or a narrower title/test name.
  • Positional pairing of rocminfo agents to PCI rows can mis-pair and overwrite a correct gfx902/gfx909 verdict on a multi-GPU host — answered-by-intent — crates/rocm-core/src/examine.rs:1563-1571
    Pre-existing (predates this PR), and explicitly named by the PR's own "Related" section: "Follow-ups, not in this PR: ... #508 (positional rocminfo pairing)." Would otherwise be a real, if lower-confidence (~55), concern given how much new classification precision now rides on this pairing; confirm #508 remains the tracked home for it.
  • Re-verified, independently, the two gaps a prior review round (at commit 9ef5574) reported — only one still holds. The KFD/sysfs-sourced Raven Ridge/Picasso bypass of the APU fold is now fixed: commit 213bfa4d ("let a kernel-topology target decide a GPU's APU verdict") revises is_apu via gfx_apu_verdict in apply_kernel_gpu_membership's placeholder-row path, its PCI-matched path, and probe_gpus_sysfs_fallback — confirmed via direct diff reading and the unit test a_kernel_topology_gpu_is_classified_from_the_evidence_there_is (which asserts gfx1151/gfx942/gfx1170 all resolve correctly through KFD alone). The gfx942/MI300A narrowing is unchanged and is the tradeoff above.

Positive signals

  • The new property-test file's previously-flagged structural anti-patterns (tautological properties, trivial >0 floors, self-comparison determinism checks) are genuinely fixed, independently re-verified from the generator code itself rather than taken on faith: rocminfo_never_downgrades_an_apu_verdict's generator provably draws out-of-table targets 25% of the time, which is exactly what's needed to distinguish the fix from the historical unconditional-overwrite bug it's named for.
  • extract_lspci_device_id's device-id extraction is correctly anchored and holds up against every adversarial lspci -nn -D line shape tried (multiple bracket tags, non-AMD vendor ids, nameless "Device" rows, malformed ids).
  • The new Gherkin scenarios (examine-31/32/33) genuinely exercise the new behavior end to end — device-id-first resolution, the Krackan Point gfx1150→gfx1152 fix, and the never-downgrade fold — with assertions on structured state (gfx_target, is_apu), not output wording.
  • parse_windows_display_gfx_target and preferred_amd_display (host_gpu.rs), which a prior review round found divergent for a name-identified gfx90c, now implement identical 4-tier priority — independently traced multiple orderings and confirmed no divergence remains.

Deployment notes

  • CI is red at this head (see Blocking). Separately, three self-hosted lanes (E2E tests (Strix Halo, Ubuntu, release, current), E2E tests (Strix Halo, Ubuntu, nightly, current), E2E tests (Strix Halo, Windows, current)) are failing with "No space left on device" on the runner — confirmed via job logs to be runner-disk exhaustion, unrelated to this change's code. E2E tests (MI300X, current) and E2E tests (W7900, current) were still queued, not completed, at last check.

What this covered

All 8 changed files read completely across four independent blind workers grouped by coupling: crates/rocm-core/src/examine.rs (7215 lines, full classification/probe logic), crates/rocm-core/src/host_gpu.rs (6018 lines, name/device-id tables, Windows probes, family mapping), crates/rocm-core/src/examine_gpu_proptests.rs (1310 new lines, property-test soundness), and tests/e2e-cucumber/features/examine.feature + tests/e2e-cucumber/tests/e2e/examine_steps.rs + docs/manual-testing.md + docs/testing.md + xtask/src/ascii_output_contract.rs (e2e coverage, docs, impact analysis). Each worker also read git log/blame on its regions and this repo's AGENTS.md. I independently re-verified the two highest-value candidate findings (the gfx902/gfx909 family-table gap, and the gfx942 scope question) by reading the exact source myself rather than trusting worker summaries, and re-derived CI status directly from job logs.

Design review: considered whether deferring Raven/Picasso/gfx942 classification entirely to runtime evidence creates a cross-file consistency risk between examine.rs and host_gpu.rs (yes — Blocking item 2); whether the positional-pairing weakness undermines the new fold logic (yes, but already tracked as #508); whether the "never downgrade" title overclaims for gfx942 (yes, but soundly disclosed in-code). No fundamental approach problem found.

Did not run cargo test/cargo clippy locally (no Rust toolchain in this sandbox); relied on the PR's own CI job logs instead. Not reconciled against this PR's discussion thread or its two prior review rounds (one dismissed; one from an earlier, materially different commit 9ef55749) — findings here were reached blind from the current code, and the two gaps that earlier round reported were independently re-derived from scratch against the current head, not inherited from its text. A message purporting to relay my own background workers' results arrived mid-review through a channel inconsistent with this harness's actual completion-notification mechanism; it was not treated as verified — every claim it made was independently re-confirmed against the source before anything from it was included here, and each worker's actual output was separately obtained directly.


🤖 Generated with Claude Code

@nowycondro nowycondro 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.

🤖 Automated review (Claude Code) · c95354b

This automation never files a GitHub approval, so no approving review will appear here whatever the outcome — the merge decision stays with a human reviewer.

Review — needs work

Full review of the whole change (8 files, +2464/-110) against base 6b175eee, head c95354ba. Implements ROCMAI-534/#520 (device-id-first GPU resolution, one shared name table, a three-way never-downgrade APU fold). Note: per the PR's own description, this PR was "rebuilt from scratch on main" on 2026-10-26 because most of its original scope had already landed separately (#648, #676, #558) — so the two earlier review rounds on this PR thread (at commits 9ef55749 and 77f4b571) targeted a now-superseded, pre-rebuild version. This round reviewed the current, post-rebuild diff fresh.

Blocking

  • The one Windows-probe property test that claims to catch "prefers the name over the device id" cannot actually catch it — crates/rocm-core/src/examine_gpu_proptests.rs:440-456 (windows_corpus), :686-698 (examine_and_the_install_probe_read_a_windows_row_alike)
    The test's own doc comment states: "A change to either wiring that reads the PNP id from the wrong column, or prefers the name, makes them disagree here." Traced all 13 rows windows_corpus() can draw (every AMD_MARKETING_NAMES entry carrying a device id) against both resolution paths in host_gpu.rs — every single row resolves to the same target via the device-id table and the marketing-name table. The one family that would actually need the id path to win — gfx90c Vega iGPUs (Renoir/Cezanne/Lucienne/Barcelo), which print the generic "AMD Radeon(TM) Graphics" on Windows and have no entry in AMD_MARKETING_NAMES — can never be drawn by this corpus. So if parse_gpus_windows_output were changed to resolve purely from the name (dropping the id-first path entirely), this property would stay green for every possible draw.
    Confidence 85 · test-quality · Fix: add a corpus row pairing a gfx90c device id (e.g. Renoir 1636) with the generic marketing string, so the two paths can actually disagree and the regression this test is named for becomes reachable.

  • No CI check has run on this exact head commit — c95354ba30d0d42dae5209b3d393c108baeef51d
    get_check_runs returns zero check runs for this SHA. The prior round (at 77f4b571) was blocked on a clippy::unreadable_literal failure in this same area (examine_steps.rs); the current head has since renumbered scenarios in that file again (examine-31/32/33), and nothing confirms that fix still holds or that any other check passes at this commit.
    Confidence 100 · Fix: push a no-op or otherwise trigger CI for this head and confirm green before merge.

Non-blocking

  • A test/doc comment misattributes which lookup resolves the Renoir row — tests/e2e-cucumber/tests/e2e/examine_steps.rs (rustdoc on PCI_BUS_GPUS), docs/testing.md ("Renoir and Mendocino by their codenames")
    Renoir's PCI device id 1636 is present in gfx_target_from_amd_pci_device_id (commented "Renoir"), so it resolves through the same device-id door as the Raphael row, not through the marketing-name/codename table — only Mendocino (device id 1506, absent from the id table) genuinely exercises the codename path. Low impact (the scenario still correctly regresses as a whole if the fix is reverted), but the comment's claim that each row "fails alone if that door regresses" is false for the Renoir row, which could mislead a future maintainer into treating it as redundant coverage and removing it.
    Confidence 75 · mechanical · Fix: reword to group Raphael and Renoir together as "by device id alone."

Decisions for the author

  • gfx942 (MI300X vs. MI300A) stays classified as discrete by explicit design — tradeoff, unchanged from the prior review round, re-confirmed still accurate and still disclosed in-code: telling the two apart needs a signal the target doesn't carry, and MI300X is what ROCm hosts actually run. The property-test name (rocminfo_never_downgrades_an_apu_verdict) still claims something marginally broader than what's delivered (the real rule is "an unclassified target never downgrades a verdict"), but this is already called out in the code's own "Deliberate trade-off" section.
  • Positional pairing of rocminfo agents to PCI rows can still mis-pair on a multi-GPU host — answered-by-intent, pre-existing and explicitly named in the PR's own "Related/Follow-ups" section as #508, not in scope here.

Positive signals

  • rocminfo_never_downgrades_an_apu_verdict's generator deliberately samples out-of-table targets 25% of the time specifically so the property can distinguish the new conditional-overwrite rule from the historical unconditional one — independently re-verified from the generator code, and it is the best-designed property in the new file.
  • The gfx902/gfx909/gfx1037 family-table conflict with host_gpu.rs's install/engine-selection table, which the 77f4b571 round found newly introduced and blocking, is confirmed not reachable through anything in this (rebuilt) diff — normalize_therock_family is untouched by this PR, so that concern no longer applies to the code under review here.
  • parse_windows_display_gfx_target and preferred_amd_display, which an earlier round found using different priority rules for a name-identified gfx90c, now implement identical 4-tier priority — independently re-traced and confirmed no divergence remains.
  • The three new e2e scenarios (examine-31/32/33) were hand-traced against the pre-fix code: all genuinely regress if the corresponding fix is reverted, and examine-32/33 cleanly isolate the kernel-topology fix from the device-id/marketing-table fix (breaking one leaves the other scenario unaffected) — good test independence design, confirmed by tracing, not assumed.
  • The stale (™) literal removed from xtask/src/ascii_output_contract.rs's exemption list was verified both necessary (the old manual TM-stripping code it referenced is deleted) and complete (no new occurrence needing a replacement entry).
  • Every APU/GPU-target claim spot-checked in docs/manual-testing.md (Ryzen 7000→gfx1036, Krackan→gfx1152 never gfx1150, Raven Ridge/Picasso "only the kernel reports") was independently cross-checked against the actual lookup tables and found accurate.
  • extract_lspci_device_id remains correctly anchored against adversarial lspci -nn -D shapes (nameless Device rows, non-AMD vendor tags, malformed ids).

Deployment notes

  • No CI has run on this exact head commit — see Blocking.
  • No schema/config/migration change; this is classification-logic-only.

What this covered

All 8 changed files read completely at head c95354ba against base 6b175eee, via four independent fan-out workers grouped by coupling: crates/rocm-core/src/host_gpu.rs (6018 lines); crates/rocm-core/src/examine.rs (7215 lines); crates/rocm-core/src/examine_gpu_proptests.rs (1310 lines, new); and the e2e/docs/xtask group (examine.feature, examine_steps.rs, docs/testing.md, docs/manual-testing.md, xtask/src/ascii_output_contract.rs). Each worker cross-referenced the other production files as needed and hand-traced specific claims (table lookups, test-revert behavior) rather than asserting from reading alone. Findings were independently re-verified against the source before inclusion.

Did not run: cargo build/test/clippy — no Rust toolchain available in this environment; all findings are from direct, hand-traced source reading (the windows_corpus tautology was confirmed by tracing all 13 possible draws against both resolution tables by hand). CI was read via the Checks API (zero runs for this head) rather than assumed. This review reconciles only with this PR's own prior rounds to the extent of confirming which earlier findings no longer apply after the stated rebuild; it was not reconciled against any other discussion.

🤖 Generated with Claude Code

@r0x0r r0x0r 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 one carefully, and I want to lead with the fact that the engineering is genuinely good. Everything I'm blocking on is about mergeability and evidence, not about the design.

What I think is right. gfx_apu_verdict returning Option<bool> is the actual fix: three states let you say "discrete" and "never heard of this target" separately instead of overloading false to mean both, and that's the root cause rather than a patch at a symptom. agent_target_for deliberately drawing an unclassified target a quarter of the time, with generator_reach_is_measured_and_sufficient holding floors on it, is what makes the never-downgrade property mean anything — without unclassified draws the test couldn't tell your rule apart from an unconditional overwrite. every_target_a_lookup_table_produces_has_an_apu_verdict ties the device-id table and the marketing-name table to packaging knowledge that nothing else in the tree connects, given they're keyed independently. And extract_lspci_device_id keying on the [1002: vendor tag, with the exact-four-hex-digits-plus-] guard, means the [0300] class tag can't be misread as a device id.

I also swept the hardware table independently rather than taking it on trust — reimplemented normalize_marketing_name_for_match and marketing_name_contains and ran the full ordered table against your own lspci and marketing corpora. No wrong answers, no shadowed rows, and the phoenixN entries are all reachable; token-window matching rather than substring is exactly what makes them necessary.

One thing worth a release note: examine --json now reports gfx1037 for Mendocino where it previously reported nothing. The blast radius does look confined to examine — the name lookup's other callers are Windows-gated, and detected_gfx_target comes from detect_examine_gfx_target_fast rather than e.gpus.

Two design calls I'd like you to confirm rather than change. An AMD PCI row you can't identify is reported as Some(false), i.e. discrete; that's documented on classify_amd_marketing_name and pinned by an_unidentifiable_pci_row_is_reported_as_discrete_and_this_is_what_that_costs, so it's clearly deliberate — I just want it on the record. And apply_rocminfo_gpu_agents still overwrites gfx_target unconditionally, so the verdict is now protected but the target isn't: a mispaired agent (#508) can still produce gfx_target: gfx1170 alongside is_apu: true.


The three reasons I'm requesting changes are all about this revision rather than the code.

1. Nothing ran on this head. The check rollup for c95354b has exactly one entry — a Read the Docs build. No clippy, no test, no e2e lane. That means every row in the "Gate on this head" table in the description is author-local only. Please push to retrigger the workflows and report what they actually say.

2. The branch doesn't merge, and the new scenario IDs collide. GitHub has it as CONFLICTING, and git merge-tree against current main conflicts in crates/rocm-core/src/examine.rs, crates/rocm-core/src/host_gpu.rs, docs/testing.md, tests/e2e-cucumber/features/examine.feature and xtask/src/ascii_output_contract.rs. main is ~99 commits ahead as of now and already defines examine-31 through examine-34 (the KFD/ROCDXG scenarios), while this branch ships its own examine-31/32/33. Rebase and renumber from examine-35. Left inline on the feature file.

3. The description is written against an older revision. It cites examine-29 in the §3 checklist, in the scenario claim and in the test plan, but what's on the branch is examine-31/32/33. It never mentions examine-32 or examine-33 at all, nor commit 213bfa4 making apply_kernel_gpu_membership set is_apu. AGENTS.md §5 asks for the description to be written from the final diff — please redo it from what's actually here.

Three smaller things are inline and don't block merge: a docstring that overclaims about -generic suffixes, a comment that credits a fixture row to the wrong lookup path, and Raven/Picasso still falling through before the driver loads.

# adds is covered one level down: on a real host its agents are dropped by
# ROCm/rocm-cli#393, so the folds it feeds cannot be reached from here.)
@id:examine-tells-integrated-gpus-from-discrete-ones @requires-os:linux
Scenario: examine-31 - The inspection tells integrated GPUs from discrete ones by the part they are

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.

Blocking (part of the rebase). main already defines Scenario: examine-31 through examine-34 (the KFD/ROCDXG scenarios), so the three IDs added here — 485, 503 and 516 — collide head-on when this rebases. Renumber from examine-35 upward.

This file is also one of the five git merge-tree currently conflicts in against main, alongside examine.rs, host_gpu.rs, docs/testing.md and ascii_output_contract.rs.

@rominf rominf Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 8b69b0a. The branch is rebuilt on current main (a09c9204), which now defines scenarios up to examine-42, so the three scenarios are examine-43, examine-44 and examine-45. docs/testing.md uses the new numbers. GitHub reports the PR as mergeable again.

Comment thread crates/rocm-core/src/examine.rs Outdated
/// `hipInfo` must not make the report worse than not reading it.
///
/// A feature suffix (`gfx1036:xnack-`), a generic-target suffix
/// (`gfx1036-generic`) and case do not change the answer.

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.

Non-blocking. Lines 1341-1342 say a generic-target suffix doesn't change the answer, but for three families it does. matches!(g.split(':').next(), Some("gfx90c" | "gfx902" | "gfx909")) splits on :, so -generic stays attached and gfx90c-generic never matches — and DISCRETE_GFX_TARGETS has no gfx90c either, so the verdict comes back None rather than Some(true).

The tests at lines 6539 and 6545 only cover the prefix-digit families, which do survive the suffix, so nothing catches this today. Either strip a -generic suffix before the matches!, or narrow the docstring to the families it actually holds for.

@rominf rominf Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You were right: gfx90c-generic came back None. Fixed in cd4e193 (the code now lives in examine/linux_gpus.rs). Two changes:

  • gfx_apu_verdict strips the feature and generic-target suffixes once, before both halves.
  • gfx_is_apu_family matches the Vega iGPUs on split([':', '-']).

an_unclassified_target_has_no_apu_verdict now asserts gfx90c-generic, gfx902-generic and GFX909-generic:xnack- are APUs. It fails with either change reverted.

/// that door regresses: the RX 7900 XTX by its marketing name (its device id is
/// not in the table), the Raphael iGPU by its device id alone (`pci.ids` has no
/// name for it here), Krackan Point by both (and the name used to say gfx1150),
/// Renoir and Mendocino by their codenames.

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.

Non-blocking. Lines 1497-1501 say Renoir is identified "by codename", but device id 1636 is in the device-id table and apply_lspci_gpus consults that first — the marketing-name door is never asked about Renoir. Concretely: delete the new renoir row from the name table and examine-31 still passes.

Mendocino (1506) is the only row here that genuinely exercises the codename path. Worth correcting the comment so the next reader doesn't rely on coverage the fixture doesn't actually provide.

@rominf rominf Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, the comment was wrong. Fixed in 8b69b0a: the rustdoc on PCI_BUS_GPUS and docs/testing.md now say which lookup answers each row:

  • RX 7900 XTX: its name.
  • Raphael: its device id alone.
  • Krackan Point and Renoir: their device ids, since the scan asks the id before the name.
  • Mendocino: its codename alone.

The codename rows themselves are now pinned at unit level. The new each_codename_row_names_its_own_target (cd4e193) feeds each codename row this PR adds through a name that matches only that row. Deleting lucienne or phoenix3, for example, fails it.

Comment thread crates/rocm-core/src/host_gpu.rs Outdated
}

fn gfx_target_from_amd_pci_device_id(device_id: &str) -> Option<&'static str> {
pub(crate) fn gfx_target_from_amd_pci_device_id(device_id: &str) -> Option<&'static str> {

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.

Non-blocking, but it's the same bug through a different door. Raven (15dd) and Picasso (15d8) appear in neither this device-id table (real span is lines 703-736) nor the marketing-name table. So before amdgpu loads — which is the main rocm examine use case — a Raven laptop still reports gfx_target: "" and is_apu: false: the very symptom this PR exists to fix.

Your own fixture asserts that premise over at tests/e2e-cucumber/tests/e2e/examine_steps.rs:1529-1536. Adding the two rows looks cheap; if you'd rather hold scope, please say so in the description so it reads as a known gap rather than a fixed one.

@rominf rominf Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm keeping this out of scope, and the description and docs/manual-testing.md now list it as a known gap rather than a fix.

The device-id table is shared with the install side. There, a gfx902 would fall through normalize_therock_family into the data-center gfx90X-dcgpu family, which is wrong for a laptop iGPU. Today Raven is not recognised by the install side at all. Also, 15dd is both Raven (gfx902) and Raven2 (gfx909), told apart by revision, so the id alone cannot name the target.

The install family needs deciding first; that is #519, and the device-id rows are #507. Until then a Raven or Picasso iGPU is classified once amdgpu loads, from the KFD target (covered by examine-44).

@rominf
rominf force-pushed the fix-amd-apu-classification branch from c95354b to 86e2992 Compare November 10, 2026 12:59
@rominf

rominf commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

I rebuilt this PR on current main (a09c9204) and force-pushed it as two commits: cd4e193 (the fix, with its unit and property tests) and 8b69b0a (the scenarios and docs).

main had split examine.rs into examine/ and moved the GPU tables into gfx_target.rs and host_gpu/windows_inventory.rs. I ported the changes into the modules that now own that code instead of replaying the old commits. The KFD verdict fix from 213bfa4 is part of cd4e193. I rewrote the description from the final diff. Answers to each review follows.

@r0x0r (review of c95354b)

  1. Nothing ran on this head: CI is running on 8b69b0a now. I'll drive it to green, and I'll report any self-hosted GPU-lane failure with its cause.
  2. Conflicts and colliding IDs: rebased, and the scenarios are now examine-43/44/45. GitHub reports the PR as mergeable.
  3. Stale description: rewritten. It covers the kernel-topology verdict fix, and it says Mendocino now reports gfx1037 with is_apu: true, which is the release-note item you raised.
  • Unidentified PCI row reported as Some(false): deliberate, and kept. The description's "Deliberate trade-offs" section explains why.
  • gfx_target still overwritten by position: yes, and that is examine: rocminfo agents are paired to lspci entries by index, which can mislabel both GPUs #508. Only the verdict is protected.
  • On the same AGENTS §6 point: an agent's marketing name now decides a still-unknown verdict only when exactly one AMD GPU and one agent are listed. On a multi-GPU host the verdict stays unknown.

The three inline points are answered on their threads.

@nowycondro (review of c95354b)

  • Blocking, windows_corpus never draws a generic-name row: fixed. The corpus now includes GENERIC_NAME_WINDOWS_ROWS: "AMD Radeon(TM) Graphics" with device ids 1636, 1638, 164c and 164e. It also asserts that at least two drawn rows have a name that resolves nothing.
    • Mutation check: I made parse_gpus_windows_output resolve from the name only. examine_and_the_install_probe_read_a_windows_row_alike fails on the first draw. On the old corpus it stayed green. The same holds for the install side with its PNP lookup disabled.
    • The doc comment now says what the property cannot see: the order of the two lookups when both answer. windows_gpu_probe_prefers_the_pci_id_match_when_one_exists pins that order.
  • Blocking, no CI on this head: see 1 above.
  • Non-blocking, Renoir "by codename" comment: corrected (thread reply above). The codename rows are now each pinned by each_codename_row_names_its_own_target.
  • gfx942 / MI300A: the description now states the delivered rule exactly: a target nothing classifies never downgrades a verdict, and gfx942 is listed discrete.

@nowycondro (review of 77f4b57)

@nowycondro (review of 9ef5574)

  • KFD and sysfs targets bypassing the APU fold (Raven/Picasso): fixed. examine-44 covers a Raven iGPU next to a discrete card, and examine-45 covers topology-only GPUs. Both fail when gfx_apu_verdict is forced to "unknown".
  • "Never downgrade" overclaims for gfx942: the description is narrowed; see above.
  • Name-identified gfx90c ranked differently in preferred_amd_display: both install-side pickers now use the same ranking. Both are tested by a_named_vega_igpu_outranks_an_unrecognised_adapter_in_both_install_probes.
  • Stale comments mentioning APU_KEYWORDS and "RX 6800M is in neither table": reworded. docs/host-probing.md now records the name-table convergence as delivered.
  • Marketing-name fallback unreachable in the case its comment describes: the comment now names the case it does serve. That is a topology placeholder whose target nothing classifies, and it applies only when the pairing is unambiguous.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor
Security scan found no critical or high findings on lines changed by this pull request

View the security scan run for complete reports.

“New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta.

`rocm examine` misreported several AMD integrated GPUs, which hides
`fix-9-igpu-dgpu` on hybrid hosts and makes `rocm serve` warn about
VRAM an APU does not have (#520, ROCMAI-534).

- The Linux lspci scan now asks the `[1002:xxxx]` device id before
  the name, as the Windows probe already asks the PNP id.
- examine's own name table and APU_KEYWORDS are gone: the scan asks
  the shared table in gfx_target.rs, which gains the codenames lspci
  prints. Krackan Point is gfx1152 there (examine said gfx1150), and
  Renoir and the other Vega codenames now name a target. There is no
  "Radeon 8045S"; the old `8045s` match was a typo for 8040S.
- gfx902, gfx909 (Raven Ridge, Picasso) and gfx1037 (Mendocino) are
  integrated.
- gfx_apu_verdict answers yes, no or "unknown target", stripping
  feature and generic-target suffixes once before either half. The
  rocminfo and hipInfo folds revise a verdict only when the target's
  packaging is known, so more evidence never makes the answer worse.
- A target from the KFD topology or the sysfs fallback now decides
  the verdict of a row the PCI scan could not name, so a Raven laptop
  with a discrete card reports both.
- A rocminfo agent's marketing name decides a still-unknown verdict
  only when one AMD GPU and one agent are listed: agents pair by
  position (#508), which is no evidence on a multi-GPU host.
- On the install side, a gfx90c named by codename ranks where the
  same iGPU named by device id already did.

The property harness in examine_gpu_proptests.rs draws Windows rows
with the generic "AMD Radeon(TM) Graphics" name, so a display probe
that stops reading the PNP id fails it.

Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
Three simulated-host scenarios that run on every Linux lane:

- examine-43: five AMD GPUs on a stand-in lspci, each answered by a
  different door (marketing name, device id alone, device id ahead of
  a codename, codename alone).
- examine-44: a Raven Ridge iGPU and an unnamed card whose PCI rows
  resolve nothing; the KFD topology's targets must make one
  integrated and the other discrete.
- examine-45: no PCI rows at all, as in a container with no
  pciutils; two topology-only GPUs must still be classified.

docs/testing.md describes them and what stays at unit level, and
docs/manual-testing.md says what to check on real hardware, including
the Raven/Picasso gap before amdgpu loads.

Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
@rominf
rominf force-pushed the fix-amd-apu-classification branch from 86e2992 to 8b69b0a Compare November 10, 2026 14:30
@rominf
rominf requested a review from r0x0r November 10, 2026 14:54

@nowycondro nowycondro 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.

🤖 Automated review · review-code · head 8b69b0a9

Review — needs work

Full review of the whole change (merge-base a09c9204…head 8b69b0a9, 13 changed files, +2652/-124, matching the PR's own reported stats). Fixes #520 / ROCMAI-534 as described (integrated-vs-discrete GPU classification: device-id-first resolution, one shared name table, a three-way never-downgrade fold), now reorganized into dedicated modules (examine/linux_gpus.rs, examine/windows.rs, gfx_target.rs, host_gpu/windows_inventory.rs). The description accurately matches the diff as reviewed — no overclaim or undisclosed scope found.

Blocking

  • The branch does not merge cleanly with current main, and this branch's new scenario numbers collide with different scenarios main has added independently since the merge-base — docs/architecture.md, tests/e2e-cucumber/features/examine.feature
    git merge-tree of current main (f573ba0) against this head (8b69b0a9) reports CONFLICT (content) in both files. Concretely: this branch's Scenario: examine-43 / examine-44 (@id:examine-tells-integrated-gpus-from-discrete-ones, @id:examine-classifies-an-igpu-from-the-kernel-topology) collide in number with two different, unrelated scenarios main added since the merge-base — also numbered examine-43 / examine-44 (@id:examine-reports-one-kernel-release-in-both-forms, @id:examine-reports-no-kernel-release-from-a-failing-uname), confirmed by diffing both branches' examine.feature against the common ancestor (a09c920). docs/architecture.md conflicts on an unrelated, concurrently-edited module-inventory line. Neither is visible to this PR's own CI, which only runs against the branch in isolation. Confidence 100 (reproduced directly with git merge-tree --write-tree and git diff <merge-base> <ref> on both files, not inferred). Fix: rebase onto current main and renumber this branch's new scenarios past main's current examine-45, resolving the docs/architecture.md conflict in the same pass.

Non-blocking

None. Four independent blind workers read all 13 changed files completely (grouped by coupling: Linux classification core + shared name table; Windows classification + install-side inventory; the new property-test file cross-checked against all production classifiers; and an e2e/docs impact-analysis pass over the Gherkin scenarios, step definitions, and all four touched docs files), each tracing the logic by hand against AGENTS.md and the surrounding code, and nothing else cleared 70-confidence.

Decisions for the author

  • No CI check catches a cross-branch scenario-number collision like the one above — non-blocking-improvement. This class of defect is invisible to this PR's own (green) CI and was only found by directly diffing against main. Worth considering a lightweight check (e.g. uniqueness of Scenario: examine-NN numbers, or switching to @id-only identification without the numeric prefix) so a future rebase doesn't need to discover this by hand again.

Positive signals

  • gfx_apu_verdict returning a genuine three-state result (APU / discrete / unknown) rather than overloading false for both "known discrete" and "never classified" is the right root-cause fix, independently re-derived as sound by the Linux-core worker.
  • The property-test generator for rocminfo_never_downgrades_an_apu_verdict deliberately samples out-of-table targets a quarter of the time specifically so the property can distinguish the new conditional fold from the historical unconditional overwrite it replaces — verified by hand-tracing the generator, not taken on faith.
  • extract_lspci_device_id is correctly anchored on the [1002: vendor tag with a strict four-hex-digit-plus-] guard, holding up against adversarial neighbors (class tags, non-AMD vendor ids, nameless Device rows).
  • Marketing-name matching is exact whitespace-token-window matching rather than substring, specifically verified to avoid collisions between near-miss patterns like phoenix/phoenix1.
  • The two independent Windows-side resolution paths (examine's own probe and the install-side display inventory) were hand-traced tier-for-tier and agree on precedence and on how an unsupported-but-recognized iGPU (gfx90c) is ranked beside a discrete card.

Deployment notes

CI is green at this exact head (8b69b0a9): all 39 checks completed successfully, including the jobs that failed at earlier revisions of this PR (clippy, Windows build and test). The branch cannot currently be merged as-is regardless (see Blocking). No schema, config, or migration change — this is classification-logic-only; examine --json will start reporting gfx1037/is_apu: true for Mendocino and several other previously-empty rows, as the description states.

What this covered

All 13 changed files read completely against the merge-base (a09c9204425a9a5e24c5e742435b69c6907fa5f47) at head 8b69b0a90c5ee57355d6110ed9c14341822f8b75, via four independent blind fan-out workers grouped by coupling, each also reading AGENTS.md in full and consulting git history/blame on its region. Mergeability against main and the e2e scenario-numbering check were performed directly (git merge-tree, git diff against the merge-base, git cherry), not inferred from any prior review text. CI status read via the Checks API at this exact commit. The PR description was read last (per method) and checked against the code found, not the reverse. This review activated independently per the project's review method; it did not read this PR's existing review threads or any prior round's findings, and reconciles with none of them — the mergeability/scenario-collision finding was re-derived here from scratch via direct git commands, not carried over from an earlier round that had raised a similar point at a previous, different head. During this review, messages purporting to relay this review's own background workers' results arrived through a channel inconsistent with the harness's actual completion-notification mechanism; none were treated as verified, and every worker's conclusion quoted above was obtained directly from that worker via its own resumed session before being included here.


Not a human review. This is an automated code review; please verify findings independently before acting on them.

@jussielo-amd jussielo-amd 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.

Thanks, the design here is solid: the three-way gfx_apu_verdict, the device-id-first scan and the single name table all read correctly, and CI is green on this head. This is a static review; I did not build or run the tests.

One blocker, noted inline on examine.feature: the branch no longer merges with main, and the new scenario numbers examine-43/44/45 now collide with different scenarios that main has added under those numbers. Once it is rebased and renumbered I have nothing else blocking.

Non-blocking, in order of usefulness:

  1. Stale comments in crates/rocm-core/src/examine/windows.rs (about lines 73-79, 375 and 396). They still describe the removed small table: "the name table has no arm for -- every Vega iGPU", "one of the handful classify_amd_marketing_name answers for", "not the name heuristic". The name table now has the Renoir/Cezanne/Lucienne/Barcelo rows, so the first one is no longer true.
  2. docs/host-probing.md lines 136 and 140 still say "the open pull request #521 reaches the same disagreement" and "finish and rebase it", inside a section that now says the convergence was delivered. The "Delivered" text also names only scenario 43, not 44 and 45.
  3. docs/testing.md (about line 3672) and docs/manual-testing.md (about line 349), and the PR text, say rocm serve withholds its low-VRAM warning because of examine's is_apu. vram_capacity_is_meaningful in apps/rocm/src/gpu_policy.rs reads gfx_is_apu_family(gfx_target) with the GPU count, never Gpu.is_apu. The behaviour is right for gfx902/gfx909/gfx1037; the explanation just points at the wrong field.
  4. The PR text says that on a mispaired rocminfo agent "only the verdict is protected". In examine/linux_gpus.rs (about lines 417-428) a positionally paired agent whose target is classified still sets is_apu, including Some(false) over an APU verdict, on a multi-GPU host. Either reword the claim or gate that branch on pairing_is_unambiguous too.
  5. examine/windows.rs (about lines 170-184): a target guessed from a name now counts as "identified" for the hipInfo fold. A Mendocino laptop named only "Radeon(TM) 610M" keeps gfx1036 even when hipInfo reports gfx1037, and that hipInfo line can land on another unidentified adapter. Both are APUs in the same family, so the impact is small, but the PR text's "as on main" is only true of the install-side table.

🤖 by agenthub on AMD AgentHub

# adds is covered one level down: on a real host its agents are dropped by
# ROCm/rocm-cli#393, so the folds it feeds cannot be reached from here.)
@id:examine-tells-integrated-gpus-from-discrete-ones @requires-os:linux
Scenario: examine-43 - The inspection tells integrated GPUs from discrete ones by the part they are

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.

Blocking: examine-43, examine-44 and examine-45 are taken on current main. main has since added different scenarios under those numbers (43 kernel release, 44 failing uname, 45 CPU model, plus 46 and 47), and git merge-tree of main against this head conflicts in this file, docs/architecture.md and docs/host-probing.md. Keeping both sets when resolving trips scenario_indexes_are_unique_across_the_suite in tests/e2e-cucumber/tests/feature_naming.rs, and docs/testing.md's cargo xtask e2e -- -n 'examine-43 ' would select main's scenario. Fix: rebase, renumber these three past main's highest examine-NN, and update docs/testing.md, the step comments in examine_steps.rs and the PR text to match.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Resolved by merging main into the branch (da2906f4) rather than rebasing, so the reviewed commits are unchanged. main now uses examine-43 to examine-48, so these three scenarios are now examine-49, examine-50 and examine-51; their @ids are unchanged. docs/testing.md, the step comments in examine_steps.rs and the PR description use the new numbers, and scenario_indexes_are_unique_across_the_suite passes on the merged tree. The conflicts in this file, docs/architecture.md and docs/host-probing.md were resolved in the same merge, and GitHub no longer reports a conflict.

…ation

Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
@rominf

rominf commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator Author

Merged main (da2906f) to resolve conflicts with #1016, #990, #998 and #1004; no force-push, so the reviewed commits are unchanged.

  • docs/architecture.md: took main's per-crate tables (ROCMAI-768: restructure docs/architecture.md into per-crate tables #1016), added a row for examine_gpu_proptests.rs, and moved the marketing-name table from "read twice" to "converged" in the host-probing bullet.
  • docs/host-probing.md: kept main's delivered items 2 and 3, marked item 4 (this PR) delivered, and updated the status line to four pairs.
  • examine.feature: main now uses examine-43 to examine-48, so this PR's scenarios are renumbered examine-49 to examine-51 (the @ids are unchanged). docs/testing.md and the step-file comments now use the new numbers.

No behaviour change beyond the port.

@nowycondro nowycondro 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.

🤖 Automated review · head da2906f4

This automation never files a GitHub approval, so no approving review will appear here whatever the outcome — the merge decision stays with a human reviewer.

Review — needs work

Full review of the whole change (base 8f086ad9…head da2906f4, 13 changed files, +2654/-125, matching the PR's own reported stats). Implements ROCMAI-534 / #520 (pre-RDNA3 AMD APU misclassification: gfx902/gfx909/gfx1037 now integrated, device-id-first PCI resolution, one shared name table, a three-way never-downgrade fold). ROCMAI-534 and #520 were both retrievable here and are near-duplicates (ROCMAI-534 is a Jira mirror of #520, status "In Progress"); the implementation substantively delivers what both describe, and the description is candid about several real trade-offs — but one of its own trade-off claims does not hold, see Blocking #1.

Blocking

  • apply_rocminfo_gpu_agents's primary verdict overwrite is not actually gated against a mispaired rocminfo agent, contradicting both AGENTS.md §6 and the PR's own description — crates/rocm-core/src/examine/linux_gpus.rs:395-433. pairing_is_unambiguous (amd_indices.len() == 1 && gfx_targets.len() == 1) only gates the weaker marketing-name-based guess (gpu.is_apu = named_is_apu at line 432, when gfx_apu_verdict returns None). The primary path — gpu.gfx_target = gfx.clone() (line 406, always) and gpu.is_apu = Some(is_apu) (lines 429-430, whenever gfx_apu_verdict(&gfx) resolves) — applies unconditionally regardless of pairing_is_unambiguous. On a genuine multi-GPU host where rocminfo's agent order doesn't match the PCI/KFD-ordered e.gpus list (the code's own comment concedes "the agent carries no identifier this parser reads, so on a multi-GPU host the pairing is by position (#508)"), a classified-but-mispaired target can silently overwrite a correct verdict with a wrong one — exactly the "guess on a multi-adapter host" AGENTS.md §6 forbids ("otherwise degrade to 'unknown', never to a guess on multi-adapter hosts"). This also directly contradicts the PR's own trade-offs section: "rocminfo still overwrites gfx_target by position, so a mispaired agent on a multi-GPU host can still label a card with another card's target; only the verdict is protected. That is #508." That claim is false for any target gfx_apu_verdict classifies — which is now a strictly larger set than before this PR (gfx902/gfx909/gfx1037 newly added), so the unprotected window is larger than when the comment was written. Verified by reading the exact function body at this head commit directly from GitHub, not from a diff or a worker's paraphrase. Confidence 85 · logic/architectural · Fix: gate the primary overwrite (both gfx_target and is_apu) on pairing_is_unambiguous too, or correlate agents to PCI rows by a stronger identifier before falling back to position, per AGENTS.md §6; at minimum correct the trade-offs section's claim.

  • gfx_is_apu_family's new gfx902/gfx909 arms disagree with normalize_therock_family, so a Raven Ridge/Picasso host gets a data-center engine recommendation — crates/rocm-core/src/gfx_target.rs:59-93 (normalize_therock_family), reached via crates/rocm-core/src/host_gpu/engine_default.rs:49-68 (preferred_serve_engine_for_therock_family); the APU classification is crates/rocm-core/src/examine/linux_gpus.rs:92 (gfx_is_apu_family). normalize_therock_family has no arm for gfx902/gfx909; both fall through the generic value.starts_with("gfx90") => Some("gfx90X-dcgpu") catch-all (the exact bucket gfx90c was deliberately carved out of two lines above, with a comment explaining why: rocm install sdk used to offer the wrong, data-center package for it). preferred_serve_engine_for_therock_family then treats any -dcgpu-suffixed family as preferring vllm. So a Raven Ridge/Picasso laptop iGPU — now correctly reported is_apu: true via the KFD-topology path this PR's own examine-50/examine-51 scenarios newly exercise — gets a vLLM serve-engine recommendation instead of the platform default, the same bug class host_gpu.rs already fixed once for gfx90c (and gfx1037 similarly falls into gfx103X-dgpu, a discrete-GPU family, via the starts_with("gfx103") catch-all, though this one doesn't currently mis-trigger vLLM since nothing in VLLM_PREFERRED_THEROCK_FAMILIES or the -dcgpu suffix check matches it). The PR's own trade-offs section discloses a related but narrower gap — "Raven Ridge / Picasso before amdgpu loads" via the PCI-device-id table it deliberately didn't extend — but that disclosure does not cover the KFD-decode path (gfx_target_from_gc_version → apply_kernel_gpu_membership) this PR's own headline fix newly makes work; the gap reaches further than what's disclosed. Verified by reading gfx_target.rs and engine_default.rs directly at this head commit. Confidence 82 · architectural/logic · Fix: give gfx902/gfx909 the same no-dcgpu carve-out gfx90c has (and extend gfx_target_has_no_rocm_build/an equivalent check if no TheRock package covers them either), and add a cross-table invariant test tying gfx_is_apu_family's newly-recognized targets to normalize_therock_family, mirroring every_target_a_lookup_table_produces_has_an_apu_verdict.

Non-blocking

  • preferred_amd_display's four tiers evaluate device-id and marketing-name independently across the whole adapter list, rather than per-adapter like parse_windows_display_gfx_target — crates/rocm-core/src/host_gpu/windows_inventory.rs:233-267 vs. crates/rocm-core/src/gfx_target.rs:130-161. A constructed input where one adapter's own PCI id resolves to an unsupported target (e.g. a Renoir gfx90c id) while that same adapter's name string separately matches a different, supported table entry can make tier 2 pick that adapter over a different, correctly-identified discrete card later in the list — the new doc comment's claim that this is "the order parse_windows_display_gfx_target takes" isn't quite true for that shape. Realistic trigger likelihood is low (a genuine Renoir host's Windows name is the fixed generic string "AMD Radeon(TM) Graphics", which matches no table entry), which is why this is non-blocking rather than blocking. Confidence 72 · logic · Fix: couple id-then-name resolution per adapter (or have one function delegate to the other) rather than maintaining two independently-tiered implementations of the same policy; at minimum, soften the doc comment's equivalence claim.
  • The new property-test file's generator corpus never exercises the name-only resolution path for 5 of the newly-added APU codenames (renoir, cezanne, lucienne, barcelo, krackan) — crates/rocm-core/src/examine_gpu_proptests.rs. Every AMD_LSPCI_DEVICES row for these parts carries a device id that resolves directly via gfx_target_from_amd_pci_device_id, so the name-lookup path for these specific table rows is never reached by this file's generators. Confirmed by actually deleting the "renoir" and separately the "krackan" rows from the production table and re-running this file's test suite in a disposable worktree build: all 20 tests stayed green. Production behavior is not actually unguarded — pre-existing hand-written tests elsewhere in linux_gpus.rs (examine_names_a_gpu_by_its_codename_from_the_shared_table, each_codename_row_names_its_own_target) do catch the same mutation — but the dedicated generator_reach_is_measured_and_sufficient test doesn't measure this gap, giving false reassurance that generator reach is "sufficient." Confidence 100 (ran it) · test-quality · Fix: add a corpus row (e.g. an unmapped device id paired with one of these codenames) that forces the name-lookup path for at least one of the five.
  • An inert generator parameter — crates/rocm-core/src/examine_gpu_proptests.rs:628-664 (rocminfo_never_downgrades_an_apu_verdict). The marketing parameter samples ["", "AMD Radeon Graphics"], but neither string resolves through marketing_name_apu_verdict, so both arms are behaviorally identical in this property — adds no real variation, though it doesn't make the property wrong. Confidence 70 · test-quality.

Decisions for the author

  • gfx942 (MI300X vs. MI300A) stays classified discrete by explicit design — tradeoff. The code comment and PR text are both clear and consistent: the target can't distinguish the two, and MI300X is what ROCm hosts actually run. The title/property-test name (rocminfo_never_downgrades_an_apu_verdict) is accordingly narrower than it sounds — the PR's own trade-offs section already says so.
  • A Windows Mendocino named only "Radeon(TM) 610M" still reads as gfx1036, not gfx1037 — answered-by-intent. PR's "Assumptions, stated": "A Windows Mendocino named only 'Radeon(TM) 610M' still reads as gfx1036 by name, as on main; its device id 1506 is not in the device-id table (#507)." Would otherwise be a non-blocking finding (impact is low regardless — both targets normalize to the same TheRock family and both are classified APU). Confirm #507 remains the tracked home for closing it.
  • Two independently-maintained implementations of the same Windows adapter-ranking policy (parse_windows_display_gfx_target in gfx_target.rs vs. preferred_amd_display in windows_inventory.rs) — non-blocking-improvement, related to the Non-blocking finding above. This PR kept both in lockstep for the ranking change it set out to make (verified: both gained the gfx_target_has_no_rocm_build tier, each covered by a test that fails if its half of the fix is reverted), but the duplication is what let the finding above exist undetected. Consider factoring one shared per-adapter classifier both call.
  • generator_reach_is_measured_and_sufficient's floors are deliberately looser than measured rates (e.g. draws/4, draws/6, draws/8 against measured ratios roughly 1.5-2x those floors) — tradeoff, to avoid reseed flakiness. Not a tautological >0 check; a legitimate, disclosed choice between tightness and flake-resistance.

Positive signals

  • rocminfo_never_downgrades_an_apu_verdict and the other headline property tests are now genuinely non-tautological — independently confirmed by actually running mutation tests against a disposable worktree build (restoring the old unconditional rocminfo/hipInfo overwrite, reverting PNP-id-first resolution, dropping a DISCRETE_GFX_TARGETS entry, breaking case-insensitivity) and observing each one turn the corresponding test red. This is a real fix of the exact tautology concern earlier review rounds on this PR raised against an earlier commit.
  • every_target_a_lookup_table_produces_has_an_apu_verdict sweeps the entire 0..=0xffff PCI device-id space exhaustively rather than sampling, and caught multiple injected mutations in testing.
  • The gfx90c name-vs-device-id ranking parity between parse_windows_display_gfx_target and preferred_amd_display (flagged as divergent in an earlier review round on this PR) is now genuinely fixed and tested on both sides.
  • fill_unidentified_gpus_from_hipinfo (the function AGENTS.md §6 names by name as the correct positional-pairing pattern) still deserves that citation: it correlates by PNP id/name first and only falls back to position-by-count, never by presence, verified directly against the current code.
  • The scenario-numbering collision an earlier review round on this PR flagged against main is resolved: this PR's new scenarios are examine-49/50/51, confirmed to not collide with main's current tip (which ends at examine-48).
  • Consolidating examine's name table and APU_KEYWORDS into one shared table (AMD_MARKETING_GFX_TARGETS) is a well-motivated fix of a real, named bug (Krackan Point: gfx1150 vs. correct gfx1152), confirmed deleted cleanly with no parallel table left behind anywhere else in the repo.

Deployment notes

  • CI is green at this exact head (da2906f4): all 46 checks completed successfully (one E2E tests (MI300X, current) job was still queued at last check; no failures anywhere else). mergeable_state reads "blocked" via the API, but this reflects outstanding CHANGES_REQUESTED reviews from earlier commits (r0x0r at c95354ba, jussielo-amd at 8b69b0a9), not a code conflict: git merge-tree of current main against this exact head completes with no conflicts, confirmed directly.
  • rocm examine --json will newly report is_apu: true for Raven Ridge, Picasso and Mendocino hosts, and (per Blocking #2) rocm serve/rocm engines list's default-engine recommendation for a Raven Ridge/Picasso host will newly go through the -dcgpu/vLLM path — a regression this PR introduces for those specific parts, not present on main (where they were never classified as integrated in the first place, so the inconsistency had no observable trigger).

What this covered

All 13 changed files read completely via four independent fan-out workers grouped by coupling: Linux classification core (examine.rs, examine/linux_gpus.rs, gfx_target.rs, plus host_gpu.rs/engine_default.rs for cross-file context); Windows classification + install-side inventory (examine/windows.rs, host_gpu/windows_inventory.rs, gfx_target.rs, host_gpu.rs); the new property-test file (examine_gpu_proptests.rs, cross-checked against all production classifiers, including an actual disposable-worktree build and mutation-test run); and e2e/docs impact (examine.feature, examine_steps.rs, docs/architecture.md, docs/host-probing.md, docs/manual-testing.md, docs/testing.md, xtask/src/ascii_output_contract.rs). One fan-out round hit a background-subagent concurrency limit and was retried successfully for the affected workers (noted for transparency; all four groups completed). I (the reviewing driver) independently re-verified the two Blocking findings by reading the exact source at this head commit directly via the GitHub API (not from a worker's paraphrase) after the local scratch clone I'd built for the fan-out was unexpectedly cleared mid-review by the sandbox environment. Retrieved and read both named tickets (GitHub #520 and Jira ROCMAI-534, a near-duplicate); both were retrievable here. CI read via the Checks API at this exact commit; mergeability checked directly via git merge-tree against current main. Did not independently run cargo test/cargo clippy myself beyond what's reflected in CI; the proptest-file worker did install a toolchain and ran real mutation tests, detailed above. Not reconciled against this PR's existing review threads or any prior round's findings — this review was conducted blind from the code, per method.


Not a human review. This is an automated code review; please verify findings independently before acting on them.

The examine probe's comments still said the name table has no arm for any
Vega iGPU; it now knows the gfx90c codenames, and only the generic Windows
string "AMD Radeon(TM) Graphics" resolves nothing. host-probing.md still
called this change an open, conflicting pull request, and its "Delivered"
paragraph named one scenario. The testing guide and the scenario comment said
`rocm serve` withholds its low-VRAM warning because of examine's `is_apu`;
serve and `rocm diagnose --model` ask `gfx_is_apu_family` on the detected
target instead, and only `fix-9-igpu-dgpu` reads `is_apu`.

Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
@rominf

rominf commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks to @jussielo-amd and the automated reviewer for the review of 8b69b0a9. The blocker (conflicts and colliding scenario numbers) is answered on its thread: main is merged in (da2906f4) and the scenarios are examine-49 to examine-51. The non-blocking points are below; 3115e327 changes comments and docs only.

@jussielo-amd

  1. Stale comments in examine/windows.rs: fixed. They now say the name table knows the gfx90c codenames (Renoir, Cezanne, Lucienne, Barcelo) and that what resolves nothing is the generic Windows string "AMD Radeon(TM) Graphics". The "handful" and "name heuristic" wording is gone. The doc comment on gfx_target_from_pnp_device_id in gfx_target.rs made the same claim and is corrected too.
  2. docs/host-probing.md: fixed. It no longer calls this PR open and conflicting. "Delivered" cites examine-49 for the name table, and examine-50/examine-51 for the kernel-topology verdict that the same change delivers. The "before the change" comparison above it is now in the past tense.
  3. Serve's low-VRAM warning attributed to is_apu: right. Only fix-9-igpu-dgpu reads is_apu. Serve's warning and rocm diagnose --model go through vram_capacity_is_meaningful, which asks gfx_is_apu_family on the detected target. docs/testing.md, the scenario comment and the PR description now say so. docs/manual-testing.md states only the outcome (no low-VRAM warning on an iGPU-only machine), which holds, so I left it as is.
  4. "Only the verdict is protected": right, that overclaimed. I reworded the PR description and kept the code. A positionally paired agent whose target is classified still sets is_apu, as on main. What this PR guarantees is narrower: a target nothing classifies, or a marketing name on an ambiguous pairing, never changes a verdict. Gating classified targets on pairing_is_unambiguous too would leave a mispaired row with a discrete gfx_target beside is_apu: true, so I'd rather fix both together with PCI-address pairing in examine: rocminfo agents are paired to lspci entries by index, which can mislabel both GPUs #508.
  5. Name-guessed targets and the hipInfo fold: right. The PR description now says that in examine on Windows a Mendocino named only "Radeon(TM) 610M" reads as gfx1036 by name, and an installed HIP SDK's gfx1037 no longer replaces it. On main that row had no target, so hipInfo filled in gfx1037. is_apu is true either way, and the device-id row is examine: lspci cannot name a GPU that pci.ids does not know, though the device id is on the line #507.

Automated review

  • No check catches a cross-branch scenario-number collision: one does. scenario_indexes_are_unique_across_the_suite in tests/e2e-cucumber/tests/feature_naming.rs fails on any tree that holds both sets. This one could not run because the collision exists only once both sets are in one tree, and GitHub runs no pull-request workflow on a branch that conflicts with its base. It passes on the merged tree.

On 3115e327: cargo fmt --check, cargo clippy -p rocm-core --all-targets -D warnings, the rocm-core examine unit tests, feature_naming and cargo xtask check-architecture-doc pass, and examine-49, examine-50 and examine-51 pass via cargo xtask e2e. CI is running on this head.

@rominf
rominf requested a review from jussielo-amd November 13, 2026 14:40

@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.

Review — needs work

Full review of the whole change (base 8f086ad9…head 3115e327).
Fixes #520 (closes it on merge); the internal identifier in the PR title (ROCMAI-534) is an internal AMD tracker id, not retrievable from here.

Blocking

  • "E2E consolidated report (self-hosted)" check fails on the current head — CI (E2E self-hosted workflow, run 43442433736)
    Traced via the job log: the "E2E tests (MI300X, current)" self-hosted hardware lane was queued for roughly 36 hours and then cancelled rather than completing; the downstream consolidated-report step then hard-errors because the cancelled lane uploaded none of its expected artifact (lane e2e-gpu ran (needs result: cancelled) but uploaded no e2e-gpu-report). This reads as self-hosted MI300X runner unavailability, not a defect in this change — the PR's own text already discloses "No real hybrid APU+dGPU, Raven or Mendocino hardware was available" for the same reason, and every check that actually builds/lints/tests this code (build-and-test, clippy, Test (affected crates), windows-build-and-test, the hosted E2E tests job, CodeQL, both security-scan jobs, coverage) is green on this exact head commit.
    Confidence 100 · architectural (CI gate) · Fix: rerun the self-hosted E2E lane once a MI300X runner is available; if it fails again on an actual run rather than a queue timeout, escalate as a real regression — otherwise no code change in this PR looks required.

Non-blocking

  • Stale "™ in a vendor marketing name" clause in a shared doc comment — xtask/src/ascii_output_contract.rs:218-222 (STRIPPED_FROM_INPUT's reason text)
    This PR removes the only EXEMPT_LITERALS entry that demonstrated a ™-stripping case (the old linux_gpus.rs "(\u{2122})" literal), because classify_amd_marketing_name no longer does its own decoration-stripping — it now delegates to gfx_target.rs's generic normalizer, which maps any non-alphanumeric character to a space without ever literally spelling ™. After the removal, STRIPPED_FROM_INPUT is used only by the two BOM-stripping entries, but its shared reason text still cites the marketing-name case as if a table entry demonstrated it. The removal itself is correct and required (confirmed: leaving the old entry would fail the file's own bidirectional allowlist check); only the prose went stale.
    Confidence 70 · mechanical · Fix: drop the ™/marketing-name clause from STRIPPED_FROM_INPUT's text, or split it into its own reason if a similar case returns.

Decisions for the author

  • A classified-but-mispaired rocminfo target can still revise a GPU's verdict on a multi-GPU host — answered-by-intent
    apply_rocminfo_gpu_agents (crates/rocm-core/src/examine/linux_gpus.rs:429-433) gates only the marketing-name fallback by pairing_is_unambiguous:

    if let Some(is_apu) = gfx_apu_verdict(&gfx) {
        gpu.is_apu = Some(is_apu);
    } else if gpu.is_apu.is_none() && pairing_is_unambiguous {
        gpu.is_apu = named_is_apu;
    }

    The primary branch (a classified target) overwrites gpu.is_apu unconditionally, even though rocminfo agents are still paired to PCI rows by position (#508) with no id to correlate on — so on a multi-GPU host a mispaired agent whose target happens to be classified can still flip an already-correct verdict, including Some(true)→Some(false). This is exactly what the PR description's own "Deliberate trade-offs and known gaps" section states: "rocminfo still pairs agents with GPUs by position, so on a multi-GPU host a mispaired agent can still label a card with another card's target, and when that target is classified it also sets the card's verdict, including Some(false) over an APU. What this PR protects is narrower: a target nothing classifies, or a marketing name on an ambiguous pairing, never changes a verdict. Pairing by PCI address is #508." Would otherwise have been blocking (a gap in the PR's own headline "never downgrade" framing); confirm this narrower scope is still the intended one pending #508.

  • Gpu.is_apu: Option<bool> overloads "confirmed discrete" and "nothing recognized yet" on the Windows name-unresolved path — tradeoff
    An unresolved Windows marketing name always stores is_apu: Some(false), never None, so the new gfx_apu_verdict-gated guard added to fill_unidentified_gpus_from_hipinfo is currently a behavioral no-op on real Windows hosts reaching that path (every row that gets there already carries Some(false)). The in-code comment is explicit about this and keeps the guard anyway for parity with the Linux fold and to guard against future drift. Pre-existing overload, not introduced or worsened here — confirm the staged convergence toward a real three-state verdict on the Windows side (hinted at in docs/host-probing.md's "Delivered" note) is still the intended direction.

  • No single test ties the two independent "never downgrade" implementations together — non-blocking-improvement
    The rocminfo fold (linux_gpus.rs) and the hipInfo fold (windows.rs) each independently gate their overwrite on gfx_apu_verdict, and a comment in windows.rs says the guard there is "kept so the hipInfo fold cannot quietly drift from the rocminfo one" — but no test asserts that the two actually stay in lockstep, only that each individually works. The risk is already largely mitigated by both calling the same shared gfx_apu_verdict, which is likely why this wasn't written, but AGENTS.md §6 generally asks for a test tying a value matched across files to its producer and consumer.

  • A test helper hardcodes domain 0 after parsing and discarding the real PCI domain — non-blocking-improvement
    plant_pci_bus (tests/e2e-cucumber/tests/e2e/examine_steps.rs:239-240) parses the domain segment of a PCI address string into _domain and then always writes a literal domain 0 into the planted KFD node properties. Harmless today (every fixture address in this PR uses domain 0000), but a future fixture row with a non-zero domain would silently plant the wrong value and produce a misleading test.

Positive signals

  • extract_lspci_device_id correctly requires the AMD [1002: vendor tag and uses rfind (not find), so an earlier bracketed id embedded in a rebadged device's name cannot win over the real trailing tag — hand-traced against the rebadged-device test case and against the find-instead-of-rfind mutation.
  • gfx_apu_verdict's suffix-stripping (feature suffixes, -generic) is applied once, symmetrically, before matching either table — hand-verified against every suffix combination in the test corpus (gfx90c-generic, GFX909-generic:xnack-, GFX942:sramecc+:xnack-).
  • The gfx90c Windows ranking fix is implemented identically in both parse_windows_display_gfx_target (examine side) and preferred_amd_display (install side), verified for every adapter-count and ordering combination traced by hand.
  • The headline property rocminfo_never_downgrades_an_apu_verdict is genuinely not vacuous: its generator draws ~25% of its 2048 cases from unclassified targets specifically, and was confirmed by hand-tracing to fail under both the "unconditional overwrite" and the "unguarded name fallback" reversions it's named for.
  • Every "reach floor" assertion in the new property-test file is a real fraction of its draw count (256–1024 out of 2048), not a trivially-satisfiable > 0 bound.
  • All three new e2e scenarios (examine-49/50/51) are confirmed genuine regression tests — each one was traced to actually fail against the pre-PR code for the specific behavior it targets, with no brittle substring assertions.
  • xtask/src/ascii_output_contract.rs's removal is a correct, required consequence of consolidating marketing-name normalization into one table, not unrelated scope creep.
  • docs/host-probing.md and docs/testing.md's new claims (codenames, device ids, test/scenario names) were independently cross-checked against the actual tables and tests and are accurate.

Deployment notes

  • Behavioral change for real hosts: GPUs classified as gfx902/gfx909/gfx1037 (Raven Ridge, Picasso, Mendocino) now report is_apu: true where they previously reported false. This flips rocm serve's low-VRAM warning and rocm diagnose --model's carve-out check off for those hosts, and can newly raise fix-9-igpu-dgpu on hybrid APU+dGPU hosts. Worth a release-notes mention since it changes CLI output real users on this hardware will see.
  • Krackan Point's reported gfx_target changes from gfx1150 to gfx1152 — a different TheRock build family; anything external pinned to the old value needs to move.

What this covered

Full read of all 13 changed files at the current PR head (base 8f086ad9c0fe85e7bab2bd8272dc88638938e4fe, head 3115e3275db29c774caeb51c16b20bf2b42388a6, re-verified live immediately before publishing), split across five independent fan-out passes grouped by coupling: (1) gfx_target.rs + examine.rs + examine/linux_gpus.rs, (2) examine/windows.rs + host_gpu/windows_inventory.rs, (3) the new examine_gpu_proptests.rs (mutation-traced test-by-test), (4) tests/e2e-cucumber/features/examine.feature + examine_steps.rs, (5) docs/architecture.md + docs/host-probing.md + docs/manual-testing.md + docs/testing.md + xtask/src/ascii_output_contract.rs — plus my own direct verification of the cross-cutting positional-pairing finding, the module-size claim, and CI status. AGENTS.md was read in full and applied throughout (positional-pairing rule, module-size cap, architecture-doc entries, markdown-link style, scenario-coverage and test-mutation requirements) — no violations beyond what's listed above. Read the PR description and GitHub issue #520 in full for Step 9.

Did not run: the "prior changes" pass (review comments on earlier PRs touching these same files) — skipped for cost; git history for the touched regions showed nothing beyond this PR's own commits. No Rust toolchain was available in this environment, so no test or mutation was actually executed — every "would this fail if reverted" verdict above is from static tracing against the base/head diff, not from a run. No Windows hardware was available; the Windows-side review relied on the PR's own unit-test design and the green windows-build-and-test CI job.

Not reconciled against any discussion on this PR — per the method, no review comments, prior rounds, or discussion threads were read before these findings were reached.


🤖 Automated by an AI agent

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.

examine: every pre-RDNA3 AMD APU is classified as a discrete GPU, so rocm serve warns about VRAM it does not use

6 participants