Repository navigation
perf(models): opt the remaining families into maskless padded prefill - #3103
Merged
inureyes merged 2 commits intoNov 16, 2026
Merged
Conversation
GLM4V, GLM4V-MoE, Nemotron-NAS, Cohere2-MoE and EXAONE-MoE now report supports_maskless_padded_prefill, so a tile-aligned padded prefill piece skips create_padded_prefill_mask. Follows the five opt-ins of #3097. Nemotron-NAS keeps its caches inside the model, out of the engine's trim, so it implements trim_state over them and now accepts padded prefill. The GLM4V family keeps the stored MRoPE positions for the real rows of a padded embedding prefill and continues from them for the pad rows, where it used to fall back to index + rope_deltas for every row and mis-positioned the tokens after an image. Each family has a parity gate (unpadded, maskless, padding mask, plus the decode after the pad trim): tiny random-weight models in the lib tests, and the glm4v, glm4v_moe and nemotron_nas checkpoints in tests/maskless_padded_prefill_parity.rs. Maskless and masked agree at relative RMS 0 everywhere. Refs #3072, #3097. Closes #3101
inureyes
marked this pull request as ready for review
November 16, 2026 00:21
inureyes
deleted the
perf/issue-3101-maskless-padded-prefill-remaining
branch
November 16, 2026 00:21
4 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.
Summary
Opts GLM4V, GLM4V-MoE, Nemotron-NAS, Cohere2-MoE and EXAONE-MoE into
supports_maskless_padded_prefill, so a tile-aligned padded prefill piece of these families skipscreate_padded_prefill_mask. Follows the five opt-ins of #3097.index + rope_deltasfor every row, giving the real rows after an image the wrong positions.padded_tail_positionsnow keeps the stored rows for the real tokens and continues from them for the pad rows.trim_stateover those caches and enables both padded and maskless padded prefill.create_padded_prefill_maskis plain causal, so the masked arm ignores the sliding window past it (relative RMS 2.9e-3 from the unpadded forward on the tiny model). The maskless arm matches the unpadded forward exactly, so the opt-in is also the more accurate path there.Parity gates
Each gate prefills unpadded, padded without a mask, and padded with the padding mask, trims the pad, decodes one token, and compares both rows.
No benchmark was run: the change drops one
[1, 1, L, L]mask per padded piece and moves no arithmetic.Test plan
models::padded_prefill_parity_tests, the Cohere2-MoE and EXAONE-MoE gates, the Nemotron-NAS engine testtests/maskless_padded_prefill_parity.rson the three local checkpoints, lock-wrappedCloses #3101