Repository navigation
Conversation
…ry stream leasing; sliding layers keep their rings Pages of 512 rows (tree attention's key groups). Rows reach the pages by tf_wrows_put, prompts read them by new tf_window_prompt_h4_pg/_h8_pg twins, decode and drafted verify by tree attention's pages with a table in the call's stream order. Kept states walk the slot's pages. TENSORFOLD_KOLIBRI_KV_PAGES=0 or kv_pages = false keeps linear caches. tf-cuda-test kolibri-pages compares both. (cherry picked from commit 0e5f0a8)
(cherry picked from commit dc3a2c2)
…_h8_pg) over shuffled pages with a spare-page control; their records measured (cherry picked from commit c2971c3)
…ey (tree attention and head dim 512 _pg kernels), SASS of the others unchanged (cherry picked from commit 58a8cfb)
… pool's pages, in one prompt_radix store A family on the core KV pool that declares share_pool and share_attach gets one prompt_radix store over that pool (native/cuda_prompt_pages.zig): the tree holds the prompt pages themselves, a page edge's state past them comes from the family's snap_* decls, and n caps those states. The host makes no prompt_cache store then, and the cache budget becomes pool pages (Budget.kept_ppm). core/kv_prompts.zig is what the family calls: begin (resume point, adopted pages, marks), keep at a mark, report, and Blob, a state's copied rows in pages the store holds. Pool.hold takes those pages, asking the store to reclaim first as promise does. Unset or 0: as before.
…state's rings in store-held pages With the shared store a prompt pass begins at the store's resume point: the matched pages adopted into the stream's lease, its sliding rings restored there from the kept state. Chunks cut at the store's marks (page edges, 512 tokens); at each the store takes the pages it lacks, the stream's copies swapped for the tree's, and the state's rings go into pool pages the store holds (snap_bytes counts those). Unset: as before. tf-cuda-test kolibri-pages with TF_KV_SHARE=4 resumes a kept prompt plain and drafted, equal to linear.
|
Thanks @jschmied. The share receipts are strong: 76 kept states against 24 at 4 GiB, and 81,920 cached tokens against 3,479 at 1 GiB, with every turn equal. Since #1756 put the adapter on main, this PR is now Kolibri's wiring on top of #1620. When you restack: 1. Drop the adapter commit. Main has it ( Then we'll run both on our GB10s and take them together. |
Part of #1657: the native-CUDA adapter over
prompt_radix, off by default, with Kolibri-1 as its first user. Stacked on #1659 (merged) and on #1620.Stacking. The first four commits are #1620's, cherry-picked unchanged onto today's main. #1619's Gemma commits are not needed for them. GitHub shows this PR as conflicting because #1620 conflicts with #1653, which is now on main. Once #1620 is rebased, I'll restack this PR on it. The last two commits are this PR:
native cuda: TF_KV_SHARE=n ...is the adapter, the same commit as in spark25 cuda: TF_KV_SHARE keeps prompts as the pool's pages in the prompt_radix store (on #1653) #1756 (Spark2.5, now directly on main since spark25 CUDA: the full layers' caches in pages of the core pool, every stream leasing; sliding layers keep their rings #1653 landed). Whichever PR lands first carries the adapter.kolibri1 cuda: ...is the family wiring.What it does
TF_KV_SHARE=nturns it on for a family on the core pool that declaresshare_poolandshare_attach. That family gets oneprompt_radix.Storeover its pool (native/cuda_prompt_pages.zig).snap_*decls supply the state past a page edge, andncaps those states.prompt_cachestore, and the cache budget becomes pool pages.core/kv_prompts.zig:begin: the resume point, adopted pages and the planned grid's marks;keepat each mark;report.Pool.hold).holdasks the store to reclaim first, aspromisedoes.Gates (GB10, Kolibri-1)
tf-cuda-test kolibri-pages, final binaryTF_KV_SHARE=4: PASS twice (and once more on the head before the rebase onto today's main), resume at 1024 plain and drafted, reply and logits same as linear. Unset: PASSv.sh(lean 0 new,zig build test, CI set, diff-check)Share misses are the first turns: the system prompt is shorter than one 512-token page.
Default path (
TF_KV_SHAREunset,--prompt-cache-gib 0). Base (the stack without these two commits) vs this head, fresh server per arm, ABBA over 2 rounds (4 at 4 streams), aggregate tok/s, greedy token_sha equal in every cell:The default path runs no new code in the step: the store is absent and the branches are on
prompts == null.Left. Gemma 4 wiring, after #1619.