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
Merge upstream model discovery updates
Scott Hanselmane191df5e7814
diff --cc README.mdindex 3026ce3,06e35ea..919b64c--- a/README.md+++ b/README.md@@@ -180,9 -175,22 +187,23 @@@ reading is NVML's memory-activity perce| llama.cpp / llama-server | GGUF discovery, CLI settings, buffer logs, `/props` + `/v1/models` state; exercised live || Ollama | Bundled runners, mapped GGUF blobs named from Ollama manifests (`qwen3:14b`), parent `/api/ps`, compatible `server.log`; exercised live || LM Studio | Mapped files named from its models folder, `/api/v1/models` (falls back to `/api/v0/models`); tested with fixture responses, not yet end to end |+| stable-diffusion.cpp (`--diffusion-model`) | Diffusion, text-encoder and VAE files from launch arguments; no LLM memory breakdown || Hugging Face cache | `models--org--repo` paths are named `org/repo` || Other AI runtimes | DLL detection, plus model files installed with the app (marked *not proven loaded*) |+ | Handy | Local speech workloads are in scope; runtime DLLs/mapped files and installed candidates are inspected. A selected/downloaded speech model alone is not proof of GPU residency or use |+ | WinML / local helper processes | GPU-backed execution is in scope; generic process counters and runtime detection only. No WinML-specific model/session or client-to-helper attribution yet |+ | Windows Studio Effects | Only any observable GPU portion is in scope. NPU inference is out of scope; do not interpret GPU camera/render activity as proof of model execution |++ WinML can select different execution backends; a local helper/service is still **local**, not+ cloud-hosted. The GPU counters belong to whichever process holds/uses the GPU resources.+ Parent-PID lookup currently helps find Ollama/LM Studio APIs; it is not a general cross-process+ ownership graph for shared Windows services.++ GPU-backed WinML and Studio Effects paths have **not been validated on a Copilot+ PC**. A future+ hardware check should compare idle versus active workload samples, record the actual GPU adapter+ and resource-owning PID (including helpers), and verify the execution provider using runtime+ diagnostics. Match any reported model/session to that PID before claiming attribution. If execution+ is CPU/NPU-only, record it as out of scope rather than a missing GPU model. No NPU collector is planned.### How models are identifieddiff --cc src/gputaskman/app.pyindex 5864756,8ff3204..78c7bc7--- a/src/gputaskman/app.py+++ b/src/gputaskman/app.py@@@ -19,11 -19,10 +19,11 @@@ from textual.worker import get_current_from .collector import Collector, ProcRow, Snapshotfrom .llm import gb+from .nvml import format_metricKIND_STYLE = {- "LLM": "bold magenta", "decision": "bold orchid", "embedding": "plum2", "speech": "light_sky_blue1",- "diffusion": "orchid",+ "LLM": "bold magenta", "decision": "bold orchid", "decision?": "orchid",- "embedding": "plum2", "speech": "light_sky_blue1",++ "embedding": "plum2", "speech": "light_sky_blue1", "diffusion": "orchid","AI": "medium_purple1", "compute": "orange3", "3D/game": "green3","video": "yellow", "browser": "dodger_blue2", "app": "cyan", "compositor": "grey50","kernel": "grey50", "system": "grey50",diff --cc src/gputaskman/procinfo.pyindex 51d6535,2302ed1..6ef0601--- a/src/gputaskman/procinfo.py+++ b/src/gputaskman/procinfo.py@@@ -41,7 -41,8 +41,8 @@@ LLM_NAMES = ("llama-", "llama.", "ollam# GGUF file kind -> process kind, in display priority orderMODEL_KINDS = {"LLM": "LLM", "decision model": "decision", "embedding model": "embedding","reranker": "embedding", "speech model": "speech"}- AI_KINDS = {"LLM", "decision", "embedding", "speech", "diffusion", "AI"}-AI_KINDS = {"LLM", "decision", "decision?", "embedding", "speech", "AI"}++AI_KINDS = {"LLM", "decision", "decision?", "embedding", "speech", "diffusion", "AI"}+ _DECISION_NAME = re.compile(r"(?<![a-z0-9])(?:openjev|laya|julia-1|lev|kev)(?![a-z0-9])", re.I)MiB = 1 << 20INSTALLED_TTL = 300.0_SKIP_DIRS = {"ebwebview", "cache", "code cache", "gpucache", "node_modules", "logs", "crashpad", "locales", "__pycache__"}@@@ -57,11 -58,12 +58,16 @@@ class MappedModelsources: list[str] = field(default_factory=lambda: ["mapped"]) # mapped | cmdline | api | installedstore_name: str | None = None # e.g. "qwen3:14b" from an Ollama manifestkind: str = "" # GGUF kind: LLM, decision model, embedding model, ...+ kind_hint: str = "" # name-based suggestion only; never changes loading evidence or GGUF math++ @property+ def kind_label(self) -> str:+ return f"likely {self.kind_hint} (name)" if self.kind_hint else self.kind+ def add_source(self, source: str) -> None:+ if source not in self.sources:+ self.sources.append(source)+@propertydef evidence(self) -> str:s = set(self.sources)@@@ -338,9 -339,7 +353,9 @@@ def classify(d: ProcDetail, engines: direturn "compositor"if n in ("csrss.exe", "winlogon.exe", "lsass.exe", "svchost.exe"):return "system"+ if d.is_diffusion:+ return "diffusion"- kinds = {MODEL_KINDS[m.kind] for m in d.models if m.kind in MODEL_KINDS}+ kinds = {MODEL_KINDS[m.kind] for m in d.models if m.kind in MODEL_KINDS and not m.kind_hint}for k in ("LLM", "decision", "embedding", "speech"):if k in kinds:return kdiff --cc tests/test_core.pyindex 4b07b04,2bae915..74131ab--- a/tests/test_core.py+++ b/tests/test_core.py@@@ -16,10 -16,9 +17,10 @@@ from gputaskman.dxgi import Adaptefrom gputaskman.gguf import GgufInfo, read_gguffrom gputaskman.llm import (LlmView, ServerInfo, build_view, is_gpu_device, llama_server_models, lmstudio_models,parse_flags, parse_load_log, probe_server)+from gputaskman.nvml import NvDevicefrom gputaskman.pdh import GpuCounters, ProcGpu- from gputaskman.procinfo import (MappedModel, ProcDetail, ProcInspector, _is_model_file, _models_from_cmdline,- classify, installed_models)-from gputaskman.procinfo import (AI_KINDS, MappedModel, ProcDetail, ProcInspector, _is_model_file, classify,- installed_models, make_model)++from gputaskman.procinfo import (AI_KINDS, MappedModel, ProcDetail, ProcInspector, _is_model_file,++ _models_from_cmdline, classify, installed_models, make_model)from gputaskman.report import to_dict, to_textfrom gputaskman.stores import store_namefrom tools.capture_screenshots import for_publication@@@ -161,19 -114,6 +162,22 @@@ class MemoryTests(unittest.TestCase)class ModelTests(unittest.TestCase):+ def test_diffusion_arguments_do_not_classify_text_encoder_as_llm(self):+ with tempfile.TemporaryDirectory() as directory:+ paths = [Path(directory) / name for name in ("diffusion.gguf", "encoder.gguf", "vae.safetensors")]+ for path in paths:+ path.touch()+ cmd = ["sd-cli.exe", "--diffusion-model", str(paths[0]),+ f"--llm={paths[1]}", "--vae", str(paths[2])]+ self.assertEqual(_models_from_cmdline(cmd), [str(path) for path in paths])+ self.assertEqual(_models_from_cmdline(["sd-cli.exe", f"--diffusion-model={paths[0]}"]), [str(paths[0])])+ d = ProcDetail(1, "sd-cli.exe", cmdline=cmd, runtimes=["ggml"],+ models=[MappedModel(str(paths[1]), 0, 0, True, kind="LLM")])+ self.assertEqual(classify(d, {}), "diffusion")++ d.models[0].kind_hint = "decision model"++ self.assertEqual(classify(d, {}), "diffusion")++ self.assertIn("diffusion", AI_KINDS)+def test_layer_and_kv_estimates(self):model = GgufInfo(path="model.gguf", file_size=1000, version=3,@@@ -400,34 -407,29 +504,55 @@@ class IdentityTests(unittest.TestCase)self.assertEqual(len(ollama), 1)self.assertIn("qwen3:14b", ollama[0])+ def test_runner_and_host_apis_do_not_duplicate_evidence(self):+ qwen = gguf("qwen3", block_count=1, context_length=4096)+ model = MappedModel("blob", 1000, 0, True, ["cmdline"], "qwen3:4b", "LLM")+ detail = ProcDetail(6, "llama-server.exe", models=[model])+ runner = ServerInfo("llama-server", "http://127.0.0.1:1", model_path="blob")+ host = ServerInfo("ollama", "http://127.0.0.1:2", models=[{"name": "qwen3:4b", "ctx": 4096}])+ with patch("gputaskman.llm.read_gguf", return_value=qwen):+ view = build_view(detail, GiB, 0, runner, host=host)+ self.assertEqual(view.files[0].sources, ["cmdline", "api"])+ self.assertEqual(model.sources, ["cmdline"])+class UiTests(unittest.IsolatedAsyncioTestCase):+ async def test_unavailable_device_metrics_render_as_na(self):+ with patch.object(GpuTaskManager, "poll"):+ app = GpuTaskManager()+ async with app.run_test(size=(140, 42)):+ s = snapshot()+ s.nv = NvDevice(index=0, util_mem=0, power_w=2.4, pcie_tx_kbs=0)+ app.apply(s)+ lines = "\n".join(line.plain for line in app.render_device(s).renderables)+ self.assertIn("2/N/A W", lines)+ self.assertIn("P N/A", lines)+ self.assertIn("PCIe↓ N/A", lines)+ self.assertNotIn("None", lines)+ self.assertIsNone(app.hist_util[-1])+ self.assertEqual(app.hist_bw[-1], 0)++ async def test_likely_kind_is_explicit_in_process_and_inspector(self):+ g = gguf("qwen35", block_count=2, context_length=4096, **{"general.name": "Snapshot_Cfg"})+ with patch.object(GpuTaskManager, "poll"):+ app = GpuTaskManager()+ async with app.run_test(size=(240, 50)) as pilot:+ for ext in ("gguf", "safetensors"):+ with self.subTest(format=ext):+ with patch("gputaskman.procinfo.read_gguf", return_value=g):+ m = make_model(f"OpenJev.{ext}", 1000, 0, ext == "gguf", "mapped", "")+ d = ProcDetail(10, "llama-server.exe", models=[m])+ with patch("gputaskman.llm.read_gguf", return_value=g):+ v = build_view(d, GiB, 0, None)+ s = snapshot()+ s.procs[0] = ProcRow(10, d.name, classify(d, {}), ProcGpu(dedicated=GiB), d, v)+ app.apply(s)+ await pilot.pause()+ self.assertEqual(app.query_one("#procs").get_row("10")[2].plain, "decision?")+ text = " ".join(ET.fromstring(app.export_screenshot()).itertext()).replace("\u00a0", " ")+ self.assertIn("likely decision model (name)", text)+ self.assertIn("in use (mapped)", text)+async def test_navigation_sort_pause_and_help(self):with patch.object(GpuTaskManager, "poll"):app = GpuTaskManager()