perf(decode): occupancy-first adaptive n_splits — 64-split mid-context plateau (skip 128)#134
Open
milosde111 wants to merge 1 commit into
Open
Conversation
…nce across varying sequence lengths
c37787f to
9275b3d
Compare
Member
⏳ Needs a benchmark to be evaluatedYou ticked Tested on RTX 5090 but the decode before → after tok/s table is still empty / placeholder (or shows no gain). The on-device eval won't run until it shows a real improvement. Fill it from the end-to-end decode bench (not an isolated-kernel microbench): bench/scripts/bench.sh --download # baseline (before)
bench/scripts/bench.sh --download # your branch (after)Then the bot greenlights it on the next poll and evaluates it on an RTX 5090. |
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
Replaces the mid-context
n_splitsstep in the Qwen3-30B-A3B adaptive flash-decode schedule (runtime/src/models/qwen35.cpp). After #138,mainjumps to 128 splits past 512 tokens; this PR uses a 64-split plateau through 6144 tokens, thenMAX_NSPLITS=256.The flash-decode grid is
num_kv_heads · n_splitsCTAs (num_kv=4→ 128 CTAs at 32 splits). Atbs=1the split kernel is occupancy-bound (~300 GB/s) while LM-head/MoE GEMVs already sit at 93–95% of the ~1.79 TB/s roofline — so more splits help until combine/partials cost dominates. Micro-bench on the split+combine path shows 128 is never optimal in isolation; the sweet spot is 32 (short) → 64 (mid) → 256 (long).Kernel files untouched — launch heuristic only. Gated by
SPARKINFER_NSPLITSpin andSPARKINFER_SPLIT_CHUNK.n_splitsonly repartitions the KV reduction; online-softmax combine is exact → accuracy gate unaffected. Monotonic inseqlen→ at most two CUDA-graph re-captures per generation.Proof of speedup
sm_120)Decode tok/s (end-to-end, from
bench/scripts/bench.sh):(scored at ctx=4096 — see full sweep below)