Repository navigation
Conversation
…r-run KV bookkeeping, one argmax per batch Four host-side fixes found by profiling multi-turn session workloads (cProfile inside the benchmark; the GPU was 13% busy and Python 100% in one cell): - Scheduler._plan_admission rehashed every waiting prompt (one chained SHA-256 per block) on every admission attempt, and num_free_blocks rescanned every prefix entry on each capacity check. Prompt keys are now computed once per request, and the manager keeps the count of cache-only blocks (refs == 1) current at every reference-count change, so num_free_blocks is O(1). A randomized test checks the counter against the old scan. - Growth reservations are computed once per admission tick instead of once per admission candidate. - Rows of a host KV batch are grouped once into runs of consecutive positions per (allocation, depth); per-layer write/attend bookkeeping advances one written record per run (add_run, identical to sequential add) and checks the strongest prefix requirement per run. A 2048-token prefill chunk costs one call per layer instead of 2048. The per-layer written contract is unchanged; a randomized test checks add_run against add. In the session profile this bookkeeping was 31M calls, about 20 s of 146 s. - An all-greedy CODA batch samples with one argmax launch (Sampler.sample_batch) instead of one per row. RTX 5090, Ouro-1.4B, 32 agent sessions, 6 turns, prefix cache on, one run per arm (prefix-key and free-block changes vs main): per-row prefill: +2.6% tok/s, TTFT p50 8.4 -> 7.1 s, Python calls -19% packed prefill: +4.7% tok/s, TTFT p50 2.57 -> 1.80 s The other two changes were not measured on their own. Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four host-side fixes found by profiling multi-turn session workloads (cProfile inside the benchmark; in one cell the GPU was 13% busy while the Python process was at 100%):
Scheduler._plan_admissionrehashed every waiting prompt (one chained SHA-256 per block) on every admission attempt, andnum_free_blocksrescanned every prefix entry on each capacity check. Prompt keys are now computed once per request, and the manager keeps the count of cache-only blocks (refs == 1) current at every reference-count change, sonum_free_blocksis O(1).add_run, identical to sequentialadd) and checks the strongest prefix requirement per run. A 2048-token prefill chunk costs one call per layer instead of 2048. The per-layer written contract is unchanged. In the session profile this bookkeeping was 31M calls, about 20 s of 146 s.Sampler.sample_batch) instead of one per row.Measurements
RTX 5090, Ouro-1.4B, 32 agent sessions, 6 turns, prefix cache on, one run per arm (prefix-key and free-block changes vs
main):The other two changes were not measured on their own.
Platforms. GH200: torch 2.14.0+cu130, Triton 3.8.0, NIXL 1.4.1. RTX 5090: torch 2.13.0+cu130, Triton 3.7.1. Models: Ouro-1.4B (24 layers, 4 loops, fixed depth) and Huginn-0125 (2 prelude + 4 recurrent + 2 coda layers, 32 loops). Burst workloads issue C requests at once with random-token prompts; session workloads replay multi-turn agent traces with the prefix cache on.
Tests
add_runagainst sequentialadd; a sampler test covers the batched argmax.Notes
The GPU numbers come from a development branch that contains all changes of this series; most cells are single runs, and on the shared GH200 host two runs of
mainat 32 requests differed by up to 16%, so smaller differences are ties. This branch alone was checked with the CPU suite and ruff.Series. Draft PRs from one study of serving looped models. They are independent except #152, which is stacked on #147; several touch the same files, so later ones may need a rebase after earlier ones merge.