Skip to content

A GPU task manager for Windows, Linux, and WSL: per-process VRAM, GPU activity, and LLM model/KV-cache insights (Windows AMD and NVIDIA).

Python

Add WDDM GPU utilization aggregation

copilot-swe-agent[bot]a3f5f43c7f0b
diff --git a/README.md b/README.md
index 81449f6..f1eefbd 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,8 @@
**An `htop` for what's inside your GPU, not just how full it is.**
-Windows + NVIDIA/AMD, with Linux and WSL support (NVIDIA everywhere, AMD and Intel on native Linux; see
+Windows with NVIDIA/AMD telemetry and Intel WDDM activity, plus Linux and WSL support (NVIDIA
+everywhere, AMD and Intel on native Linux; see
[Linux and WSL](#linux-and-wsl)) and macOS on Apple Silicon (see [macOS](#macos-apple-silicon)). A terminal UI
that connects per-process GPU memory and engine activity with loaded runtimes, model files, and
LLM buffer breakdowns.
@@ -66,7 +67,7 @@ and an installer are not part of this initial distribution. Each ZIP includes li
## Clone and run
-Use **64-bit Windows 10/11**, an **NVIDIA or AMD GPU with a current WDDM driver**, and a terminal
+Use **64-bit Windows 10/11** with a current WDDM driver and a terminal
(Windows Terminal is recommended). Live workload checks have included an RTX 4080 SUPER and an
RTX Spark N1X on Windows ARM64. CUDA workloads are supported on ARM64 with a compatible NVIDIA
driver and ARM64 CUDA runtime.
@@ -76,6 +77,11 @@ During desktop/browser activity, WDDM reported per-process VRAM and AMD ADL repo
clocks, and ASIC power; temperature, memory activity, and PCIe readings were unavailable. Vulkan/ROCm
workloads were not tested on this machine.
+Intel Arc on Windows can use WDDM's per-process memory and engine counters. When those counters are
+available, the device GPU activity is the busiest WDDM engine after combining its process counters.
+Intel temperature, power, clocks, and memory activity are not currently available on Windows.
+Arc B580 behavior is covered by mocked counters but has not been validated on Intel hardware.
+
Install [Git for Windows](https://git-scm.com/downloads/win) and
[uv](https://docs.astral.sh/uv/getting-started/installation/) if needed. With WinGet:
diff --git a/src/gputaskman/app.py b/src/gputaskman/app.py
index 41521fd..67f7897 100644
--- a/src/gputaskman/app.py
+++ b/src/gputaskman/app.py
@@ -67,7 +67,7 @@ This display-only choice applies to all GPUs and resets to full when the app res
| Layer | Source | Works for |
|---|---|---|
-| **Device** telemetry | NVML, AMD ADL, or optional AMD SMI; amdgpu or Intel (i915) sysfs on Linux | availability varies by GPU and driver |
+| **Device** telemetry | NVML, AMD ADL, optional AMD SMI, Intel WDDM activity on Windows; amdgpu or Intel (i915) sysfs on Linux | availability varies by GPU and driver |
| **Per-process** VRAM, spill to RAM, per-engine load | Windows WDDM counters (dxgkrnl); DRM fdinfo for amdgpu or Intel (i915) on Linux | workloads visible to WDDM or DRM |
| **Which runtime** (CUDA, HIP, Vulkan, D3D12, ggml, ONNX, PyTorch...) | DLLs mapped in the process | everything |
| **Which model file** | memory-mapped files + command line | llama.cpp, stable-diffusion.cpp, LM Studio, Ollama |
diff --git a/src/gputaskman/collector.py b/src/gputaskman/collector.py
index b751c5d..484842c 100644
--- a/src/gputaskman/collector.py
+++ b/src/gputaskman/collector.py
@@ -12,7 +12,7 @@ import psutil
from .amdsmi import AmdSmi, _bdf
from .adl import Adl
-from .dxgi import VENDOR_AMD, VENDOR_NVIDIA, VENDOR_HUAWEI, Adapter
+from .dxgi import VENDOR_AMD, VENDOR_NVIDIA, VENDOR_HUAWEI, VENDOR_INTEL, Adapter
from .handy import HandyEvidence, inspect_handy
from .llm import LlmView, ServerProber, api_key, build_view, gb, ollama_log_path
from . import nvml as nvml_mod
@@ -337,7 +337,12 @@ class Collector:
nv = self.ascend.read_device(self.ascend_chip, self.gpu_index)
elif self.adapter and self.adapter.vendor_id != VENDOR_NVIDIA:
# NVML can't describe this GPU, and a sweep of every NVIDIA device costs ~60 ms per device.
- nv = (self.adl.sample() or self.amdsmi.sample()) if self.adapter.vendor_id == VENDOR_AMD else None
+ if self.adapter.vendor_id == VENDOR_AMD:
+ nv = self.adl.sample() or self.amdsmi.sample()
+ elif self.adapter.vendor_id == VENDOR_INTEL and BACKEND == "wddm" and a and a.util_gpu is not None:
+ nv = DeviceTelemetry(index=self.gpu_index, source="Windows WDDM", util_gpu=a.util_gpu)
+ else:
+ nv = None
else:
nvs = self.nvml.sample() if self.nvml.ok else []
nv = select_nv_device(self.adapter, nvs, self.gpu_index, self.adapters)
diff --git a/src/gputaskman/dxgi.py b/src/gputaskman/dxgi.py
index e63bf1c..df34e35 100644
--- a/src/gputaskman/dxgi.py
+++ b/src/gputaskman/dxgi.py
@@ -33,8 +33,9 @@ class _GUID(ctypes.Structure):
_IID_IDXGIFactory1 = _GUID(0x770AAE78, 0xF26F, 0x4DBA, (ctypes.c_ubyte * 8)(0xA8, 0x29, 0x25, 0x3C, 0x83, 0xD1, 0xB3, 0x87))
VENDOR_NVIDIA = 0x10DE
VENDOR_AMD = 0x1002
+VENDOR_INTEL = 0x8086
VENDOR_HUAWEI = 0x19E5 # Ascend NPUs (telemetry via npu-smi, not DRM)
-VENDORS = {0x10DE: "NVIDIA", 0x1002: "AMD", 0x8086: "Intel", 0x19E5: "Ascend",
+VENDORS = {0x10DE: "NVIDIA", 0x1002: "AMD", VENDOR_INTEL: "Intel", 0x19E5: "Ascend",
0x1414: "Microsoft", 0x5143: "Qualcomm"}
diff --git a/src/gputaskman/pdh.py b/src/gputaskman/pdh.py
index 621176f..78d362d 100644
--- a/src/gputaskman/pdh.py
+++ b/src/gputaskman/pdh.py
@@ -113,6 +113,7 @@ class ProcGpu:
class AdapterGpu:
dedicated: float | None = None
shared: float | None = None
+ util_gpu: float | None = None
class GpuCounters:
@@ -174,6 +175,7 @@ class GpuCounters:
if _pdh.PdhCollectQueryData(self._query) != 0:
return {}, {}
procs: dict[int, dict[int, ProcGpu]] = defaultdict(dict)
+ engine_usage: dict[tuple[int, int, int], float] = defaultdict(float)
def proc(luid: int, pid: int) -> ProcGpu:
p = procs[luid].get(pid)
@@ -191,11 +193,17 @@ class GpuCounters:
for name, val in self._read("engine"):
m = _ENGINE_RE.match(name)
if m:
- p = proc(luid_key(m[2], m[3]), int(m[1]))
+ luid = luid_key(m[2], m[3])
+ p = proc(luid, int(m[1]))
p.engines[_norm_engine(m[6])] += val
p.available.add("engine")
+ engine_usage[(luid, int(m[4]), int(m[5]))] += val
adapters: dict[int, AdapterGpu] = defaultdict(AdapterGpu)
+ for (luid, _physical, _engine), usage in engine_usage.items():
+ adapter = adapters[luid]
+ usage = min(100.0, max(0.0, usage))
+ adapter.util_gpu = max(adapter.util_gpu if adapter.util_gpu is not None else 0.0, usage)
for attr, key in (("dedicated", "a_dedicated"), ("shared", "a_shared")):
for name, val in self._read(key):
m = _ADAPTER_RE.match(name)
diff --git a/tests/test_core.py b/tests/test_core.py
index eaaab03..47ed02b 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -277,6 +277,24 @@ class MemoryTests(unittest.TestCase):
self.assertEqual(c.nvml.sample.called, swept)
self.assertIs(s.nv, expected)
+ def test_intel_windows_uses_wddm_adapter_engine_activity(self):
+ c = Collector.__new__(Collector)
+ c.adapter = Adapter(1, "Intel Arc B580", 0x8086, 12 * GiB, 0, False)
+ c.adapters = [c.adapter]
+ c.gpu_index, c.scan_budget, c.host, c.host_status = 0, None, None, ""
+ c.nvml = Mock(ok=False)
+ c.counters = Mock(outside={})
+ c.counters.sample.return_value = (
+ {1: {}}, {1: AdapterGpu(util_gpu=42.0)})
+ c.inspector, c.prober = Mock(), Mock()
+ with patch("gputaskman.collector.BACKEND", "wddm"):
+ s = c.sample()
+ self.assertEqual((s.nv.source, s.nv.util_gpu), ("Windows WDDM", 42.0))
+ self.assertIsNone(s.nv.temp)
+ self.assertIsNone(s.nv.power_w)
+ self.assertIn("GPU 42%", to_text(s))
+ self.assertEqual(to_dict(s)["device"]["util_gpu"], 42.0)
+
def test_lost_nvml_telemetry_is_explained_not_silent(self):
c = Collector.__new__(Collector)
c.adapter = Adapter(1, "RTX 3060", 0x10DE, 12 * GiB, 0, False, (5, 0, 0))
@@ -352,6 +370,20 @@ class MemoryTests(unittest.TestCase):
self.assertEqual(gpu.gpu_pct, 10)
self.assertFalse(gpu.paged_available)
+ def test_wddm_adapter_utilization_uses_busiest_combined_engine(self):
+ counters = GpuCounters.__new__(GpuCounters)
+ counters._query = None
+ data = {"engine": [
+ ("pid_42_luid_0x0_0x1_phys_0_eng_0_engtype_3D", 35.0),
+ ("pid_43_luid_0x0_0x1_phys_0_eng_0_engtype_3D", 40.0),
+ ("pid_43_luid_0x0_0x1_phys_0_eng_1_engtype_Copy", 80.0),
+ ("pid_44_luid_0x0_0x1_phys_0_eng_2_engtype_Compute", 120.0),
+ ]}
+ with patch.object(counters, "_read", side_effect=lambda key: data.get(key, [])), \
+ patch("gputaskman.pdh._pdh", SimpleNamespace(PdhCollectQueryData=lambda query: 0)):
+ _, adapters = counters.sample()
+ self.assertEqual(adapters[1].util_gpu, 100.0)
+
def test_missing_process_counters_are_not_reported_as_zero(self):
s = snapshot()
s.procs[0].gpu.available = {"dedicated"}