perf(ds4): batch heterogeneous MoE prefill by expert - #640
Open
cheese-cakee wants to merge 8 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
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
Accelerates DeepSeek-V4 heterogeneous prefill by batching owner-local routed experts into grouped
ggml_mul_mat_idgraphs instead of issuing a serial graph per active expert.DFLASH_MOE_GROUPED_MMID_PREFILL=0andDFLASH_MOE_EXPERT_MAJOR_MIN_TOKENS=512as rollback controls.Matched performance
Measured on Lucebox6 with AMD Radeon AI PRO R9700 (gfx1201) + Strix Halo Radeon 8060S (gfx1151), the same ROCmFP2 model, cache disabled, two warmups, and five measured requests per cell. Baseline is current
upstream/mainatac22a3ed; the measured implementation is retained in the final041b59dfhistory, followed only by masked-route correctness and regression-test hardening.chunk=512chunk=2048The wide-context cells use the same fixed 22,000 MiB expert budget (hot 60 experts/layer) on both heads so that both can run the single 2048-token chunk without an allocation failure. The headline is the matched 401-token production-prefill improvement
Correctness and validation
cd5cb9fb5ac3c4f4007e8b41d117da21622439cd05c1728f3e82f90e4f869dad.restore=false,slot=-1,prefix_len=0,disk_hit=false).test_deepseek4_mmid_grouped_cuda: parity PASS across 72 cases on physical gfx1201 and gfx1151, including direct+0.0assertions for wide masked ROCmFP2/ROCmFP3 owner routes.test_deepseek4_unit: PASS on physical gfx1201 and gfx1151.git diff --check: clean.The masked-route regression uncovered during qualification is fixed by zero-initializing compact MMID destination lanes before dispatch; this prevents unwritten owner-masked columns from contributing stale/NaN values during weighted reduction.