Buckets:
KDA draft: rolling16 + local128 decode ceiling
Task contract
- Objective: find the best correct single-token decode throughput and the practical upper bound for the 32K-context rolling16 + local128 model on one A100. Report both throughput at the maximum batch that fits the fixed 38 GiB budget and the best throughput over a batch sweep.
- Inputs: the existing exact-shape synthetic model, BF16 weights, initialized KV state, and CUDA-graph full-model decode path in
inference/rolling_window_capacity.py. The reference behavior is the currentroll16_w128path; the quality-bearing trained checkpoint is not loaded by this harness. - Outputs: an optimized candidate kernel/cache layout, correctness records, per-kernel and full-model timing evidence where available, and a batch/throughput curve at 2K, 8K, and 32K contexts. The primary ceiling is 32K.
- Correctness requirements: preserve rolling16 state selection and local 128-token behavior; attention relative L2 < 1% against the eager reference; full-model logits relative L2 < 5%; fixed-input graph replay relative L2 < 0.1%; no writes to historical cache slots other than the intended append/ring slot.
- Constraints: BF16, A100, current PyTorch/Triton stack, 38 GiB allocator cap, no quality-model changes, no cache budget increase, and no tuning while another process is using the selected GPU.
- Validation command:
source env/activate_deltakv_env.sh && CUDA_VISIBLE_DEVICES=0 python inference/rolling_window_capacity.py --variant roll16_w128 --validate --output inference/kda_rolling16_local128/runs/validation.json(or the candidate-specific equivalent). - Evaluation command: candidate-specific CUDA-graph fixed-context full-model decode plus a batch sweep; record a run only after exclusive-GPU checks pass.
- Promotion criteria: a candidate must pass correctness and memory constraints, and improve full-model tokens/s reproducibly by at least 5% at both a common batch and its best batch. Record rejected candidates and reasons.
Baseline
The parent reaches 1,589 tokens/s at batch315 under the matched KDA protocol. A Tensor Core pairwise-RoPE candidate reaches 2,811 tokens/s at batch64 and a repeated mean of 2,845 tokens/s at batch128. At 32K, throughput stays near 2.84k tokens/s from batch96 through315; measured differences are within run-to-run variation. Batch315 is the maximum feasible under the 38-GiB process cap; batch316 OOMs. A same-protocol GQA baseline peaks at 3,296 tokens/s around batch96 and maxes at batch100. The roll16/local128 candidate therefore reaches about 86% of GQA's measured peak while using about 68% less KV memory per sequence. These are practical ceilings for the tested kernels and synthetic harness, not a hardware/theoretical limit.
Main risks and unknowns
- The kernel may be dominated by poor K/V memory coalescing from the
[state, batch, head, context, rank]cache layout. QK reads K as[head_dim, context], while PV reads V as[context, head_dim]; these two operands favor different physical layouts. - The attention CTA also pads two real query heads to 16 rows, dynamically gathers the RoPE partner from a second state, and reloads the full K/V cache in positions subsequently replaced by local-ring values.
- Full-model timing includes GEMMs, FFN, vocabulary projection, cache preparation, attention, and merge. Faster attention may have limited end-to-end impact.
- A GPU or clocks/power limit shared with another job can invalidate comparisons.
- The current harness uses random synthetic weights and history; results characterize implementation throughput, not trained-checkpoint quality.
Candidate directions, ranked
- Profile the 32K decode graph and inspect Triton resource metadata. If attention is material, measure standalone
prepare,attend, merge, and projection/FFN costs before selecting a change. - Try separate physical layouts for rolling K and V: sequence-contiguous K for QK and token/head-contiguous V for PV. Keep element counts and cache budget unchanged.
- Gather the RoPE partner from the K tile already loaded into the attention CTA instead of issuing a second global load; validate whether Triton lowers it to efficient register/shared-memory movement.
- Mask compact K/V loads for the last 128 positions that are supplied by the local ring; test pre-rotating local keys on append to remove repeat RoPE work.
- Tune attention split length, warps, and history tile size only after the cache and gather variants are correct.
- The scalar pairwise-RoPE path reached 2,340 tokens/s at batch64. Tensor Core pairwise RoPE improved this to 2,811 tokens/s at batch64 and 2,845 tokens/s repeated mean at batch128. It loads each raw K coordinate once, performs RoPE in registers, skips rolling-cache reads covered by local128, and uses MMA for QK/PV.
- Split128/four-warps is the best tested layout/config at both batch64 and batch128. At batch128, split64 was 1.4% slower, split256 17.8% slower, split512 53.7% slower, and eight warps 3.6% slower. Two warps passed correctness but were 14.8% slower at batch64. Streaming online-softmax variants were 1.0–4.2% slower; a context-contiguous directional K layout was 27.9% slower end to end.
- The remaining measured gap is about 14% in full-model peak throughput versus GQA. The isolated rolling attention+merge is 1.844 ms/layer versus GQA's 1.608 ms; Nsight Systems attributes about 98.5% of the isolated rolling path to
attend_relative_mmaand 1.5% to merge. Nsight Compute hardware counters remain unavailable due driver permissions.
First steps
- Capture the baseline, GPU/process state, source hashes, and same-protocol parent measurements at batch64,128,315.
- Profile the hot path with Triton metadata, CUDA events, and an Nsight Systems node trace; document that Nsight Compute counters are blocked by driver permissions.
- Implement and validate candidates separately. The split/warp sweep, online-softmax variant, directional K layout, and GQA baseline are recorded with outcomes.
- Complete the dense 32K batch sweep, repeat the apparent batch128 peak and batch315 point, and verify max batch315 / batch316 OOM for rolling16/local128 and batch100 / batch101 OOM for GQA.
- Repeat batch64,128,315 at 2K and 8K. Keep synthetic-harness scope explicit; this does not establish downstream quality or trained-checkpoint throughput.
- Keep or reject each candidate in
candidates.jsonl; append measurements tobenchmark.csvand profiles underprofile/.
Xet Storage Details
- Size:
- 6.54 kB
- Xet hash:
- acf302d46287a01bb4bd478fd7fca1e70fe157e4472bb370b5811461b2ea9133
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.