refactor(gemma4): the serving contracts speak from one place - #1018
Merged
FeathBow merged 2 commits intoAug 31, 2026
Merged
Conversation
Signed-off-by: Feathbow <feathbow@gmail.com>
…note moves home Signed-off-by: Feathbow <feathbow@gmail.com>
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.
Description
Closes #1017
The newcomer admission existed in three copies (the plain path, the lane path and the mixed gather) and the decode emit contract in two (the staged deliver and the sampled rows).
prepare_newcomernow owns validation, prefix-cache resolution, reservation and the Scheduled handshake behind aNewcomerOptionsrow per caller;deliver_decode_rowowns the stop/token/length emit ladder; and the split-KV state builds, uploads and lends its launch views from its own impl. One deliberate alignment: the gather path's whole-account door moves from a hand-written availability check onto the same eviction-aware reservation the plain path uses (with eviction off, as the gather always behaved), so the door answers identically everywhere. Behavior is preserved — every option row reproduces its caller's path.Test Env
Single GPU (
sm_89, 48 GiB, x86_64)Verification
cargo fmt --all -- --checkandgit diff --checkpass; the Gemma 4 release server builds; all-target Gemma Clippy passes with-D warnings; release lib tests pass (52).mixed_prefill_decode_stepon the e4m3 pool, so the reservation alignment is exercised on both storage families./v1/completionsrequests (31-, 35-, 33- and 1421-token prompts, 64 forced tokens) with bytes identical tomain's binary, md5219de1e3c09c.