Repository navigation
kolibri1 CUDA: the full layers' caches in pages of the core pool, every stream leasing; sliding layers keep their rings - #1620
Conversation
|
Thanks @jschmied. We ran this on a GB10 (sm_121) against main, with Kolibri-1, fresh servers per arm and alternating base/new rounds. Our first run asked for 64 streams, which fit neither arm (paged needed 42.8 GiB for the other streams against main's 135.6 GiB, so the memory win is real). This run uses 12 streams at a 40k context. Tokens are equal to main (0 of 12 prompt-test rows differ), and prefill is flat. But decode is slower everywhere, and every run of this PR came in under every run of main:
This matches your own medians, which were 0.3 to 1.3% lower. We don't land a slower default decode, so we're parking this for now, along with #1619 underneath it. The likely cost is the full-attention layers' paged decode reads: one page-table lookup per 256-position page for each head. If the decode kernel reads a stream's pages with the table hoisted out of the inner loop, or the full layers keep a contiguous cache until the pool needs the room, decode should be level, and the memory win can land with it. We'll rerun the same cells when you push. |
|
/atc exchange b348c34b14982e4a51a78ad30b389dc4e469a386fd4655dbbcfaf0b60f918cf9 |
|
Thanks @ashhart. I pushed 58a8cfb here (and the same change as d4bafe4 on #1619, since the kernels came from #1618): the tree attention Where the time goes. I timed the kernels alone first, linear against Your cells, fix against main d33dcfc. Kolibri-1,
The ranges overlap in every cell. Per round, the fix comes in 0.2 to 2.0 % under main in rounds 1 and 3 and level or above in round 2. The PR's own linear caches ( On #1619's 31B + DFlash single-stream code cell, the fixed binary is still 0.7 to 2.4 % under main in each paired round, with replies byte-equal to main and to Checks: SASS (nvcc 13.0, sm_80/86/89/120/121) differs only in the 13 |
|
Kolibri-1 on a GB10, @jschmied: your three #1620 commits on top of our rebased #1619, against #1619 alone, so only this PR's change shows.
That's about -0.4%, the same shape as #1653's 8-stream cost before your paged decode merge fix (7c0a80b). If Kolibri's decode goes through the same |
|
Thanks @ashhart. I checked, and #1653's merge fix doesn't apply here: Kolibri-1 decodes its full layers through tree attention, not The 4-stream cost looks like registers instead. With nvcc 13.0 on sm_120/121, the head dim 128 one-warp paged twins 597d473 gives those two
Checks:
I haven't timed it. Could you re-run the 4-stream cells? #1619's merge fix follows there separately. |
597d473 to
05f1761
Compare
05f1761 to
adad065
Compare
|
@jschmied #1619 landed today (14c907b) in its rebased form. This PR still sits on an older #1619, so its branch carries #1619's earlier Gemma 4 paging commits. Those now conflict with what landed, in |
adad065 to
9d80794
Compare
|
Rebased onto main 14c907b as asked: 9d80794, four commits, only Kolibri-1's. Every #1619 commit on the old branch already has its equivalent in main, so they're gone; the four applied without conflicts.
Checks on 9d80794 (GB10): lean 424 on the base, 424 on the head, 0 new; |
|
A small rebase from our side, @jschmied: since your 14:15 push, main gained #2022, the verified copies on the CUDA lane hosts, which touches the same |
9d80794 to
e24ef31
Compare
…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.
…_h8_pg) over shuffled pages with a spare-page control; their records measured
…e a register budget, so sm_121 no longer spills them at 168 registers
e24ef31 to
af3007e
Compare
|
Thank you @jschmied. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
|
Thanks @jschmied! This is in TensorFold 1.2.3, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.3 |
On main (14c907b, with #1619 landed): four commits. Kolibri-1's full layers take their K/V from pages of the core pool, every stream leasing as it grows; sliding layers keep their rings.
TENSORFOLD_KOLIBRI_KV_PAGES=0keeps the linear caches.tf_wrows_putcopies the rows kernel'skn/vninto the pages.tf_window_prompt_h4_pg/_h8_pg(twins ofwattn_kernel<128, 8, 4|8, 8>), decode and drafted verify through cuda: tree attention and head dim 512's window rows read keys from a page table (_pg kernels), SASS of the others unchanged #1618's tree attention_pgkernels with a table in the call's stream order.attachdrops any step graph captured before it (none is today; the guard keeps a stale graph off the freed linear caches).Checks (GB10, nvcc 13.0, on main d33dcfc)
window_attention.cuagainst gemma4 CUDA: the global layers' caches in pages of the core pool, every stream leasing; sliding layers keep their rings #1619: 35 functions over sm_80/86/89/120/121, 0 changed, 10 added, 0 unstable.kernel-contract-limitsover the 5-SM fatbins shows them current.tf_window_prompt_h4_pgover pages of 512 and 37 and_h8_pgover 64, keys shuffled with NaN in spare pages and unused slots, pass repeat, shapes, sums and nonfinite; the control (first page id a spare page's) goes red at shapes. The runner's SUMMARY caveat is in cuda: tree attention and head dim 512's window rows read keys from a page table (_pg kernels), SASS of the others unchanged #1618.tf-cuda-test kolibri-pages MODEL TEXT 64: linear vs paged, pool of the two widest requests shuffled, plain and drafted: replies and last-row logits byte-equal, 29/29, including shared rounds, a kept state's resume and reused pages.kolibri-full MODEL IDS 128: passes paged and withTENSORFOLD_KOLIBRI_KV_PAGES=0.zig build test test-kernel-contract test-golden test-server-security test-pull-security fuzz-cortheon,git diff --check: pass; lean 0 new.Speed, paged vs
TENSORFOLD_KOLIBRI_KV_PAGES=0(same harness as #1619: fresh server per arm, three alternating rounds, 256 greedy tokens, two prompts per case; min / median / max):TTFT is the same; decode medians are 0.3 to 1.3 % lower paged, inside the arms' spread.
kolibri-full's in-process rates agree: 53.5 / 85.1 (drafted) / 124.4 (four streams) tok/s paged against 52.9 / 84.7 / 124.1 linear (that linear run on the previous main, 7c06889).