Repository navigation
tp-check gemma run: --layer-stride to measure Gemma's decode stride - #1827
Merged
Merged
Conversation
Gemma tensor parallel submits each decode step after every layer (decodeLayerStride = 1, "not yet measured for Gemma"). Qwen's pair measured 21.4 -> 20.2 ms per step at stride 8 (#1820). This adds the bench option that measures Gemma's stride on a pair before the product default moves: Gemma4TensorParallelModel.withLayerStride and gemma run --layer-stride N (paged path; full, shard or tp), bound into the ranks' workload digest, with a step p50 line. layerSubmissionKeepsEveryBit now also covers strides 5 and 8; a CPU test pins the wrapper's scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Review of #1827 (nit 6): simulated runs both ranks on the local pair's own threads, which never see the TaskLocal stride, so the product stride ran while the log said stride=N. Gemma4TensorParallelModel .benchLayerStrideApplies(mode:) names the modes a stride reaches (full, shard, tp); the tool refuses any other, and the CPU test pins it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 5, 2026
Brings in the Gemma TP build-ahead steps (#1822, #1824) and the bench layer stride (#1827). Conflict in tp-check's `gemma run` resolved by keeping both: `--mtp-depth`/`--assistant-dir` beside `--layer-stride`, both bound into the ranks' workload digest. Speculative rounds keep their own loop (runRounds), which reads each round's agreement before it builds the next round; the plain loop's build-ahead is unchanged. 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
A bench option for measuring Gemma's decode stride on a pair; it doesn't change the product.
Gemma tensor parallel submits each decode step to the GPU after every layer (
Gemma4TensorParallelModel.decodeLayerStride = 1, documented as "not yet measured for Gemma"). For Qwen, moving from 1 to 8 took a pair's step from 21.4 to ~20.2 ms (1 request) and from 35.4 to 29.9 ms (4 at once) (#1820). This PR lets the M5 Ultra pair measure Gemma's curve before the product default moves:Gemma4TensorParallelModel.withLayerStride(_:_:): a bench's own stride for its body (the existing internal@TaskLocal).darkbloom-cluster-tp-check gemma run --layer-stride N(paged path;full,shardortp):decode stride=N step_ms_p50=… step_ms_min=….Tests
Gemma4TensorParallelRuntimeTests.layerSubmissionKeepsEveryBit(GPU) compares the whole step (stride 0) with strides 1, 2, 5 and 8. Before, it compared 0 with 1 and 2. Tokens, top logits and the final row must be bitwise. Queued for the next GPU slot.aBenchsLayerStrideHoldsForItsBodyOnly(new; CPU, run locally: passes).build-native-worker.sh), andcheck-weak-imports.shpasses. A staged copy is intp-perf/binx-gemma-stride/on Mac A, shaef184bcff38e.Docs:
docs/architecture/inference.md(Gemma oracles). No changelog fragment: there's no user-visible change.Slot command on the pair, one run per stride:
gemma run --mode tp --backend jaccl --reduction sealed-bench --path paged --layer-stride {1,4,8,15} --model-dir <gemma-4-26b-qat> --request <req> --report <new>Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Hardware results (M5 Ultra pair, 2026-11-05 19:56–19:58Z, Mac A load 3.4–6.9)
layerSubmissionKeepsEveryBit(strides 1/2/5/8) andaBenchsLayerStrideHoldsForItsBodyOnlyPASS.