Improve profiling with gpu tracing (#969)

* improve profiling with gpu tracing

* fix for linux

* nit

* doc fix

* fix example
This commit is contained in:
Awni Hannun
2024-04-07 21:47:43 -07:00
committed by GitHub
parent bddf23f175
commit aac2f9fb61
13 changed files with 90 additions and 37 deletions

View File

@@ -8,9 +8,10 @@
using namespace mlx::core;
int main() {
// Enable the MLX_METAL_DEBUG CMake option to enhance the capture with groups,
// labels, etc.
assert(metal::start_capture());
// To use Metal debugging and profiling:
// 1. Build with the MLX_METAL_DEBUG CMake option (i.e. -DMLX_METAL_DEBUG=ON).
// 2. Run with MTL_CAPTURE_ENABLED=1.
assert(metal::start_capture("mlx_trace.gputrace"));
// Start at index two because the default GPU and CPU streams have indices
// zero and one, respectively. This naming matches the label assigned to each