Skip to content

fix(dashboard-api): wire Apple Silicon into /api/gpu/detailed#1025

Merged
Lightheartdevs merged 1 commit intoLight-Heart-Labs:mainfrom
yasinBursali:fix/gpu-detailed-apple-silicon
Apr 27, 2026
Merged

fix(dashboard-api): wire Apple Silicon into /api/gpu/detailed#1025
Lightheartdevs merged 1 commit intoLight-Heart-Labs:mainfrom
yasinBursali:fix/gpu-detailed-apple-silicon

Conversation

@yasinBursali
Copy link
Copy Markdown
Contributor

What

Wire Apple Silicon GPU detection into /api/gpu/detailed so the endpoint returns real data instead of a 503 on macOS.

Why

_get_raw_gpus in routers/gpu.py only had a branch for amd, then fell through to NVIDIA/AMD sysfs probing — both return None on macOS, yielding an empty list. The existing get_gpu_info_apple() call (already used by /api/features) was never consulted, so every call to /api/gpu/detailed on Apple Silicon returned 503 No GPU data available.

How

  • routers/gpu.py: import get_gpu_info_apple alphabetically into the existing from gpu import (...) block; add private helper _apple_info_to_individual(info: GPUInfo) -> IndividualGPU that wraps the aggregate GPUInfo into a single IndividualGPU with index=0 and uuid="apple-unified-0" (≥8 chars, satisfies GPUCard.jsx .slice(-8) key requirement); add "apple" as the first branch in _get_raw_gpus, returning [_apple_info_to_individual(info)] or None if detection fails (propagates to the existing 503 path).
  • tests/test_gpu_detailed.py: new fixture _sample_apple_gpu_info(); 3 new tests covering single-entry return, None-propagation, and full endpoint 200 response with Apple aggregate data.

Testing

  • Automated: pytest tests/test_gpu_detailed.py -k "not history" — 19/19 pass; ruff clean.
  • Manual: On Apple Silicon Mac, curl -H "Authorization: Bearer $DASHBOARD_API_KEY" http://localhost:$DASHBOARD_API_PORT/api/gpu/detailed should return HTTP 200 with a single-entry gpus array (chip name, VRAM, utilization 0, temperature 0, power_w null).

Known Considerations

  • Apple GPU utilization and temperature are hard-zero in this implementation — IOKit metrics are not accessible from Python in this context. A future PR could expose them via powermetrics or direct IOKit bindings. Out of scope here.
  • power_w is None on Apple; the dashboard already handles this gracefully.

Platform Impact

  • macOS (Apple Silicon): Fixed — /api/gpu/detailed now returns 200 with GPU data.
  • Linux (NVIDIA/AMD): Not affected — new branch is gated on exact string "apple"; existing NVIDIA/AMD paths unchanged.
  • Windows (WSL2): Not affected — same as Linux; Apple branch never executes.

/api/gpu/detailed returned 503 "No GPU data available" on Apple
Silicon because `_get_raw_gpus` only branched on `amd` and fell
through to NVIDIA→AMD detection (both return None on macOS),
producing an empty list even though `get_gpu_info_apple()` was
available and worked fine (already used by /api/features).

Add an apple branch to `_get_raw_gpus` that wraps the aggregate
`GPUInfo` into a single-entry list of `IndividualGPU`. Synthesize a
stable `uuid="apple-unified-0"` (>=8 chars to satisfy GPUCard.jsx's
`.slice(-8)` key) and `index=0`. Utilization / temperature stay
hard-zero on Apple (IOKit isn't accessible from Python here);
power_w remains None. The dashboard already handles `power_w = null`
and zero-valued utilization/temperature gracefully.

NVIDIA / AMD / CPU paths are unchanged — the new branch is gated on
the exact string "apple".
@Lightheartdevs Lightheartdevs merged commit 5893142 into Light-Heart-Labs:main Apr 27, 2026
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants