Repository navigation
fix(dflash): resolve target split prefill OOM from full-prompt logits - #118
Merged
davide221 merged 1 commit intoMay 7, 2026
Merged
Conversation
smpurkis
pushed a commit
to smpurkis/lucebox-hub
that referenced
this pull request
May 10, 2026
…prefill-last-logits fix(dflash): resolve target split prefill OOM from full-prompt logits
oliveagle
pushed a commit
to oliveagle/lucebox-hub
that referenced
this pull request
May 22, 2026
…prefill-last-logits fix(dflash): resolve target split prefill OOM from full-prompt logits
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
This fixes an unnecessary full-prompt logits allocation in the target layer-split prefill path.
Background
Normal prefill only needs the final token's next-token argmax. The previous target layer-split path still ran output norm + lm_head + argmax over the whole prompt activation, which materialized a
[vocab, prompt_len]logits workspace.For Qwen3.6-27B, that temporary workspace is about 7.9 GiB at an 8K prompt and about 15.8 GiB at a 16K prompt. As a result, split target runs could OOM even when the target weights and KV cache fit.
Changes
This PR only changes
dflash/test/test_dflash.cpp.compute_target_split_argmax()to accept atoken_offset.ggml_view_2d()from the requested token range instead of always viewing the full prompt.run_target_layer_split_forward(), compute logits and argmax only for the last token in normal prefill, replay, and autoregressive decode calls.run_target_layer_split_forward(), keep full-range argmax whenargmax_out != nullptr, which preserves the DFlash verify path where each candidate token still needs its own argmax.Rationale
The normal prefill path only consumes the last token's argmax as the seed for the next generation step. Computing logits for every prompt token does not change the result, but it creates a large temporary allocation for large-vocab models.
DFlash verification is different: it compares multiple candidate positions, so it still needs multi-token argmax. This change keeps that behavior intact while removing the unused full-prompt logits allocation from the ordinary prefill path.
Validation