Repository navigation
CBv2: commit Gemma 4's plain decode steps by operation count - #376
Merged
Merged
Conversation
MLX's defaults commit every 40-50 operations or 40-50 M distinct input elements. A step's inputs include the weights and each 64 MiB KV segment the history reads, so decode committed many times per step, reached MLX's limit of ten command buffers in flight, and waited inside evaluation. Plain decode steps now commit every 100 operations with no input bound, as Nemotron Super, Flint and GLM do. Prefill chunks and MTP rounds keep MLX's defaults. Results do not depend on the partitioning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CONTRIBUTING gives each new test one type; the kernel tests live in KernelTests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 of 16 tasks
jonathan308
marked this pull request as ready for review
November 2, 2026 19:19
jonathan308
added a commit
that referenced
this pull request
Nov 9, 2026
The 2026-11-08 rebase onto 67110e7 dropped the scoped 100/512 command-buffer limits: main already commits Gemma 4's plain decode steps every 100 operations (#376). The README still described those limits and claimed 14 tests, of which six remain. The README now says that the screen measured both changes and that the GeGLU change alone is unmeasured, names the six tests that cover it, and says that cluster ranks get the shared product with an SDK pin alone. The receipt is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 5 tasks
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.
Proposed changes
Plain decode steps of Gemma 4 (every row one token) now commit a Metal command buffer every 100 operations, with no input-size bound, through
CBv2DecodeCommandBufferLimitsProviding. MLX's defaults commit every 40 to 50 operations or 40 to 50 M distinct input elements. A step's inputs include the weights and each 64 MiB KV segment its history reads, so decode committed many times per step, reached MLX's limit of ten command buffers in flight, and waited inside evaluation instead of encoding ahead of the GPU. Results do not depend on the partitioning.Longer prefill chunks and MTP rounds keep MLX's defaults. A one-token prompt, or a one-token final prompt chunk, is decode-shaped and takes the limits too, under the shared helper's existing rule.
Provider side and evidence: Layr-Labs/d-inference#1712. Target: 0.10.7. Overlaps #364, which declares limits on the same class bundled with its GeGLU change.
Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes (not run)Gemma4DecodeCommandBufferTests: limits reach the steppable adapter, MTP rounds keep the defaults, logits bitwise equal under the limits)AI usage
accurately describes the code changes.
🤖 Generated with Claude Code