[PR #2360] [CLOSED] telemetry: the Mac's Monitor cards - GPU load and VRAM from IOKit, th… #4004

Closed
opened 2026-11-07 15:32:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2360
Author: @demetree
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: f-mac-monitor


📝 Commits (1)

  • bef1c42 telemetry: the Mac's Monitor cards - GPU load and VRAM from IOKit, the rest said out loud

📊 Changes

4 files changed (+205 additions, -16 deletions)

View changed files

📝 docs/DETAILS.md (+5 -0)
📝 serve/server.py (+8 -11)
📝 serve/telemetry.py (+114 -5)
📝 serve/test_server.py (+78 -0)

📄 Description

…e rest said out loud

On a Mac the Monitor tab's GPU cards were empty: telemetry had NVML (NVIDIA) and the amdgpu sysfs files (#301) and nothing else, so the Metal backend read nothing. The Apple GPU's load and memory are in the IOKit registry's IOAccelerator nodes (ioreg -l -w0 -r -c IOAccelerator, 22 ms), and the device's memory budget is the same Metal property the engine reads (metal/src/mtl_rt.mm's recommended_working_set, the engine's "GPU working set" log line

  • 26,800,603,136 bytes here, which is 25.0 GiB).

_Metal (a new reader beside _Nvml and _Amd): the index'th accelerator node's PerformanceStatistics give Device Utilization % (older chips: the renderer or the tiler) and the in-use system memory; the total is the working set, read through the Metal framework and objc_msgSend (no PyObjC). The temperature and power sensors are not readable without root (powermetrics), and an Apple Silicon GPU sits on the die, so there is no PCIe link: the cards show a dash and static gpu_note says why, the same way #1380's note does for a Windows AMD card. gpu_reader takes amd first, so the AMD trees still read on a Mac for the tests, and a missing selector is asked for before it is sent (an unanswered one raises an Objective-C exception no ctypes call can catch).

Service.free_vram_mib now goes through gpu_reader instead of _Nvml directly, so the Mac gets that reading too (it used to return None there).

Measured on an M1 Max (macOS 26.6.2): through the server, GET /metrics during a request - gpu_name "Apple M1 Max", gpu_vram_total_mib 25559, gpu_util 74-77 % while decoding (9 % once idle), gpu_mem_used 10.5 GiB in use of 24.96 GiB, cpu 12.6 %; the plain-text /prometheus-format metrics carry the same series. serve/test_server.py: MacTelemetry (fixture registry: two accelerators, index selection, renderer/tiler fallback, a raising runner, the note and the samples) plus AmdTelemetry, TelemetryNoDisks, Monitor and the full serve/test_server.py (318 tests) pass on the same box.

What it leaves alone: the NVIDIA and AMD paths (a test-only gpu_reader order change on macOS), and the web app - the cards read the series it already had.

Title

Issue: Resolves #

Summary

What changed

Extra Notes


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2360 **Author:** [@demetree](https://github.com/demetree) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `f-mac-monitor` --- ### 📝 Commits (1) - [`bef1c42`](https://github.com/Niko1221/Strata/commit/bef1c42c812da804d1b50e5b5f38c27030c0cdd1) telemetry: the Mac's Monitor cards - GPU load and VRAM from IOKit, the rest said out loud ### 📊 Changes **4 files changed** (+205 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+5 -0) 📝 `serve/server.py` (+8 -11) 📝 `serve/telemetry.py` (+114 -5) 📝 `serve/test_server.py` (+78 -0) </details> ### 📄 Description …e rest said out loud On a Mac the Monitor tab's GPU cards were empty: telemetry had NVML (NVIDIA) and the amdgpu sysfs files (#301) and nothing else, so the Metal backend read nothing. The Apple GPU's load and memory are in the IOKit registry's IOAccelerator nodes (ioreg -l -w0 -r -c IOAccelerator, 22 ms), and the device's memory budget is the same Metal property the engine reads (metal/src/mtl_rt.mm's recommended_working_set, the engine's "GPU working set" log line - 26,800,603,136 bytes here, which is 25.0 GiB). _Metal (a new reader beside _Nvml and _Amd): the index'th accelerator node's PerformanceStatistics give Device Utilization % (older chips: the renderer or the tiler) and the in-use system memory; the total is the working set, read through the Metal framework and objc_msgSend (no PyObjC). The temperature and power sensors are not readable without root (powermetrics), and an Apple Silicon GPU sits on the die, so there is no PCIe link: the cards show a dash and static gpu_note says why, the same way #1380's note does for a Windows AMD card. gpu_reader takes `amd` first, so the AMD trees still read on a Mac for the tests, and a missing selector is asked for before it is sent (an unanswered one raises an Objective-C exception no ctypes call can catch). Service.free_vram_mib now goes through gpu_reader instead of _Nvml directly, so the Mac gets that reading too (it used to return None there). Measured on an M1 Max (macOS 26.6.2): through the server, GET /metrics during a request - gpu_name "Apple M1 Max", gpu_vram_total_mib 25559, gpu_util 74-77 % while decoding (9 % once idle), gpu_mem_used 10.5 GiB in use of 24.96 GiB, cpu 12.6 %; the plain-text /prometheus-format metrics carry the same series. serve/test_server.py: MacTelemetry (fixture registry: two accelerators, index selection, renderer/tiler fallback, a raising runner, the note and the samples) plus AmdTelemetry, TelemetryNoDisks, Monitor and the full serve/test_server.py (318 tests) pass on the same box. What it leaves alone: the NVIDIA and AMD paths (a test-only gpu_reader order change on macOS), and the web app - the cards read the series it already had. ## Title <!-- If Applicable, reference the GitHub issue --> Issue: Resolves # ## Summary <!-- Quick Summary of changes --> ## What changed <!-- Specifics on files changed, and what changes were made there --> ## Extra Notes <!-- Any extra notes, delete if there are none --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:32:23 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4004
No description provided.