mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #236] GLM conversation slots: park them in RAM (STRATA_GLM_SLOT_RAM_GB) #414
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#414
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?
Original Pull Request: https://github.com/mw00/project-maya/pull/236
State: closed
Merged: Yes
What
\STRATA_GLM_SLOT_RAM_GB\ (0, the default = today's behavior) moves the conversation slots off the disk: \slot_save\ gains a \std::vector<uint8_t>\ overload that holds the exact bytes the file version writes, and \slot_load\ takes such a buffer back as the live state. The driver-side \Slot\ gains a shared buffer; nothing in the file paths changes, the disk mode stays byte-for-byte identical when the new env is unset.
Why
The disk slots exist to keep memory lean with one resident state, but on machines with spare host RAM the disk round-trip (NVMe write on every conversation hand-off) is both the slow part and the sobering part. A RAM buffer is the same trade llama-class servers make with host-backed caches. The user-visible win measured below: a parked 100k-token conversation comes back in 0.1 s instead of the file round-trip.
Measured (single 4090 D, IQ2_XXS GLM-5.3-Flash, 128 GB host RAM, --glm-ram-resident\ + --kv-streaming on, daily pins untouched)
\\
glm slots: slots parked in RAM (6.44 GB max) - nothing is written to disk, the states die with the run
glm slots: saved a 46091-token conversation (0.74 GB in RAM in 0.3 s); 1 kept, 0.74 GB
glm slots: saved a 75691-token conversation (1.11 GB in RAM in 0.3 s); 2 kept, 1.85 GB
glm slots: took back a 46091-token conversation from RAM (0.1 s); 1 new tokens to read [was 25 s as a full prefill]
glm slots: took back a 75691-token conversation from RAM (0.1 s); 1 new tokens to read [was 41 s]
\\
Engine RSS grew 65.2 → 67.7 GB (+2.5 GB for the two parked payloads + the KV frames); the slots folder kept its 10 pre-existing file count through the whole run (RAM mode neither reads it, grows it nor wipes it). The un-used 46k state was superseded and dropped through the same LRU path — no leak across 6 park/take cycles.
Notes for review
Build: same flags as the daily (CUDA, arch 89, ggml pin \3cf03257).