1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Benchmark-only diagnostics (feature `bench`).
//!
//! MLX memory instrumentation re-exposed from the private engine so the
//! MTP benchmark harness (`examples/mtp_bench.rs`) can attribute peak
//! and cache memory per benchmark cell. Not part of the supported
//! public API - the `bench` feature exists for the MTP benchmark harness
//! and may change without notice.
/// Peak bytes MLX has held in buffers since the last reset.
///
/// # Errors
///
/// Returns an MLX diagnostic failure.
/// Reset the peak-memory watermark (call at the start of a cell run).
///
/// # Errors
///
/// Returns an MLX diagnostic failure.
/// Bytes MLX currently holds in live buffers.
///
/// # Errors
///
/// Returns an MLX diagnostic failure.
/// Bytes MLX holds in freed-but-cached buffers awaiting reuse. The
/// 2 GiB freed-buffer cache carries kernel/buffer warmth across cells;
/// record it per cell so interleaved runs stay comparable.
///
/// # Errors
///
/// Returns an MLX diagnostic failure.