Files
hermes-agent/tests/hermes_platform/test_gpu_adapters.py
emozilla 7cc440395e fix(local-models): size a Windows integrated GPU from what Windows lets it allocate
With no nvidia-smi answer and no discrete engine device, probe_budget budgeted
all of RAM as unified memory. Windows caps an integrated GPU at its GPU memory
(DXGI dedicated plus shared, Task Manager's figure): an Arc B390 on a 31.5 GB
machine gets 18 GB, yet Local Models showed 31.5 GB and priced the 27B as
fitting. The pool is now capped at that figure, read through DXGI for the
adapter the engine named, else the only non-NVIDIA adapter when a Vulkan or HIP
engine will run the model. The CPU engine keeps the RAM budget, whether the
user chose it or it is the only build for the machine (a Snapdragon). The
engine's own number would overshoot: ggml-vulkan sums every heap of an
integrated GPU, host-visible ones included. The DXGI reader is a cached host
fact in hermes_platform. The cap only lowers the pool; CPU-only machines,
other platforms and a failed DXGI read keep the RAM figure.
2026-10-09 00:44:27 -04:00

21 lines
612 B
Python

"""DXGI's adapter list, read live on Windows."""
from __future__ import annotations
import pytest
from hermes_platform.host.gpu_adapters import windows_gpu_adapters
@pytest.mark.platforms("windows")
def test_dxgi_lists_this_machines_adapters() -> None:
found = windows_gpu_adapters()
assert found, "DXGI lists at least Microsoft's software adapter"
assert any(a.software for a in found)
assert all(a.shared_bytes > 0 and a.dedicated_bytes >= 0 for a in found)
@pytest.mark.platforms("not windows")
def test_dxgi_answers_empty_off_windows() -> None:
assert windows_gpu_adapters() == ()