[PR #1871] [CLOSED] Dashboard: GPU load, VRAM, temperature, power and PCIe for AMD cards … #3726

Closed
opened 2026-11-07 15:30:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1871
Author: @WeisTekEng
Created: 10/10/2026
Status: ❌ Closed

Base: main ← Head: amd-win-telemetry


📝 Commits (2)

  • a1fd8c5 Dashboard: GPU load, VRAM, temperature, power and PCIe for AMD cards on Windows (#1380)
  • 5f86974 Merge branch 'main' into amd-win-telemetry

📊 Changes

4 files changed (+593 additions, -9 deletions)

View changed files

📝 serve/telemetry.py (+402 -8)
📝 serve/test_server.py (+1 -0)
➕ serve/test_telemetry_amd_windows.py (+189 -0)
📝 serve/web/app.js (+1 -1)

📄 Description

Title

Dashboard: GPU load, VRAM, temperature, power and PCIe for AMD cards on Windows

Issue: Resolves #1380

Summary

On Windows with an AMD card the Monitor dashboard showed nothing for GPU load, VRAM, temperature, power or PCIe, because serve/telemetry.py could only read the amdgpu sysfs files, which exist only on Linux. This adds a Windows reader that gets the same readings from DXGI, the performance counters, AMD's ADL library and the PCI device properties. Each source is optional: whatever fails to start leaves its readings empty and the others still show.

Tested on an RX 9070 XT Nitro+ (gfx1201), Windows, Ryzen 9 5900X. python -m serve.telemetry 0 amd on that PC:

GPU 0: AMD Radeon RX 9070 XT
sources: {'pdh': True, 'adl': True, 'pci': True}
ADL supported sensors (id: value): {1: 261, 2: 2786, 8: 25, 9: 28, 14: 3656, 15: 100, 19: 0, 20: 0, 21: 794, 27: 27, 38: 0, 39: 0, 40: 3, 41: 16, 46: 0, 47: 0, 48: 0, 49: 0, 58: 4, 73: 49}
{'util': 7.0, 'mem_used': 15658614784.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 54.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16}
{'util': 7.0, 'mem_used': 15660449792.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 52.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16}
{'util': 2.0, 'mem_used': 15660449792.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 45.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16}
{'util': 3.0, 'mem_used': 15657566208.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 45.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16}
{'util': 5.0, 'mem_used': 15647342592.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 46.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16}
{'util': 5.0, 'mem_used': 15657566208.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 47.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16}
{'util': 4.0, 'mem_used': 15657566208.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 44.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16}
{'util': 5.0, 'mem_used': 15657566208.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 45.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16}
image

What changed

  • serve/telemetry.py
    • New _AmdWin reader, chosen by gpu_reader() for the AMD backend on Windows. Linux and NVIDIA paths are unchanged.
    • DXGI: the card's name, device id, LUID and total VRAM. Adapters are ordered like HIP numbers them (an integrated Radeon first, then discrete cards), so --gpu selects the same card.
    • Performance counters (GPU Engine, GPU Adapter Memory) matched by the card's LUID: load (the busiest engine, as Task Manager shows) and VRAM in use. The query is reopened every 15 reads, and the last good value is kept for up to 3 empty reads.
    • ADL (atiadlxx.dll, installed with the Adrenalin driver), PMLog sensors: temperature, power and load. ADL reports AMD's vendor id as the decimal 1002, not 0x1002, so both are accepted.
    • SetupAPI PCI link properties: current and maximum PCIe generation, and width.
    • A source that does not start records why (errors), and python -m serve.telemetry [index] [amd] prints it with eight seconds of readings, so a problem on someone's PC can be diagnosed without starting the server.
    • The gpu_note text no longer says "Windows" or "Linux" and names what was tried.
  • serve/web/app.js: the VRAM tile's fallback text is now "not available" instead of "not available on Windows AMD yet".
  • serve/test_telemetry_amd_windows.py (new, 17 tests): parsing, sensor choice, adapter ordering, ctypes struct sizes, and the fallbacks, with the Windows APIs faked so they run anywhere.
  • serve/test_server.py: AmdTelemetry is pinned to the Linux reader (@mock.patch("serve.telemetry.IS_WIN", False)). Those tests fake a sysfs tree and call gpu_reader(…, amd=True), so on a Windows machine they were getting the new reader and failing.

Extra Notes

  • No new dependencies: everything is ctypes against DLLs Windows or the AMD driver already provide. No admin rights needed.
  • PCIe throughput can't be read on Windows, so that tile shows the link (for example Gen5 x16) but no MB/s. The Windows reader also doesn't fill the pcie_path / pcie_own_gen keys from #1733, which are specific to the Linux sysfs walk.
  • Two behaviours change on Windows AMD because they read the same values: gpu_busy (which uses the load reading) can now see a busy GPU, and free_vram_mib now returns a value instead of None. As far as I can tell both are only used when configured or by the watchdog, but please double-check.
  • Only tested on one machine. Not tested: other Radeon cards, a PC with an integrated GPU plus a discrete one (the ordering follows #325 but is unverified), or two identical cards (ADL is matched by PCI device id, so it could pick the wrong one).
  • ADL's units (temperature in °C, power in W) come from AMD's sensor definitions. The probe above shows 25 °C and 44-54 W at idle, which matches the board power sensor (49 W) in the supported-sensors line.
  • Needs the Adrenalin driver for ADL. Without it, load, VRAM and PCIe still show.

🔄 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/1871 **Author:** [@WeisTekEng](https://github.com/WeisTekEng) **Created:** 10/10/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `amd-win-telemetry` --- ### 📝 Commits (2) - [`a1fd8c5`](https://github.com/Niko1221/Strata/commit/a1fd8c50f2b053f40e2c38202f3855d9adb54c41) Dashboard: GPU load, VRAM, temperature, power and PCIe for AMD cards on Windows (#1380) - [`5f86974`](https://github.com/Niko1221/Strata/commit/5f869744f9423c5983fa6287d403940f53fa016e) Merge branch 'main' into amd-win-telemetry ### 📊 Changes **4 files changed** (+593 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `serve/telemetry.py` (+402 -8) 📝 `serve/test_server.py` (+1 -0) ➕ `serve/test_telemetry_amd_windows.py` (+189 -0) 📝 `serve/web/app.js` (+1 -1) </details> ### 📄 Description ## Title Dashboard: GPU load, VRAM, temperature, power and PCIe for AMD cards on Windows Issue: Resolves #1380 <!-- check this is the right issue: it is the one telemetry.py's own comment names for "no GPU load or VRAM readings for AMD cards on Windows". Use "Refs #1380" if it asks for more than this --> ## Summary On Windows with an AMD card the Monitor dashboard showed nothing for GPU load, VRAM, temperature, power or PCIe, because `serve/telemetry.py` could only read the amdgpu sysfs files, which exist only on Linux. This adds a Windows reader that gets the same readings from DXGI, the performance counters, AMD's ADL library and the PCI device properties. Each source is optional: whatever fails to start leaves its readings empty and the others still show. Tested on an RX 9070 XT Nitro+ (gfx1201), Windows, Ryzen 9 5900X. `python -m serve.telemetry 0 amd` on that PC: ``` GPU 0: AMD Radeon RX 9070 XT sources: {'pdh': True, 'adl': True, 'pci': True} ADL supported sensors (id: value): {1: 261, 2: 2786, 8: 25, 9: 28, 14: 3656, 15: 100, 19: 0, 20: 0, 21: 794, 27: 27, 38: 0, 39: 0, 40: 3, 41: 16, 46: 0, 47: 0, 48: 0, 49: 0, 58: 4, 73: 49} {'util': 7.0, 'mem_used': 15658614784.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 54.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16} {'util': 7.0, 'mem_used': 15660449792.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 52.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16} {'util': 2.0, 'mem_used': 15660449792.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 45.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16} {'util': 3.0, 'mem_used': 15657566208.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 45.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16} {'util': 5.0, 'mem_used': 15647342592.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 46.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16} {'util': 5.0, 'mem_used': 15657566208.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 47.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16} {'util': 4.0, 'mem_used': 15657566208.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 44.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16} {'util': 5.0, 'mem_used': 15657566208.0, 'mem_total': 16977723392, 'temp': 25.0, 'power': 45.0, 'pcie_gen': 5, 'pcie_gen_max': 5, 'pcie_width': 16} ``` <img width="1207" height="1115" alt="image" src="https://github.com/user-attachments/assets/6f17a6c0-449e-459b-bcf8-f6c47da934d8" /> ## What changed - `serve/telemetry.py` - New `_AmdWin` reader, chosen by `gpu_reader()` for the AMD backend on Windows. Linux and NVIDIA paths are unchanged. - DXGI: the card's name, device id, LUID and total VRAM. Adapters are ordered like HIP numbers them (an integrated Radeon first, then discrete cards), so `--gpu` selects the same card. - Performance counters (`GPU Engine`, `GPU Adapter Memory`) matched by the card's LUID: load (the busiest engine, as Task Manager shows) and VRAM in use. The query is reopened every 15 reads, and the last good value is kept for up to 3 empty reads. - ADL (`atiadlxx.dll`, installed with the Adrenalin driver), PMLog sensors: temperature, power and load. ADL reports AMD's vendor id as the decimal 1002, not 0x1002, so both are accepted. - SetupAPI PCI link properties: current and maximum PCIe generation, and width. - A source that does not start records why (`errors`), and `python -m serve.telemetry [index] [amd]` prints it with eight seconds of readings, so a problem on someone's PC can be diagnosed without starting the server. - The `gpu_note` text no longer says "Windows" or "Linux" and names what was tried. - `serve/web/app.js`: the VRAM tile's fallback text is now "not available" instead of "not available on Windows AMD yet". - `serve/test_telemetry_amd_windows.py` (new, 17 tests): parsing, sensor choice, adapter ordering, ctypes struct sizes, and the fallbacks, with the Windows APIs faked so they run anywhere. - `serve/test_server.py`: `AmdTelemetry` is pinned to the Linux reader (`@mock.patch("serve.telemetry.IS_WIN", False)`). Those tests fake a sysfs tree and call `gpu_reader(…, amd=True)`, so on a Windows machine they were getting the new reader and failing. ## Extra Notes - No new dependencies: everything is ctypes against DLLs Windows or the AMD driver already provide. No admin rights needed. - PCIe throughput can't be read on Windows, so that tile shows the link (for example Gen5 x16) but no MB/s. The Windows reader also doesn't fill the `pcie_path` / `pcie_own_gen` keys from #1733, which are specific to the Linux sysfs walk. - Two behaviours change on Windows AMD because they read the same values: `gpu_busy` (which uses the load reading) can now see a busy GPU, and `free_vram_mib` now returns a value instead of None. As far as I can tell both are only used when configured or by the watchdog, but please double-check. - Only tested on one machine. Not tested: other Radeon cards, a PC with an integrated GPU plus a discrete one (the ordering follows #325 but is unverified), or two identical cards (ADL is matched by PCI device id, so it could pick the wrong one). - ADL's units (temperature in °C, power in W) come from AMD's sensor definitions. The probe above shows 25 °C and 44-54 W at idle, which matches the board power sensor (49 W) in the supported-sensors line. - Needs the Adrenalin driver for ADL. Without it, load, VRAM and PCIe still show. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:30:20 +07:00
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#3726
No description provided.