Repository navigation
Conversation
Every SSD restore now says where its time went: reading blobs from disk, copying them into MLX arrays and the GPU evaluation, plus the bytes read. The split is in the "SessionBank SSD restored" log line, in the restore record and in the request log (ssd_restore_read_s, ssd_restore_copy_s, ssd_restore_eval_s, ssd_restore_other_s, ssd_restore_bytes), with running totals in the cold-tier stats. The codec adds to a context-local counter that only a restore sets, so the lazy boundary loader and the encode stay untimed. Every RAM and SSD restore records where it landed: tokens matched, the recurrent checkpoint it resumed at, the gap between the two, the suffix prefilled and whether the entry came from the same conversation. The request log carries prefix_restore_* fields; /health sums them per source under session_bank.restore_landings. The writer counts the bytes it put on disk and the bytes it found already there, checkpoint blobs apart from the rest, in one-minute buckets over a rolling hour, next to the hourly write budget (write_volume in /health ssd_session_cache and /admin/cache/ssd).
…tched MTP lane Both lanes restore through the session bank outside generation's restore_or_prefill and recorded no landing, so their requests carried zeros. They now build the same served record (served_restore_record), count the landing in the bank's restore_landings and fill the request fields: prefix_restore_* always, and the SSD restore split with ssd_cache_hit, ssd_restore_s and ssd_cached_tokens when the entry came from the SSD tier. Gemma 4 has no recurrent layers: its restores land on the matched length, recorded as restore point equal to the match and a gap of 0. The Gemma 4 prompt state takes the request's session id for the same/other-session origin; the restore itself does not use it. A failure in the batched lane's telemetry never turns its restore into a miss.
… SSD A KV-only model (no recurrent state) restored through the regular path lands on the matched length: restore point equals the match, the gap is 0 and hybrid is false, with the same/other-session origin. The SSD restores also fill the restore split. Covers the exact and the prefix restore from RAM and from the SSD tier.
A deduplicated blob was either referenced by a memo (never evaluated, copied or hashed) or captured and hashed and only then found on disk. The write volume counted both as deduplicated, and the spill path never counted its dedupe hits at all, so the wasted capture and hash work was invisible. Each write now reports referenced, hashed-duplicate and hashed-new blobs and bytes, with the capture and hash seconds of the hashed ones (write_* counters and last_write_split in /health ssd_session_cache and /admin/cache/ssd), and write_volume splits its deduplicated bytes into deduped_referenced_bytes_* and deduped_hashed_bytes_*. deduped_blob_hits now counts spill writes too. Two perf_counter calls per captured blob.
jvmenen
pushed a commit
to jvmenen/MTPLX
that referenced
this pull request
Oct 20, 2026
This branch has not been deployed
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.
Why
The SSD session cache reports one number per restore,
ssd_restore_s. That cannot tell whether a slow restore waits on the disk, on copying into arrays or on the GPU. It also cannot tell, on hybrid models where recurrent layers resume only at a stored checkpoint, how much of a matched prompt is computed again. And it does not show how much the cache writes compared with its hourly write budget. Those are the numbers that decide what to improve next.How it works, in plain terms
restore_s. Outside a restore nothing is timed.What changes
ssd_restore_read_s,ssd_restore_copy_s,ssd_restore_eval_s,ssd_restore_other_s,ssd_restore_bytes, andprefix_restore_matched_tokens,prefix_restore_point_tokens,prefix_restore_checkpoint_gap_tokens,prefix_restore_partial,prefix_restore_origin.read_s,copy_s,eval_sandbytes./healthand/admin/cache/ssd:write_volume, with written and deduplicated bytes per hour and since start, and the share of the write budget used;session_bank.restore_landingscounters per source.mtplx/cache_bank/telemetry.py; small changes in the codec, cold tier, session bank, generation, the Gemma 4 assistant path and the server. No restore or write decision changes.Cost
On an M5 Pro: 3.6 ms on a restore of 20,000 blobs (one second or more), and 1.3 ms per written entry on the writer thread.
Tests
tests/test_cold_tier_telemetry.pyandtests/test_restore_landings_other_lanes.py(23 tests, temporary directories only) check that:restore_sand its bytes match the blobs on disk;Full suite: 11,258 passed, 0 failed.