[PR #4999] [TUI] read AMD GPU utilization, VRAM, temp, and PCIe link on Windows #5282

Open
opened 2026-11-07 16:34:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4999
Author: @YuukiReina2023
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: win-amd-telemetry


📝 Commits (1)

  • 795bbc8 [TUI] read AMD GPU utilization, VRAM, temp, and PCIe link on Windows

📊 Changes

3 files changed (+526 additions, -20 deletions)

View changed files

📝 serve/telemetry.py (+242 -5)
📝 strata_cli/client.py (+64 -9)
📝 strata_cli/overview.py (+220 -6)

📄 Description

Problem and result

On Windows with AMD Radeon GPUs (HIP backend), the TUI Overview and Web Dashboard (http://127.0.0.1:8080) previously reported 0 % or -- for AMD telemetry:

  • GPU load: Displayed 0 % with an empty/flat sparkline track (_______________) even while the GPU was actively processing prompts or generating tokens.
  • VRAM: Reported -- / 32 GB or incomplete capacity without real-time usage.
  • GPU temp: Displayed -- °C without edge or junction/hotspot readings.
  • Power: Displayed -- W with no board power consumption figures.
  • PCIe: The Web dashboard displayed — (dash) due to missing gpu_pcie_* telemetry fields in /metrics; the TUI displayed PCIe to GPU -- or idle-downclocked Gen2 x16 without exposing the bus capability (Gen4 x16).

After this change:
The server and TUI read AMD GPU telemetry on Windows directly via the AMD Display Library (ADL: atiadlxx.dll), Windows Performance Data Helper (PDH: pdh.dll), and Windows Configuration Manager (PnP: cfgmgr32.dll):

  • GPU load: Real-time compute utilization percentage (0–100%) and an animated historical sparkline reflecting real load bursts.
  • VRAM: Accurate dedicated VRAM allocation (30.7 / 32 GB) matched against total adapter memory from the Windows display registry.
  • GPU temp: Edge temperature (52 °C) with junction hotspot subtitle (hotspot 53 °C) and a dynamically scaled thermal sparkline.
  • Power: Total ASIC board power (41 W / up to 200+ W under load) with rolling power sparkline.
  • PCIe: Full link capability (Gen4 x16) displayed across both the Web dashboard and TUI Overview without dropping into null or idle-downgrade.

Strata Web Monitor with AMD GPU Telemetry on Windows

  • Issue #1380, #1587 (AMD GPU telemetry on Windows).
  • Addresses missing telemetry on HIP/Windows setups without adding third-party dependencies or external daemons.

Approach

  1. Windows AMD GPU Reader (serve/telemetry.py):

    • Implemented _AmdWin(_Amd) using standard ctypes bindings to atiadlxx.dll and pdh.dll.
    • PMLog Sensors (ADL):
      • Sensor 19 (PMLOG_INFO_ACTIVITY_GFX) / Sensor 20 (PMLOG_INFO_ACTIVITY_MEM): Compute activity percentage.
      • Sensor 8 (PMLOG_TEMPERATURE_EDGE) & Sensor 27 (PMLOG_TEMPERATURE_HOTSPOT): Edge and junction temperatures.
      • Sensor 23 (PMLOG_ASIC_POWER): Total ASIC power consumption in Watts.
      • Sensor 40 (ADL_PMLOG_BUS_SPEED) & Sensor 41 (ADL_PMLOG_BUS_LANES): Current PCIe link speed and width.
    • PCIe Link Capability via Windows PnP (cfgmgr32.dll):
      • _windows_pci_link() queries DEVPKEY_PciDevice_MaxLinkSpeed and DEVPKEY_PciDevice_CurrentLinkWidth for the active display adapter. This exposes pcie_gen_max (e.g. Gen 4) so both Web and TUI properly display the hardware capability (Gen4 x16) even when ASPM drops the idle link to Gen 2.
    • VRAM and PDH Fallback:
      • Dedicated VRAM capacity is resolved via the display driver registry (HardwareInformation.qwMemorySize).
      • Real-time VRAM allocation is measured via \GPU Local Adapter Memory(*)\Local Usage.
      • When ADL is not loaded, PDH \GPU Engine(*)\Utilization Percentage provides fallback GPU engine activity.
    • Preserves existing Linux sysfs behavior: _AmdWin inherits from _Amd and delegates to super() whenever self.dev exists or in mock unit tests (SYSFS != "/sys").
  2. TUI Overview & Sparkline Animation (strata_cli/overview.py):

    • Added _WinPdh sampler in the CLI to poll ADL/PDH metrics for live local rendering.
    • Fixed sparkline freeze condition: when the server history was all-zero during initial connection or model reading, all(x in (None, 0.0) for x in g["util_hist"]) allows active local samples to immediately animate the sparkline instead of locking into a flat empty track.
    • Prioritized pcie_gen_max over idle link downclock so PCIe displays Gen4 x16.
    • Added dynamic temperature bounds scaling (t_lo, t_hi) to prevent temperature sparklines from flattening.
  3. Client Telemetry Normalization (strata_cli/client.py):

    • Populated mem_used, mem_total, util, temp, power for devices rows on Windows, ensuring multi-GPU card strips and device views do not display --.

Validation

Tested on revision commit 795bbc88 (branch win-amd-telemetry rebased on main), Windows 11 (build 26100), AMD Radeon PRO W6800 (32 GB, Navi 21 / RDNA2), Driver 32.0.21045.1000, model qwen3.8-flash-next-iq3_xxs 256K context:

Passed:

  • Live Server Telemetry & Web Dashboard at http://127.0.0.1:8080:
    Observed /metrics response contains gpu_name: "AMD Radeon PRO W6800", gpu_mem_used: 32945180672, gpu_mem_total: 34342961152, gpu_util: 22.0, gpu_temp: 52.0, gpu_temp_hotspot: 53.0, gpu_power: 41.0, gpu_pcie_gen: 2, gpu_pcie_gen_max: 4, gpu_pcie_width: 16, and 60 rolling samples in history.gpu_util. The Web UI displays 22% GPU load with green wavy activity graph, 30.7 / 32 GB VRAM, 52 °C temp graph, 41 W power graph, and Gen4 x16 PCIe link.
  • TUI Overview Live Render (strata monitor --url http://127.0.0.1:8080):
    GPU load tile displays 22 % with animated sparkline ▁▂▂▂▂▃▂▂▁▁▃▂▁▁▁▁▁▆▂▁, PCIe tile displays Gen4 x16 with to GPU --, VRAM displays 30.7 / 32 GB (3,435 experts cached), GPU temp displays 52 °C (hotspot 53 °C), Power displays 41 W.
  • serve.test_server.AmdTelemetry:
    python -m unittest serve.test_server.AmdTelemetry -v -> 3/3 passed (verifies sysfs parsing, free VRAM calculation, and PCIe link hop selection).
  • tests.terminal.test_tuiqa_monitor:
    python -m unittest tests.terminal.test_tuiqa_monitor -v -> 18/18 passed (verifies all monitor views, tab navigation, and themes).
  • tools/test_windows_amd_gpu.py:
    python tools/test_windows_amd_gpu.py -> 5/5 passed (verifies ADL initialization, PDH queries, display adapter registry parsing, and fallback handling).

Failed:

  • None observed.

Not run:

  • Linux sysfs with physical AMD hardware (verified via unit test mock sysfs tree).
  • Multi-GPU AMD configurations on Windows (tested on single Radeon PRO W6800).

Limits

  • PCIe real-time transfer bandwidth throughput (pcie_rx_mb, pcie_tx_mb) is only exposed by NVIDIA NVML counters; on AMD GPUs (both Windows and Linux sysfs), throughput is not exposed by the driver and defaults to --. Link generation and width (Gen4 x16) are fully supported.
  • ADL PMLog metrics require the standard AMD Radeon Software / PRO Enterprise driver (atiadlxx.dll, present on all standard AMD driver installations).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4999 **Author:** [@YuukiReina2023](https://github.com/YuukiReina2023) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `win-amd-telemetry` --- ### 📝 Commits (1) - [`795bbc8`](https://github.com/Niko1221/Strata/commit/795bbc881ffb988456b5fe7abbb65229786ae7eb) [TUI] read AMD GPU utilization, VRAM, temp, and PCIe link on Windows ### 📊 Changes **3 files changed** (+526 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `serve/telemetry.py` (+242 -5) 📝 `strata_cli/client.py` (+64 -9) 📝 `strata_cli/overview.py` (+220 -6) </details> ### 📄 Description ### Problem and result On Windows with AMD Radeon GPUs (HIP backend), the TUI Overview and Web Dashboard (`http://127.0.0.1:8080`) previously reported `0 %` or `--` for AMD telemetry: - **GPU load**: Displayed `0 %` with an empty/flat sparkline track (`_______________`) even while the GPU was actively processing prompts or generating tokens. - **VRAM**: Reported `-- / 32 GB` or incomplete capacity without real-time usage. - **GPU temp**: Displayed `-- °C` without edge or junction/hotspot readings. - **Power**: Displayed `-- W` with no board power consumption figures. - **PCIe**: The Web dashboard displayed `—` (dash) due to missing `gpu_pcie_*` telemetry fields in `/metrics`; the TUI displayed `PCIe to GPU --` or idle-downclocked `Gen2 x16` without exposing the bus capability (`Gen4 x16`). **After this change:** The server and TUI read AMD GPU telemetry on Windows directly via the AMD Display Library (ADL: `atiadlxx.dll`), Windows Performance Data Helper (PDH: `pdh.dll`), and Windows Configuration Manager (PnP: `cfgmgr32.dll`): - **GPU load**: Real-time compute utilization percentage (0–100%) and an animated historical sparkline reflecting real load bursts. - **VRAM**: Accurate dedicated VRAM allocation (`30.7 / 32 GB`) matched against total adapter memory from the Windows display registry. - **GPU temp**: Edge temperature (`52 °C`) with junction hotspot subtitle (`hotspot 53 °C`) and a dynamically scaled thermal sparkline. - **Power**: Total ASIC board power (`41 W` / up to `200+ W` under load) with rolling power sparkline. - **PCIe**: Full link capability (`Gen4 x16`) displayed across both the Web dashboard and TUI Overview without dropping into null or idle-downgrade. ![Strata Web Monitor with AMD GPU Telemetry on Windows](https://raw.githubusercontent.com/YuukiReina2023/Strata/assets/amd_telemetry_monitor.png) ### Related discussion - Issue #1380, #1587 (AMD GPU telemetry on Windows). - Addresses missing telemetry on HIP/Windows setups without adding third-party dependencies or external daemons. ### Approach 1. **Windows AMD GPU Reader (`serve/telemetry.py`):** - Implemented `_AmdWin(_Amd)` using standard `ctypes` bindings to `atiadlxx.dll` and `pdh.dll`. - **PMLog Sensors (ADL)**: - Sensor 19 (`PMLOG_INFO_ACTIVITY_GFX`) / Sensor 20 (`PMLOG_INFO_ACTIVITY_MEM`): Compute activity percentage. - Sensor 8 (`PMLOG_TEMPERATURE_EDGE`) & Sensor 27 (`PMLOG_TEMPERATURE_HOTSPOT`): Edge and junction temperatures. - Sensor 23 (`PMLOG_ASIC_POWER`): Total ASIC power consumption in Watts. - Sensor 40 (`ADL_PMLOG_BUS_SPEED`) & Sensor 41 (`ADL_PMLOG_BUS_LANES`): Current PCIe link speed and width. - **PCIe Link Capability via Windows PnP (`cfgmgr32.dll`)**: - `_windows_pci_link()` queries `DEVPKEY_PciDevice_MaxLinkSpeed` and `DEVPKEY_PciDevice_CurrentLinkWidth` for the active display adapter. This exposes `pcie_gen_max` (e.g. Gen 4) so both Web and TUI properly display the hardware capability (`Gen4 x16`) even when ASPM drops the idle link to Gen 2. - **VRAM and PDH Fallback**: - Dedicated VRAM capacity is resolved via the display driver registry (`HardwareInformation.qwMemorySize`). - Real-time VRAM allocation is measured via `\GPU Local Adapter Memory(*)\Local Usage`. - When ADL is not loaded, PDH `\GPU Engine(*)\Utilization Percentage` provides fallback GPU engine activity. - **Preserves existing Linux sysfs behavior**: `_AmdWin` inherits from `_Amd` and delegates to `super()` whenever `self.dev` exists or in mock unit tests (`SYSFS != "/sys"`). 2. **TUI Overview & Sparkline Animation (`strata_cli/overview.py`):** - Added `_WinPdh` sampler in the CLI to poll ADL/PDH metrics for live local rendering. - Fixed sparkline freeze condition: when the server history was all-zero during initial connection or model reading, `all(x in (None, 0.0) for x in g["util_hist"])` allows active local samples to immediately animate the sparkline instead of locking into a flat empty track. - Prioritized `pcie_gen_max` over idle link downclock so PCIe displays `Gen4 x16`. - Added dynamic temperature bounds scaling (`t_lo`, `t_hi`) to prevent temperature sparklines from flattening. 3. **Client Telemetry Normalization (`strata_cli/client.py`):** - Populated `mem_used`, `mem_total`, `util`, `temp`, `power` for `devices` rows on Windows, ensuring multi-GPU card strips and device views do not display `--`. ### Validation Tested on revision commit `795bbc88` (branch `win-amd-telemetry` rebased on `main`), Windows 11 (build 26100), AMD Radeon PRO W6800 (32 GB, Navi 21 / RDNA2), Driver 32.0.21045.1000, model `qwen3.8-flash-next-iq3_xxs` 256K context: **Passed**: - Live Server Telemetry & Web Dashboard at `http://127.0.0.1:8080`: Observed `/metrics` response contains `gpu_name: "AMD Radeon PRO W6800"`, `gpu_mem_used: 32945180672`, `gpu_mem_total: 34342961152`, `gpu_util: 22.0`, `gpu_temp: 52.0`, `gpu_temp_hotspot: 53.0`, `gpu_power: 41.0`, `gpu_pcie_gen: 2`, `gpu_pcie_gen_max: 4`, `gpu_pcie_width: 16`, and 60 rolling samples in `history.gpu_util`. The Web UI displays 22% GPU load with green wavy activity graph, 30.7 / 32 GB VRAM, 52 °C temp graph, 41 W power graph, and `Gen4 x16` PCIe link. - TUI Overview Live Render (`strata monitor --url http://127.0.0.1:8080`): GPU load tile displays `22 %` with animated sparkline `▁▂▂▂▂▃▂▂▁▁▃▂▁▁▁▁▁▆▂▁`, PCIe tile displays `Gen4 x16` with `to GPU --`, VRAM displays `30.7 / 32 GB` (`3,435 experts cached`), GPU temp displays `52 °C` (`hotspot 53 °C`), Power displays `41 W`. - `serve.test_server.AmdTelemetry`: `python -m unittest serve.test_server.AmdTelemetry -v` -> 3/3 passed (verifies sysfs parsing, free VRAM calculation, and PCIe link hop selection). - `tests.terminal.test_tuiqa_monitor`: `python -m unittest tests.terminal.test_tuiqa_monitor -v` -> 18/18 passed (verifies all monitor views, tab navigation, and themes). - `tools/test_windows_amd_gpu.py`: `python tools/test_windows_amd_gpu.py` -> 5/5 passed (verifies ADL initialization, PDH queries, display adapter registry parsing, and fallback handling). **Failed**: - None observed. **Not run**: - Linux sysfs with physical AMD hardware (verified via unit test mock sysfs tree). - Multi-GPU AMD configurations on Windows (tested on single Radeon PRO W6800). ### Limits - PCIe real-time transfer bandwidth throughput (`pcie_rx_mb`, `pcie_tx_mb`) is only exposed by NVIDIA NVML counters; on AMD GPUs (both Windows and Linux sysfs), throughput is not exposed by the driver and defaults to `--`. Link generation and width (`Gen4 x16`) are fully supported. - ADL PMLog metrics require the standard AMD Radeon Software / PRO Enterprise driver (`atiadlxx.dll`, present on all standard AMD driver installations). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5282
No description provided.