Skip to content

scheduler: ATLAS_DECODE_STEPS_PER_CHUNK lets decoders run between a long prompt's prefill chunks (head-of-line) - #213

Merged
AzeezIsh merged 1 commit into
mainfrom
perf/decode-steps-per-chunk
Oct 27, 2026
Merged

AzeezIsh merged 1 commit into
mainfrom
perf/decode-steps-per-chunk

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Summary

ATLAS_DECODE_STEPS_PER_CHUNK=k (default 0 = unchanged): while sequences are decoding, run at most one continued prefill chunk per k standalone decode steps instead of one per scheduler tick.

Why. On qwen4_exp a prefill chunk costs 1.9 s (2K tokens) to 5.5 s (8K). The resting path advances every active decode by one step per chunk, so a short reply that arrives behind a long prompt waits out the whole prompt. On FP4-Local, 6 short requests sent during a 20.6K-token prefill all finished at about 18 s (sparky, 2026-10-23, prod_probe_hol.py).

What. New scheduler/phase_continue_prefills/decode_share.rs (76 lines), a 1-line hold in phase_continue_prefills.rs, and 3 lines in scheduler/mod.rs: a decode-step counter, a reset on idle ticks, and head_just_started (end the tick after a new prompt's first chunk, as under EP) extended to the knob. When the knob is on, it ends the tick so requests that arrived during the first chunk are admitted before the second one.

Evidence so far (sparky GB10, nvidia/Qwen3.8-Flash-Next-FP4-Local, PLE cache 2 GB, prefix cache on)

  • Off = unchanged. 4-request T=0 control, knob unset: outputs identical between main + kernels: use __float2bfloat16 in batched_embed_nvfp4 so strix-hip builds (second break from #195) #204 (d2d114c) and the same tree + this diff (b0c452fb). sparky ~/code/q10h/queue29.log, 2026-10-27.
  • No regression at one sequence (r1short = the recipe profile, where the knob should be inert): with the multi+ckpt profile + k=8, agentic-webserver 50: 50/50, 50/50, 11.74 s/turn (run-1792814374289258605); BFCL ST-995 87.34 / 86.50 (run-1792825067944442327). The same profile without the knob scored 11.76 s/turn and 87.34 / 86.50.
  • Head-of-line, preliminary, single run per arm (r2 = 8 seqs; multi+ckpt profile; 6 shorts sent during a 20.6K prefill; binary 16b73e22 = this diff on d2d114c):
knob off k=8
6 shorts behind the long prompt 16.8–16.9 s 7.3 s (3 of them) / 13.0 s (3)
long prompt wall 17.4 s 17.2 s
C=2 / 4 / 8 shorts, no long prompt 1.22 / 1.88 / 3.31 s 1.22 / 1.88 / 3.34 s

The shorts finish in two waves of three because the batched short-prompt pass groups the arrivals. A time-based variant (ATLAS_DECODE_SHARE_PCT) was tried and dropped: 12.8–16 s for the shorts. Reasons are in the campaign log (#211, entry 2026-10-24 02:50).

Pending: an n=3 alternating A/B (off vs k=8) on this PR's exact head is queued on sparky (job 20-dshare-hol). This PR stays a draft until it reports. The table above gets replaced by those numbers.

Flip condition

Opt-in for now (repo rule: winning opt-in arms state a flip condition). The knob only matters when other sequences are decoding during a prefill, so it is inert at one sequence. If the n=3 A/B holds, the proposal is to turn it on in the multi-sequence FP4-Local profile, then consider a qwen4_exp default where chunk cost is seconds, not milliseconds.

Test plan

  • fmt (pinned 1.93.1 + stable), clippy -p spark-server --tests, typos, SPDX, file-size cap
  • cargo test --release -p spark-server decode_share: 1 passed (off_by_default_never_holds, in the bin target)
  • knob off: control outputs identical to the base
  • r1short gate with k=8: agentic 50/50, BFCL unchanged vs the same profile without the knob
  • n=3 HOL A/B on this head (sparky job 20)

Generated with Devin

…ween a long prompt's prefill chunks (head-of-line)

While sequences are decoding, run at most one continued prefill chunk per k decode steps instead of one per scheduler tick. The resting path advances each active decode one step per chunk, so a short reply behind a long prompt waits out the whole prompt; holding chunks for k steps lets it finish while the long prompt's TTFT grows by about k decode steps per chunk. Default 0 = unchanged.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
AzeezIsh added a commit that referenced this pull request Oct 27, 2026
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

n=3 head-of-line A/B on this PR's exact head (e05c6c3), sparky GB10, nvidia/Qwen3.8-Flash-Next-FP4-Local, r2 profile (8 seqs), multi+ckpt env, prod_probe_hol.py (6 short requests sent during a 20.6K-token prefill, then C=2/4/8 bursts). Alternating fresh boots off → k=8, 3 pairs (sparky job 20-dshare-hol, ~/code/nightq/logs/20-dshare-hol.log):

pair knob off: 6 shorts / long ATLAS_DECODE_STEPS_PER_CHUNK=8: 6 shorts / long C=8 off / k=8
1 16.70–16.89 s / 17.4 s 7.66 ×3, 13.37 ×3 / 17.6 s 3.31 / 3.31 s
2 16.79–16.97 s / 17.5 s 7.79 ×3, 13.49 ×3 / 17.7 s 3.32 / 3.31 s
3 17.04–17.23 s / 17.7 s 7.24 ×3, 12.94 ×3 / 17.2 s 3.32 / 3.31 s
  • Shorts behind a long prompt: the first wave of three finishes in 7.2–7.8 s instead of ~17 s; the second wave in 12.9–13.5 s. It is two waves because the batched short-prompt pass groups the arrivals.
  • Long prompt: 17.2–17.7 s with the knob vs 17.4–17.7 s without. Within the run-to-run spread, so the long request pays nothing measurable here.
  • Uncontended bursts (C=8, no long prompt): unchanged, 3.31 s.

With the knob off, outputs are byte-identical to the base (4-request control). At one sequence (r1short gate with k=8), agentic and BFCL were unchanged vs the same profile without the knob. This PR now rides integration train 2 (#217) for its GB10 default-path gate. Marking ready for review.

@AzeezIsh
AzeezIsh marked this pull request as ready for review October 27, 2026 16:20
AzeezIsh added a commit that referenced this pull request Oct 27, 2026
integ: train 2026-10-27b (#213 decode-share, #215 cargo-deny bumps), gated on GB10 FP4-Local
@AzeezIsh
AzeezIsh merged commit 2ea406a into main Oct 27, 2026
20 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant