Repository navigation
spark25, minimax_m3 cuda: a prompt chunk's last layer runs only the rows something reads - #3122
Merged
Merged
Conversation
Owner
Author
|
GB10 A/B on this head (Spark 2.5, pp, sweep, chat and long cells): GREEN, every token hash equal to main, speed level. No box of ours has a MiniMax-M3 checkpoint, so the MiniMax half rests on its host tests and on the tail kernels' row independence argued above. Queued to land.
|
This was referenced Nov 15, 2026
…ows something reads Both families now take core's prompt tail, as Qwen 3.5's CUDA forward does. The last layer still projects and writes every row's keys and values (and MiniMax's index keys), then runs attention, o, the norms and the MLP or MoE only for the prompt's last chunk's tail: from core's start (the last 128 rows) rounded down to a 64-row boundary, so its rows keep the tiles they have in the whole chunk. An earlier chunk's head is never read, so its last layer stops at its cache writes and the head is skipped. With MiniMax's DSpark drafter the tail starts no later than the first row its absorb reads (its window and a window's rows before the prompt's end), since those rows' layer-59 taps feed it; every tensor-parallel rank derives the same rows from the chunk and the prompt's length. Every key, value and index key is written as before, the tail rows run the same prompt kernels at the same positions (EXL3 and affine prompt GEMMs in 128-row blocks with one fp32 chain over K, row-independent attention, selection and experts), and the kept last row is in the tail, so every token is unchanged. test-minimax-cuda-host and test-spark25-host: which rows each chunk runs, with and without DSpark.
ashhart
force-pushed
the
lead/cuda-prompt-tail-spark25-minimax
branch
from
November 15, 2026 18:41
b420524 to
f657e5a
Compare
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.
On CUDA, Spark 2.5 and MiniMax-M3 ran the last layer of every prompt chunk over all its rows, though only the final rows feed anything. The prompt-tail skip Qwen already uses now covers both: earlier chunks stop the last layer at its cache writes, and the last chunk runs the full layer only on the rows something reads. With DSpark, MiniMax's drafter reads layer 59 for the last ~4.1K rows, so those rows still run it. Both prompt matrix kernels work in 128-row blocks with one fp32 chain over K, so a row's result doesn't depend on its block; every tensor-parallel rank computes the same tail.
Tests:
test-minimax-cuda-host16 (main 14) andtest-spark25-host13 (main 12) pass;check-native-cuda-hostreaches every changed function;compile-cuda-testspasses for aarch64 and x86_64.Device check pending (GB10): Spark 2.5 and MiniMax (one rank and the TP group, with and without DSpark), greedy and sampled token hashes equal to main's on multi-chunk prompts whose last chunk is 129-200 rows or a whole 512 or 2,048-row chunk; first-token logits byte-equal;
tf-cuda-test spark25-pagespasses; prefill A/B.