mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 15:58:53 +00:00
With --kv-grow accepted at session init, the K/V pools hold physical memory only for their first 16,384 cells. The start of the elastic K/V then switched growth off completely when the expert cache could not give slots (no VMM range, no residency table or expert source, or a cache top at or under its floor of 128 slots, as with --expert-cache 100). The pools stayed at their first cells, and a longer prompt wrote past them: an illegal memory access. Now the K/V grows whenever its pools are elastic. The cache gives it slots only when it can; otherwise every grow takes new VRAM, as it already does when the cache is at its floor, and the K/V is not trimmed back (there is no cache slot to return). Nothing changes when the cache can give slots. kv_grow_rules.hpp holds the decision and the grow target. Tests: kv_grow_rules_test (CPU) and kv_grow_refused_test (GPU: elastic pools grown from new VRAM to a 20,000-token prompt's cells and to the whole context, every mapped cell writable).