Repository navigation
server : add --cache-disk for a persistent prompt cache - #81
Conversation
Assisted-by: Codex Assisted-by: Claude Opus 5
The flag takes a filesystem directory, not a block device, so "disk" is a misnomer; it also collides with a plausible future raw-device cache. Rename --cache-disk/--cache-disk-max to --cache-dir/--cache-dir-max (env LLAMA_ARG_CACHE_DIR/_MAX) to match the existing --cache-ram/--cache-reuse family, and clarify in the help text that this is not the model download cache directory. Suggested by @lee-b. No behavior change. Assisted-by: Codex Assisted-by: Claude Opus 5
|
Tested this on qwen4exp (Qwen3.8-Flash-Next, hybrid + shared-MTP draft, f16 KV, Works: eviction writes Fails: after restart, resending the exact cached prompt still fully re-prefills ( The format looks right for this model class (per-checkpoint The unit tests use tinygemma3/tinyllama (SWA, pure attention). A hybrid + draft-MTP case should reproduce this: restore succeeds, |
|
Correction to my earlier comment: "restored KV invisible to the serving path" was wrong. Actual mechanism: on hybrid/recurrent models the serving path's rollback guard ( Three transports, one mechanism:
Test-matrix suggestion: tinyllama and tinygemma3 are SWA/pure-attention and pass while the hybrid path is broken. A hybrid-architecture case would catch this class directly: any qwen4exp variant with |
|
Follow-up to my earlier comment: I can narrow the failure I saw. My failing run was on this PR's head (89fb1c6 on master), so none of the active build's three fixes (no-mmap, save-on-stop, streamed I/O). It was also I've since seen a report of the active build reusing checkpoints after restart with MTP enabled (117,347 of 125,542 tokens on a 125K doc). That doesn't clash with my result. It narrows the suspect: the format's fine, so the mmap write path or eviction-written entries are where I'd look. Happy to rerun my repro once the fixes land on this branch. |
|
Tested on Strix Halo (gfx1151, HIP), this PR at
Entries are restored at startup but never reused, on plain-attention and hybrid models alike, so the main claim does not reproduce. Issues to address before this can land:
Comment generated via automated review of clanker Claude Code. |
|
merging this as is, as it's too good not to merge, we can fix the 2 comments forward |
Revert "server : add --cache-disk for a persistent prompt cache" (#81)
Brings back #81 by @storm1er (reverted in #154 after the ROCm write storm reports), so the fixes that follow can land on top of it. This reverts commit a3a9bb3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5NBdiBqRmGomhSRXBoucx
…t-cache" This reverts commit 0f36c46, reversing changes made to 307c50d. --cache-dir drives runaway disk writes on ROCm: the slot state is copied straight between the GPU and a MAP_SHARED file, the runtime pins the mapped pages, and writeback keeps rewriting the file until the server exits. Users reported ~1.6 TB written to NVMe in an hour, and decode stalling under 5+ GB/s of continuous writes with a 75k-token context. Reproduced on gfx1151: one 503 MiB entry became 5.7 GB of writes within 60 s of idle. Even with that fixed (halo-box#149), an agent-style workload rewrites the whole state on every turn. Remove the feature until it can come back with bounded writes; --cache-ram is unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5NBdiBqRmGomhSRXBoucx
…t-cache" This reverts commit 0f36c46, reversing changes made to 307c50d. --cache-dir drives runaway disk writes on ROCm: the slot state is copied straight between the GPU and a MAP_SHARED file, the runtime pins the mapped pages, and writeback keeps rewriting the file until the server exits. Users reported ~1.6 TB written to NVMe in an hour, and decode stalling under 5+ GB/s of continuous writes with a 75k-token context. Reproduced on gfx1151: one 503 MiB entry became 5.7 GB of writes within 60 s of idle. Even with that fixed (halo-box#149), an agent-style workload rewrites the whole state on every turn. Remove the feature until it can come back with bounded writes; --cache-ram is unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5NBdiBqRmGomhSRXBoucx [rebase: applied as the revert of the rebased commits 73e0238 and 3f91881, the linear-history form of PR halo-box#81] (cherry picked from commit a3a9bb3)
…lo-box#81) Brings back halo-box#81 by @storm1er (reverted in halo-box#154 after the ROCm write storm reports), so the fixes that follow can land on top of it. This reverts commit a3a9bb3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5NBdiBqRmGomhSRXBoucx
…lo-box#81) Brings back halo-box#81 by @storm1er (reverted in halo-box#154 after the ROCm write storm reports), so the fixes that follow can land on top of it. This reverts commit a3a9bb3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5NBdiBqRmGomhSRXBoucx
…lo-box#81) Brings back halo-box#81 by @storm1er (reverted in halo-box#154 after the ROCm write storm reports), so the fixes that follow can land on top of it. This reverts commit a3a9bb3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5NBdiBqRmGomhSRXBoucx
…lo-box#81) Brings back halo-box#81 by @storm1er (reverted in halo-box#154 after the ROCm write storm reports), so the fixes that follow can land on top of it. This reverts commit a3a9bb3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5NBdiBqRmGomhSRXBoucx
Overview
Implements a persistent prompt cache that supports hybrid/SWA context
checkpoints, restores automatically across process restarts, and provides
corrupt-entry cleanup and LRU eviction bounded by disk size.
See ggml-org#28092 for initial review of these changes, initially targeting ggml-org/llama.cpp. Created by @yitizi