feat: Add Apple Silicon GPU support via IOReport API#1541
feat: Add Apple Silicon GPU support via IOReport API#1541aristocratos merged 3 commits intoaristocratos:mainfrom
Conversation
Add GPU monitoring for Apple Silicon Macs using the IOReport framework and IOHIDEventSystem for temperature readings. Metrics supported: - GPU utilization (from GPU Performance States residency) - GPU power consumption (from Energy Model channel) - GPU temperature (from IOHIDEventSystem thermal sensors) - GPU clock speed (from DVFS frequency table + residency weighting) - Memory usage (unified memory architecture, reports system RAM) Implementation follows the existing Nvml/Rsmi/Intel backend pattern with init/shutdown/collect<is_init> template functions in a new AppleSilicon namespace under Gpu. Build system changes: - Enable GPU_SUPPORT on macOS in both CMakeLists.txt and Makefile - Link IOReport library on macOS - Add 'apple' to shown_gpus vendor filter Closes aristocratos#955
…builds - Wrap AppleSilicon::shutdown() call and declaration with #ifdef __APPLE__ so Linux GPU builds don't get undefined reference errors - Add IOReport library linking in CMakeLists.txt for macOS CMake builds
|
Seems to be working fine on an Mac Mini M1 👍 Would you mind creating RAII wrapper classes for the types that needs There is an PR that already covers this #1470, however this PR is a lot more specific (and easier to parse). |
Hello, no problem for me. I can revert the GPU code. I can create a GenericCFObject just to hold via RAII using the directives I made in my iokit.c, if @gneitzke doesn't mind he could use this structure in the implementation to be in accordance with RAII |
- Add CFRef<T> template for CoreFoundation types (CFRelease) - Add IORef wrapper for IOKit object types (IOObjectRelease) - Refactor GPU code to use RAII wrappers for all local CF/IO objects - Add 'apple' to shown_gpus description in btop_menu.cpp
|
@gneitzke Is this generic for all Apple Silicon GPU's (so far)? |
It should be, I ran it on my m3 max and it works great. |
|
Thanks for contributing! |
Add GPU monitoring for Apple Silicon Macs using the IOReport framework and IOHIDEventSystem for temperature readings.
Metrics supported:
Implementation follows the existing Nvml/Rsmi/Intel backend pattern with init/shutdown/collect<is_init> template functions in a new AppleSilicon namespace under Gpu.
Build system changes:
Closes #955