Repository navigation
Report the CUDA backend's pinned host memory in /metrics - #541
Merged
Merged
Conversation
The CUDA runtime tracks pinned host bytes (memory.zig's host_bytes, held and freed by HostBuffer) and exposes them in Usage, but readMemory dropped them: cache was hardcoded 0 and the host count never left the engine. api.Memory gains pinned, readMemory fills it, and /metrics emits tensorfold:pinned_memory_bytes beside the device pair (cache keeps its MLX meaning: freed device buffers, per the Python engine's memory_snapshot). The render test asserts the gauge absent when memory is unknown and its value when reported. The last of the device/pinned-memory items CHANGELOG.md (1.0.0 section) lists as planned. Fixes ashhart#538
Contributor
|
Receipt from a DGX Spark (GB10, Nemotron 3.5 Lightning 4-bit @ |
Owner
|
Thank you @GustavBlack. Merged into main (2d02054): |
jschmied
pushed a commit
to jschmied/TensorFold
that referenced
this pull request
Oct 10, 2026
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
…mory Thanks @GustavBlack. Fixes ashhart#538.
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
8 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One-commit change for #538.
The CUDA runtime already tracks pinned host bytes (
memory.zig'shost_bytes, held and freed byHostBuffer) and exposes them inUsage— butreadMemorydropped them (cachehardcoded 0, thehost count never left the engine). The Python engine's
memory_snapshotreports device active /cache / peak (MLX freed-buffer cache semantics for
cache), so pinned host memory gets its ownfield rather than reusing
cache:engine_api.zig:Memorygainspinned: u64 = 0.native/cuda.zig:readMemoryfills.pinned = u.host.server/metrics.zig:tensorfold:pinned_memory_bytesbeside the device pair, same "only wherethe backend counts it (CUDA)" wording; the render test asserts the gauge is absent when memory is
unknown and reports its value when given.
Validated on a GB10 (aarch64, from-source build at
f8fe17din the pinned container): metricstests pass (5/5), and the served
/metricsemits all three gauges live — 19.3 GiB device,19.5 GiB peak, 111,936 B pinned on a freshly served Nemotron checkpoint. (Developed with AI
assistance on our 2×GB10 bring-up testbed; authorship is mine.)