Repository navigation
CUDA: fuse MoE gate/up matmuls and GLU in MMQ - #31188
Merged
Merged
Conversation
anujj
force-pushed
the
cuda-mmq-fused-gate-up-moe
branch
from
October 26, 2026 14:19
7aa8ffe to
447ab31
Compare
anujj
force-pushed
the
cuda-mmq-fused-gate-up-moe
branch
from
October 26, 2026 14:55
447ab31 to
eb4eee1
Compare
anujj
marked this pull request as ready for review
October 27, 2026 04:35
Contributor
Author
|
Requesting @JohannesGaessler to review this |
am17an
approved these changes
Oct 27, 2026
gaugarg-nv
approved these changes
Oct 28, 2026
PapyKahan
added a commit
to PapyKahan/llama.cpp
that referenced
this pull request
Oct 28, 2026
Upstream's version is kept wherever it does what the branch did; the branch's stays where upstream has none: - MoE cache: the constructor takes upstream's no_alloc flag beside the CPU share, buffers come from llama_memory_bufs::alloc_buf; phases and host mode as before. - build_moe_ffn: the branch's experts lambda (cache slots, host mode, shared batches) with upstream's DeepSeek-4.1 and Laguna changes. - qwen4exp: the selection is built over the cache cells as upstream now does (ggml-org#30965, ggml-org#31243), the branch keeps its query chunks (ggml-org#30815's earlier version); upstream's hc_mix outputs and merged tensors. - CUDA MMQ: the tile map of active MoE tiles also launches upstream's fused gate/up/GLU kernel (ggml-org#31188, ggml-org#29948); the fused paths zero the rows of negative ids as ggml_cuda_mul_mat_id does. - CPU MUL_MAT_ID: upstream's -1 skip (ggml-org#26631) and the branch's two-pass grouping agree, negative ids are skipped. - tests: the QSA chunk tests move with upstream's archs tests; a MUL_MAT_ID result marked by ggml_mul_mat_id_set_negative_ids runs on CUDA again, only unmarked ones are excluded ([TAG_MUL_MAT_ID_SKIP]). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P3vd8iuiuxiev7wMPyJmSf
yzhou51
pushed a commit
to yzhou51/llama.cpp
that referenced
this pull request
Oct 30, 2026
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.
Extension of #29948 to MoE models: the same fused gate/up + GLU MMQ kernel now also runs for the expert FFNs (
MUL_MAT_ID).For prompt processing, the gate and up expert matmuls and the following
GLUrun as onemul_mat_qlaunch, exactly as for dense FFNs in #29948.Performance
llama-bench -ngl 999 -fa on -p 16384 -n 0 -b 2048 -ub 2048 -ctk f16 -ctv f16 -r 5, tok/s:Correctness
Requirements