Skip to content

feat(dash-tui): collect GPU/memory metrics in-process on Windows - #715

Open
juhovainio wants to merge 4 commits into
mainfrom
jira-ROCMAI-564
Open

juhovainio wants to merge 4 commits into
mainfrom
jira-ROCMAI-564

Conversation

@juhovainio

@juhovainio juhovainio commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Implements ROCMAI-564

Windows has no rocmdashd socket yet, so the TUI's #[cfg(windows)] client arm now builds Snapshots in-process on a 1-second ticker instead of connecting anywhere: HostCollector (already cross-platform) for CPU/memory, and a new WinPerfCollector for GPU utilization and VRAM, read from the GPU Engine/GPU Adapter Memory OS performance counters via powershell.exe (the same WDDM/DXGK-backed source Task Manager's GPU tab uses — no AMD tool required). The unix arm is unchanged.

  • crates/rocm-dash-collectors/src/winperf.rs: new WinPerfCollector, parsing per-adapter utilization (max across engines) and dedicated VRAM usage, plus a best-effort adapter inventory (name/RAM/driver) for GpuSystemInfo. vram_total_mb is only filled in for the single-adapter case (the realistic integrated-APU target); multi-GPU hosts degrade to 0 rather than risk a wrong number, since correlating a perf-counter LUID to a specific Win32_VideoController entry isn't reliable without vendor-specific APIs.
  • crates/rocm-dash-tui/src/client.rs: the #[cfg(windows)] connect_and_run now drives HostCollector/WinPerfCollector and sends the same ClientMsg sequence (Connected then Event::Snapshot) the unix socket arm produces, so the app loop doesn't need to know which platform it's on.
  • crates/rocm-dash-tui/Cargo.toml: adds the rocm-dash-collectors path dependency this requires.
  • xtask/src/crate_edges.rs: allowlists the new rocm-dash-tui -> rocm-dash-collectors first-party edge.

Test plan

  • Build and run on a real Windows host with an AMD GPU; confirm the dashboard TUI shows live GPU utilization/VRAM and CPU/memory metrics without a rocmdashd daemon running.
  • cargo test (workspace, Linux) — new winperf unit tests pass; no regressions.
  • cargo clippy --workspace --all-targets — clean.

ROCMAI-564: the TUI's Windows client arm was a stub (no rocmdashd socket
there yet), so Windows users saw no GPU/memory metrics at all.

Add WinPerfCollector, reading the OS's own `GPU Engine`/`GPU Adapter
Memory` performance counters via `Get-Counter` (the same WDDM/DXGK-backed
source Task Manager's GPU tab uses) plus `Win32_VideoController` for
adapter inventory/driver version. No AMD tool required. Mirrors
amd_smi.rs's subprocess + pure-parse shape.

client.rs's Windows connect_and_run now builds Snapshots in-process each
tick from HostCollector (already cross-platform) + WinPerfCollector,
feeding the same ClientMsg sequence the Unix socket arm produces, so the
app loop doesn't need to know which platform it's on.

Signed-off-by: Juho Vainio <juho.vainio@amd.com>
Required by ROCMAI-564's in-process Windows metrics ticker in
crates/rocm-dash-tui/src/client.rs, which reuses HostCollector and
WinPerfCollector directly instead of going through the daemon socket.

Signed-off-by: Juho Vainio <juho.vainio@amd.com>
GPU Engine perf-counter instances are per-process on Windows 10/11
(pid_NNNN_luid_..._phys_0_eng_...), but GPU Adapter Memory instances
are per-adapter only (luid_..._phys_0, no pid). device_key() keyed
both verbatim, so every process using the GPU produced its own
phantom near-zero device instead of aggregating onto the real
adapter, which is why real hardware showed "Unknown GPU" with
all-zero metrics despite `examine` detecting the GPU correctly.

Confirmed against live Get-Counter output from a Strix Point laptop.

Signed-off-by: Juho Vainio <juho.vainio@amd.com>
… calls

Real hardware logs (Strix Halo) showed every tick timing out: "powershell
Get-Counter query timed out" repeating for 20+ minutes straight, even
though the identical script runs near-instantly when invoked manually.
The bottleneck is powershell.exe child-process spawn latency, not the
Get-Counter query itself, and it consistently exceeds the old 5s budget
on real hardware.

Bump RUN_TIMEOUT to 15s, and collapse the two independent metrics()/
system_info() spawns (each re-running the identical script) into one
snapshot() call so each tick only pays the spawn cost once.

Signed-off-by: Juho Vainio <juho.vainio@amd.com>
@juhovainio
juhovainio marked this pull request as ready for review October 21, 2026 14:09
@juhovainio
juhovainio requested a review from a team as a code owner October 21, 2026 14:09
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.

1 participant