If you've ever worked with Metal and wished for a more in-depth way to analyze performance, debug shaders, and optimize your compute workloads, you might find gpumkat useful. It's a tool designed for macOS that gives detailed insights into GPU kernel execution—going beyond basic profiling to provide metrics like:
✅ Performance Analysis (execution time, memory usage, cache hit rates)
✅ Energy Consumption Tracking (power efficiency breakdowns)
✅ Shader Optimization Recommendations
✅ Thread Execution & Stack Traces
✅ Custom Debugging with Breakpoints & Step-by-Step Execution
✅ Recording Timelines & Async Debugging
It also includes a low-end GPU simulation mode, which is handy if you want to test how your code would perform on constrained hardware.
Installation
To install, just run:
curl -L -o gpumkat.tar.gz https://github.com/MetalLikeCuda/gpumkat/releases/download/%s/gpumkat.tar.gz && tar -xvzf gpumkat.tar.gz && cd gpumkat && sudo sh install.sh
(replace %s
with the latest version number)
Usage
Once installed, running it is as simple as:
gpumkat <path_to_config_file>
It also supports plugins, automatic updates, and various debugging commands.
Example Config
For those who love customization, the config file allows fine-tuned control over debugging, thread execution, async behavior, and more. Here's a small snippet:
{ "metallib_path": "default.metallib", "function_name": "compute_shader", "debug": { "enabled": true, "verbosity_level": 2, "timeline": { "enabled": true, "track_performance": true } } }
Example Kernel
#include <metal_stdlib> using namespace metal; kernel void compute_shader(const device float *input [[buffer(0)]], device float *output [[buffer(1)]], uint index [[thread_position_in_grid]]) { output[index] = input[index] * 2.0; }
Limitations
Some features (like temperature monitoring) rely on simulations rather than hardware-level readings, so if you're doing very low-level profiling, Instruments might be a better fit. But for general Metal debugging, GPUMKAT provides a detailed and structured approach.
This is an opensource project, I am it's creator.
If this sounds useful, you can check it out here:
🔗 GitHub: https://github.com/MetalLikeCuda/gpumkat
submitted by /u/Okerew
[comments]
Source link