SIGN IN SIGN UP

fix(core): keep ADL temperatures for adapters whose usage query fails (#1996)

* fix(core): keep ADL temperatures for adapters whose usage query fails

sample_amd_gpus emitted a sample only for adapters that answered the ADL
usage query and returned early when that list was empty. An AMD adapter
(typically an APU) whose usage query fails while its temperature query
succeeds lost the temperature ADL actually produced: the PDH fallback
restored the adapter's presence, but with temperature: None.

The per-adapter usage and temperature queries are now joined by PCI BDF,
and one sample is emitted per adapter in the union of both result sets,
with usage and temperature each Some/None as its query answered. Names
resolve through the existing BDF-to-DXGI map for every emitted adapter.

A temperature-only sample is keyed pci:<bdf>, which the PDH pass treats
as vendor-covered, so it would no longer add a usage reading for that
adapter. The PDH pass therefore gains a second role: for a covered
adapter whose vendor sample has usage: None, it queries usage by adapter
LUID and fills the existing sample in place, keeping the vendor-keyed
id. Uncovered adapters keep getting new pdh:-keyed samples, preserving
the #1988 behavior.

No AMD hardware was available to verify this end to end: the change is
logic-level, with unit tests over the pure join and assignment helpers.
Behavior on real APUs needs maintainer verification.

Fixes #1991

* fix(core): attribute and disambiguate the PDH usage fill

Review corrections for the fill role added for #1991:

- A usage PDH fills into a vendor sample now sets source to "PDH": the
  field labels the usage downstream (gpu_source is surfaced as the usage
  source), so the vendor API that failed to answer must not be credited
  for a reading PDH produced. Identity and the vendor temperature stay
  untouched.
- A name-only join (no SetupDi PCI address) selects a fill target only
  when the name identifies exactly one vendor sample. With two same-name
  candidates the reading could land on the sibling's sample; coverage
  still suppresses a new pdh: sample, but nothing is filled, because a
  misattributed reading is worse than a missing one.
S
shm committed
6e21daf175aae57a72453d26db711a22be0a1cd1
Parent: 65c9d7b
Committed by GitHub <noreply@github.com> on 8/23/2026, 6:58:42 AM