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

@@ -2,6 +2,7 @@
#include "mlx/backend/metal/metal.h"
#include <nanobind/nanobind.h>
#include <nanobind/stl/string.h>
namespace nb = nanobind;
using namespace nb::literals;
@@ -88,4 +89,24 @@ void init_metal(nb::module_& m) {
Returns:
int: The previous cache limit in bytes.
)pbdoc");
metal.def(
"start_capture",
&metal::start_capture,
"path"_a,
R"pbdoc(
Start a Metal capture.
Args:
path (str): The path to save the capture which should have
the extension ``.gputrace``.
Returns:
bool: Whether the capture was successfully started.
)pbdoc");
metal.def(
"stop_capture",
&metal::stop_capture,
R"pbdoc(
Stop a Metal capture.
)pbdoc");
}