mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1232] [CLOSED] enable --kv-grow with --batch #3327
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#3327
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/1232
Author: @BlueKingMuch
Created: 10/6/2026
Status: ❌ Closed
Base:
main← Head:kv-grow-batch📝 Commits (4)
8845ff4Elastic K/V: a run that cannot lend cache slots maps the whole window up front; its table uploads wait for the copy7e35eafkv-grow: batch slots map only the cells of their conversation instead of switching --kv-grow off652e132Merge v0.1.40.3 into kv-grow-batch066dc25kv-grow: the comment above pooled_elastic says the main session's keys stay whole, instead of a wrong reason📊 Changes
3 files changed (+195 additions, -53 deletions)
View changed files
📝
include/strata/core/layer.hpp(+15 -9)📝
src/core/layer.cpp(+58 -16)📝
src/program/generate.cpp(+122 -28)📄 Description
Builds on #1231 (the first commit); this PR is the second.
With
--batch Nevery slot carves a session for the whole--max-context, used or not: 3.65 GiB each at 262K with int8 K/V, or 0.95 GiB with--kv-resident 32768plus ~3.1 GiB of pinned RAM.--kv-growswitches itself off beside--batch("the batch slots carve their own K/V"). This makes every slot session elastic under--kv-grow.What it does
qsa_set_kv_elastic_groupwhile it is initialized).qsa_kv_elastic_{cells,need,grow,shrink}take the group; every existing caller is group 0, so one session runs exactly as before.--batch-mtpeach slot's drafter K/V joins its slot's group, so it grows and shrinks with the slot.kvg_ensure/kvg_trimtake the group too: all groups draw on the same loan of the expert cache (the slots just below the prompt path's) and give their chunks back to it.copy_to_slot, trimming what it held beyond first), at a BYIELD, and before each batch window (its position + 1 + 64). A slot starts with 4,096 cells mapped (STRATA_KV_GROW_SLOT_INIT).upto.--kv-growstays off beside--vram-elasticand--peer-device, as before. Without--kv-grownothing changes.Tests
tools/batch_test.py, four slots,--pcie-frac 0 --adapt-every 1000000 --no-prefill-borrow --prefill 1024: without and with--kv-grow4 of 4 IDENTICAL; with--batch-mtp, without and with--kv-grow, 4 of 4 IDENTICAL (with the one-line fix from #1063: the MTP directory here has adraft_vocab.bin).tools/batch_interleave_test.pywith--kv-growand the slots pre-grown (STRATA_KV_GROW_SLOT_INIT=16384): 8 of 8 IDENTICAL.vmm_test,conversation_snapshot_test,conversation_cache_test,conversation_file_testpass.Measured
On 0.1.40.1, this against 0.1.40.1: RTX 4080 SUPER 32 GB, PCIe 3.0, Windows 11, IQ3_S, 262K int8, 4 slots,
conversation cache 12,288 MiB; 1 orchestrator + 4 subagents, two rounds, the orchestrator working on its own between them (6 turns a round):
--kv-resident 32768--kv-growEach subagent's slot grew to 16,384 cells and took 86-88 expert slots for it; a slot that held the orchestrator grew to 49,152 cells (227-314 slots) and gave 223 back when it went on with a subagent.
The same pair with the VRAM of a 16 GB card, emulated on this card (
--vram-reserve-mib 17084: the same PCIe link, 16 GiB less for the cache):--kv-resident 32768--kv-growcc @sergqwer - this extends your elastic K/V (#378) to the batch slots.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.