mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #190] [CLOSED] Spill evicted conversation snapshots to a bounded optional disk cache #2501
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2501
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/190
Author: @jeremiahritchey
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:feat/conversation-cache-nvme📝 Commits (10+)
cabd50cIntegrate validated conversation snapshot core with upstream 0.1.25b319d43test: require a real physical-memory sample on Windows57b52ddAdd reproducible Pi cache comparison and document current integration5d0710bEnforce Pi benchmark request limits and engine memory evidence1d9e4e7Match upstream K8V4 flags when sizing conversation snapshots9baf2e0Allow bounded Pi task completion and record benchmark provenancecb8d90cRecord upstream integration, Linux acceptance and controlled Pi results73059daFocus shared-core patch on runtime, regression tests and current documentationb59b11bIntegrate upstream 0.1.26 draft prompt pass and runtime updatesfb65fa5Clear recoverable snapshot errors before batched draft prefill📊 Changes
40 files changed (+5863 additions, -81 deletions)
View changed files
📝
.gitignore(+3 -1)📝
CMakeLists.txt(+58 -1)📝
docs/DETAILS.md(+76 -3)➕
include/strata/core/conversation_buffer.hpp(+154 -0)➕
include/strata/core/conversation_cache.hpp(+201 -0)➕
include/strata/core/conversation_memory.hpp(+19 -0)➕
include/strata/core/conversation_snapshot.hpp(+75 -0)➕
include/strata/platform/conversation_file.hpp(+54 -0)➕
include/strata/platform/conversation_store.hpp(+43 -0)📝
include/strata/program/conv_cache.hpp(+16 -0)📝
serve/server.py(+16 -4)📝
serve/test_server.py(+21 -0)➕
src/core/conversation_cache_test.cpp(+181 -0)➕
src/core/conversation_checked.hpp(+24 -0)➕
src/core/conversation_memory.cpp(+51 -0)➕
src/core/conversation_memory_test.cpp(+66 -0)➕
src/core/conversation_snapshot.cpp(+264 -0)➕
src/core/conversation_snapshot_test.cpp(+271 -0)➕
src/core/conversation_state.cpp(+281 -0)➕
src/core/conversation_validation_test.cpp(+219 -0)...and 20 more files
📄 Description
RAM-evicted conversations can retain reusable state on disk and return after an engine restart. This adds an opt-in, quota-bounded disk tier that consumes the shared snapshot representation and restore path; it does not add another GPU state-application implementation.
Depends on #189; merge the shared core/RAM change first. This draft targets
Niko1221/Strata:main, so its current Files changed view also contains the unmerged core. Review the NVMe-only comparison for the disk additions. After #189 lands, this branch will be updated so the upstream diff contains only the dependent changes.Refs #57 and #52. This brings the dependent disk review upstream from the fork draft. General Pi benchmark tooling is excluded.
Final 0.1.27 Linux validation passes disk-on/off CUDA builds, 26 CLI rejection cases, host/fault-injection/sanitizer tests, 1,781 GPU snapshot checks and three six-phase model lifecycles: batched INT8, batched K8V4 and wrapped INT8 draft ring. Each lifecycle covers eviction, restart, admission denial, changed-tokenizer identity and corrupted-file fallback with known answers, token/main-state parity and restored draft byte fingerprints. The ring run restores 68,571 tokens across restart, exceeding 32,840 resident draft cells.
Full asset hashing adds cold-start I/O, paths are bound strictly, and whole-image writes occur only on eviction. The latest active turn is therefore not guaranteed durable. The digest cannot name the first mismatching identity field. Disk page-level deduplication is outside this change. Windows/HIP execution, power-loss survival and full-model weight-swap/cross-quantization cache exchange are not established by these tests.
The streaming-envelope approach is adapted from Marmaduke Woodman's (@maedoc) NVMe work in Niko1221/Strata#52 at
6648be7; the integration uses the shared core and preserves the contributor reference. @midhatn's authored admission contribution remains in the base; @QilinWan's identity/coordinate review is mapped to the documented fields and limits.The validation summary above applies to the tested 0.1.27 engine. Detailed design/validation notes and raw model/build logs are retained locally; planning documents are excluded from this PR.
Additional default-off regression (2026-09-30): this disk-enabled build, with both caches left at their disabled defaults, matches untouched upstream
a790805across eight requests in each of three modes: INT8 resident ring/spec-4 (43,170-token prompt), batched INT8, and batched K8V4. The complete upstream/core/NVMe matrix passes 72 requests with exact output-token, comparable main-state, prefix-reuse and known-answer parity. The combined cache harness suite, including disk, default-off and growth negative controls, passes 41 tests.docs/DETAILS.mdnow includes the OpenSSL/build option, config example, quotas, and eviction-only persistence limits.The shared-core follow-up retains unchanged K/V pages across repeated parking. Disk serialization streams the logical payload independently of RAM segmentation; unused capacity is excluded and reader staging remains bounded. Disk writes still contain whole snapshots and occur only on eviction. The disk-enabled build passes the paired 12-request full/incremental capture gate with INT8 resident-ring/spec-4 at 61,259 prompt tokens, including growth, rewind, exact output/main-state parity and restored draft read-back. See the independent validation and suggestions.
Follow-up validation at
f1b0c16(core) /18c475e(NVMe): all 23 final GPU/model jobs pass, including growth/rewind, tight-budget fallback, cache-on/off parity, isolation, HTTP recovery, the 30-cycle soak, three disk lifecycles, and the 72-request upstream/default-off matrix. Core and NVMe each pass 1,781 GPU snapshot checks. Host sanitizer checks include 4,149 buffer/cache policy checks, 1,452 transfer checks, and 6,732 disk-codec checks. Windows execution remains untested locally.Portability follow-up (
772e55c): cache harness text reads/writes explicitly use UTF-8, and isolation fixtures use absolute paths so an engine configured with a different working directory can locate them. This addresses the Windows tester’s two inline findings. All 41 cache harness tests pass under normal and optimized Python. CPU-only reproductions fail on the prior code and pass after the fix for simulated cp1252 defaults and differing engine working directories (image/add/project). These checks do not constitute a Windows engine rerun.Reproduction commands (Linux, IQ3_S / RTX 4090)
Run from this PR branch's root, with the model installation's Python environment activated. These commands reproduce the Linux RTX 4090 settings (CUDA 13.4, SM89, IQ3_S); replace the two asset paths. The model config must contain absolute asset paths. Model runs and GPU fixtures require an exclusive GPU window. Each model output directory must be new. This is correctness validation, not a throughput benchmark.
The dependency is the setup-pinned llama.cpp commit
3cf03257f219afbe7334045ff7c6a06ac68c627d. Preserve your config's model/tokenizer/profile paths while selecting the tested context, residency and expert-cache settings:CPU-only codec/store checks (OpenSSL development headers and Crypto library required):
Build the disk-enabled CUDA engine using the same settings as the tested core:
GPU/model checks, only in the exclusive window. Each disk lifecycle starts six private engines and changes only copied tokenizer files and generated snapshots beneath its new output directory:
The disk tool requires actual batched/ring evidence, restart draft read-back, exact output/main-state parity, known answers, quota bounds and cold fallback on admission/foreign/corrupt inputs. For the separate upstream-versus-disabled comparison, run the reference build and
conversation_cache_disabled.pycommands in #189 from this branch: its candidate is then the disk-enabled binary with both caches left off. Those comparisons use the common upstream hash fields and are correctness checks, not speed measurements.The growth/rewind commands in #189 also apply to this branch. Disk blobs serialize the logical payload independently of RAM segmentation; file staging includes segment-directory storage. Retaining pages in RAM does not change eviction-only disk writes or introduce disk page deduplication.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.