mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1011] [CLOSED] kv: one pinned KV pool shared by the sessions (--kv-pool-tokens; 4 lanes x 256K pin 6.24 GiB instead of 15.5) #2963
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#2963
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/1011
Author: @xdbxdbx
Created: 10/6/2026
Status: ❌ Closed
Base:
main← Head:kv-shared-pool📝 Commits (10+)
eb8da1d/metrics: each request's speculative draft counts, and their sums in the totals (#457)6a09387setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444)d6a91e2docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438)d8d4ad3Merge branch 'f-135-eng' into rel-0.1.357b600d5Merge branch 'f-135-small' into rel-0.1.35d9ab843Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it57bd713sycl: pipeline the expert cache's profile fill (model load 3-4x faster)e3bdd74A prompt cancelled mid-read is logged and recorded with the tokens it read (#471)f2aaba1"The draft head does not fit" says what to change (#474)64987c8UPDATE.bat / update.sh: update Strata without starting the model (#475)📊 Changes
6 files changed (+46 additions, -17 deletions)
View changed files
📝
include/strata/core/layer.hpp(+1 -0)📝
serve/server.py(+10 -3)📝
src/core/kv_pool.cpp(+5 -1)📝
src/core/layer.cpp(+1 -0)📝
src/core/mtp.cpp(+5 -0)📝
src/program/generate.cpp(+24 -13)📄 Description
Problem
With KV streaming (
--kv-resident) every session pins the whole context's K/V in RAM: the main session and each--batchslot. At--max-context 262144that is 3.09 GiB per session, so 4 lanes pin 5 x 3.09 = 15.5 GiB, although the conversations together rarely fill one context, let alone five.Change
--kv-pool-tokens N(with--kv-resident): the sessions share one pinned pool of N cells for the streamed QSA layers. A session holds only the chunks (4096 cells) its conversation has reached.qsa.cu,kv_q8.cu,kv_q4.cu), the stream movers (kv_stream.cu), prefill, and conversation snapshots, which split copies at chunk boundaries. Unreserved entries point at a trash chunk, so a stray write never lands in another session's cells.ERR KV pool full, answered as 503 with Retry-After (code: kv_pool_full; in a stream, the error event carries the code, and Anthropic streams useoverloaded_error);pool, reported as"truncated": true(llama.cpp's field)./metricsreports the pool's use (kv_pool: cells, free, held per session).ERRfor a request now ends it at once. The server used to wait 300 s for aDONE/BADMthat never comes after a refusal.Without
--kv-pool-tokensthere are no tables, and every site uses the identity layout as before.Validation
RTX 4090, 64 GB RAM, Qwen3.8-Flash-Next IQ2_XS,
--resident-experts --kv int8 --kv-resident 32768; single runs.truncated: true; the fourth request, arriving while three lanes decoded, got 503kv_pool_fullwithRetry-After: 10as soon as its turn came.Note
At 4 x 256K with resident experts, a 64 GB Windows PC runs close to its commit limit (RAM + page file). With an automatically sized page file (10 GB here, a 73.9 GB limit), the 25 GB resident expert copy was sometimes refused at start. A fixed 32 GB page file removes that; nothing is written to it.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.