Repository navigation
models : consolidate nextn row cropping into shared helpers - #30017
Merged
Merged
Conversation
the other nextn-capable models set it unconditionally Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-MOPD
- replace the duplicated crop conditions and the per-model flags (narrow_early, crop_before_ffn, crop_last_layer, emit_h_nextn) with two helpers on llm_graph_context: crop_before_nextn() / crop_after_nextn() - models that only tested embeddings_nextn_masked now share the same condition, so they crop the last layer before the nextn capture whenever extraction is off - t_h_nextn is now set unconditionally in mimo2, qwen4exp and deepseek4 (as in the other nextn-capable models); host-side reads stay gated by cparams.embeddings_nextn Assisted-by: pi:llama.cpp/MiMo-V2.6-Flash-MOPD
ggerganov
force-pushed
the
gg/out-ids-consolidate
branch
from
October 6, 2026 09:56
57f2156 to
bba2180
Compare
ggerganov
marked this pull request as ready for review
October 6, 2026 10:28
CISC
approved these changes
Oct 6, 2026
ServeurpersoCom
approved these changes
Oct 6, 2026
ServeurpersoCom
left a comment
Contributor
There was a problem hiding this comment.
Tested on CUDA: ctest -L main passes, and GLM-4.5-Air greedy outputs are bit-identical to master both without and with draft-mtp (same 59.4% acceptance), with no reallocation under GGML_SCHED_DEBUG_REALLOC=1. The 8 models that now crop late by default show no measurable prefill cost (GLM-4.5-Air and GLM-4.7-Flash, pp512 and pp4096 within noise). LGTM.
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.
Overview
narrow_early,crop_before_ffn,crop_last_layer,emit_h_nextn) with two helpers onllm_graph_context:crop_before_nextn()/crop_after_nextn()inp_out_ids != nullptr, so the pair documents where the narrowing happens relative to thet_h_nextncapturet_h_nextnis now set unconditionally inmimo2,qwen4expanddeepseek4, as in the other nextn-capable models; host reads stay gated bycparams.embeddings_nextnembeddings_nextn_maskednow share the same condition: with extraction off the last layer is cropped before the capture, which saves its FFN rows - outputs are unchangedsrc/llama-graph.h+ 19 models)Additional information
Requirements