Repository navigation
Qwen TP decode: submit every 8 layers, not every layer (−15 % solo, −13 % at 4) - #1820
Merged
Merged
Conversation
A tensor-parallel decode step was submitted to the GPU after every decoder layer (decodeLayerStride = 1): 64 commits and GPU wake-ups a 27B token. On two M5 Ultra 256 GB over JACCL (sealed sums, synthetic 64-token prompt) a width-one step took 21.4 ms at stride 1 and 20.2-20.3 ms at 8-16 (25.1 vs 19.9-20.4 ms with the host loaded), width four 35.4 vs 29.5-29.9 ms; 32 is slower again (21.2 ms). Every stride retired the same tokens on both ranks. The stride moves to QwenTensorParallelLaunch.decodeLayerStride (8, inside the measured flat band, divides 32 and 64 layers) with decodeSubmissions, checked by the model-free TensorParallelPlanChecks. qwen-decode takes --backend jaccl and --layer-strides (default: the product's stride). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
QwenTensorParallelDecodeBench.pair ran the same run(...) call twice, with and without a layer-stride scope. One scope that keeps the current stride when the caller gives none does the same. The verify-window doc no longer says "layer by layer": windows submitted by layer (diagnostic) now use the decode stride, 8. Behaviour unchanged. Plan checks PASS; Qwen TP CPU suites 25/25. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #1820: the quieter slot (2026-11-05 19:58Z) measured -15 % for one request and -13 % for four, replacing the first window's 6 %/16 %/20 %. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 5, 2026
QwenStageTokenSampler.takePendingStepLogprobs came in from #1824 too: one copy kept, its doc naming both users (Gemma's one-token loop, Qwen's build-ahead). #1820's stride, #1822/#1824's CBv2OwnedRequestState.submit and #1830 are kept as on dev. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 5, 2026
qwen-decode keeps #1820's --backend jaccl and --layer-strides beside --build-ahead; the bench takes both layerStride and buildsAhead (the logic measured on the pair at 21:24-21:30Z). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch had an error being deployed
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.
What
Qwen tensor-parallel decode submits its forward to the GPU every 8 decoder layers instead of after every layer (
QwenTensorParallelLaunch.decodeLayerStride, wasQwenTensorParallelBatchSession.decodeLayerStride = 1). Evaluation order only: every primitive, input and rounded value is unchanged, so tokens, logits and committed state keep their bits. It is not a launch option, and the two ranks don't need to agree on it.darkbloom-cluster-tp-check qwen-decodealso takes--backend jaccl(a real pair) and--layer-strides 1,8,16(compare strides in one run; the default is the product's stride).Why: measured, not per chip
Setup: two M5 Ultra 256 GB over JACCL, Qwen 3.8 27B, sealed-bench sums,
qwen-decodethrough the real batch driver and native executor. Synthetic 64-token prompt, 128–256 output tokens. DevNet production window 2, 2026-11-05 15:47–15:53Z. Mac A's load came from other agents' builds.The curve is flat from 8 to 16 and worse again at 32, where the GPU waits for the host's first batch of layers. I chose 8 rather than tuning per chip:
Pair-2 (M3 Ultra + M5 Max) was not measured; that lane is owned elsewhere. The stride can be re-measured with
--layer-strideson any pair.Tokens identical
Hardware: every stride (0, 1, 2, 4, 8, 12, 16, 24, 32) retired the same token digest on both ranks in every run:
07e4ad1b7b1f3176;e9a2476641c3ba6d;5a19c6dc97432be2.The tool's cross-rank check printed "both ranks retired the same tokens in every run: true".
Suites: the existing GPU-gated parity tests already compare a whole-step evaluation (
layerStride0) withdecodeLayerStridebyte for byte, so they now cover 8:QwenTensorParallelMoEDecodeBenchTestssubmission-parity;QwenTensorParallelWindowSubmissionTests;QwenTensorParallelComputeBenchTests.These GPU suites ran on the M5 Ultra pair (2026-11-05 19:53Z,
63612983d9): 22/22 passed (results below). Not measured: the MoE submission-parity bench (noqwen3_5_moecheckpoint on the pair) and pair-2 speed.Tests
libs/darkbloom-cluster/Tests/TensorParallelPlanChecks/run.sh(model-free, CI's focused lane) addscheckDecodeSubmission:the product stride gives 4–8 submissions for 64 layers (the measured band);
it divides 32 and 64;
the submission count is right at stride 1, at 0, with a partial last batch, and with no layers.
Before (stride 1):
FAIL: 27B decode submissions at stride 1: 64, measured band 4-8,FAILED: 1.After:
decode submission: stride 8, 8 submissions for 64 layers,PASS.The tool builds with Xcode 27.2 (
build-native-worker.sh, no warnings in the changed files).Scope
decodeLayerStride = 1is unchanged (not measured).docs/architecture/inference.md. Changelog:changelog.d/tensor-parallel-decode-submits-every-eight-layers.md.Against the bar (pair ≥ 2× one Mac, plain vs plain): the re-measured step goes from 23.2 to 19.7 ms (−15 %, width 1) and from 32.1 to 27.8 ms (−13 %, width 4) on the tool's synthetic prompt. One M5 Ultra plain does 55.9 tok/s through DevNet (.95, realistic chat prompt), and 2× needs 112. This is the first of the idle-gap fixes. Next: GLM's pipelined one-token loop, the per-step host cost in
exactFrozenQuantizedInputProjections, and the MoE exchange.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Hardware results (M5 Ultra pair, 2026-11-05 19:53–20:01Z, Mac A load 2.9–5.8)
63612983d9(QWEN_TP_MTP_GPU=1 QWEN_TP_BATCH_GPU=1 swift test --filter 'QwenTensorParallelWindowSubmissionTests|QwenTensorParallelBatchSessionTests').qwen3_5_moecheckpoint on the pair.