Skip to content

The agent that grows with you

fix(local-runtime): detect Intel and AMD GPUs for auto backend

skyeconcontracting-ctrl8abd6dc2b5ae
diff --git a/hermes_cli/local_runtime/bootstrap.py b/hermes_cli/local_runtime/bootstrap.py
index e12347d0f74..dd4ae9f5da5 100644
--- a/hermes_cli/local_runtime/bootstrap.py
+++ b/hermes_cli/local_runtime/bootstrap.py
@@ -23,15 +23,19 @@ _SUPERVISOR = None # process-wide singleton; one router per Hermes process
def _detect_gpu_vendor() -> str | None:
- """Best-effort GPU vendor for backend selection. NVIDIA via nvidia-smi resolved by the hardware
- probe's PATH-independent ladder (a stripped service PATH must not demote an NVIDIA box to
- vulkan/cpu); anything else defers to select_backend's fallback ladder."""
+ """Best-effort GPU vendor for backend selection.
+
+ Preserve NVIDIA's detailed name when nvidia-smi is available, then use the
+ platform host facts so Intel and AMD do not silently demote ``auto`` to CPU.
+ """
from hermes_cli.local_runtime.hardware import _cached_nvidia_gpu_query
+ from hermes_platform.host.facts import gpu_class
query = _cached_nvidia_gpu_query()
if query is not None and query.get("gpu_name"):
return "nvidia " + query["gpu_name"]
- return None
+ detected = gpu_class()
+ return detected if detected in {"nvidia", "amd", "intel"} else None
def models_dir() -> Path:
diff --git a/tests/hermes_cli/test_local_runtime.py b/tests/hermes_cli/test_local_runtime.py
index 7518b0b98ed..c814ea35249 100644
--- a/tests/hermes_cli/test_local_runtime.py
+++ b/tests/hermes_cli/test_local_runtime.py
@@ -203,6 +203,22 @@ def test_backend_selection(vendor, os_name, expected):
assert select_backend(vendor, os_name=os_name) == expected
[email protected](("gpu_class", "expected"), [
+ ("intel", "intel"),
+ ("amd", "amd"),
+ ("none", None),
+ ("unknown", None),
+])
+def test_auto_vendor_detection_uses_host_gpu_class(monkeypatch, gpu_class, expected):
+ from hermes_cli.local_runtime import bootstrap, hardware
+ from hermes_platform.host import facts
+
+ monkeypatch.setattr(hardware, "_cached_nvidia_gpu_query", lambda: None)
+ monkeypatch.setattr(facts, "gpu_class", lambda: gpu_class)
+
+ assert bootstrap._detect_gpu_vendor() == expected
+
+
# ── supervisor contracts (stubbed; no GPU) ───────────────────