vulkan: use mul_mat_vec_id for high-expert-count MoE decode - #25862
Draft
essentialols wants to merge 1 commit into
Draft
vulkan: use mul_mat_vec_id for high-expert-count MoE decode#25862essentialols wants to merge 1 commit into
essentialols wants to merge 1 commit into
Conversation
Extend ggml_vk_use_mul_mat_vec_id() to route MoE models with a large number of experts (>64, e.g. DeepSeek-V3/V4-class 256-expert models) to the mul_mat_vec_id path in the decode regime (batch <= 256). On RADV (Mesa, tested on Radeon 680M / gfx1035) the mul_mat_id shader for >=256 experts stalls during pipeline compilation at high --n-gpu-layers, hanging the device. Routing these dispatches to the existing mul_mat_vec_id path avoids the stall and is also faster per-dispatch for token generation.
|
Hi @essentialols, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
Contributor
|
Open an issue and try to identify why it hangs first. Most likely the validation layers will show some problem. |
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.
Extends
ggml_vk_use_mul_mat_vec_id()to route MoE models with a large number of experts (>64, e.g. DeepSeek-V3/V4-class 256-expert models) to themul_mat_vec_idpath in the decode regime (batch <= 256).Motivation
On RADV (Mesa; tested on an AMD Radeon 680M / gfx1035, Mesa 26.1.4) the
mul_mat_idshader for >=256-expert MoE models stalls during pipeline compilation at high--n-gpu-layers, wedging the device (SMU becomes unresponsive:SMU: No response,Ring sdma0 reset failed,GPU reset ... ret=-62). Routing these dispatches to the existingmul_mat_vec_idpath avoids the stall and is also faster per-dispatch for token generation.Change
ggml_vk_use_mul_mat_vec_id(): alongside the existing small-batch case (batch <= 8), also return true whensrc0->ne[2] > 64(>64 experts) andsrc2->ne[1] <= 256, restricting the change to the decode regime so large prefill batches are unaffected.Testing
AMD Radeon 680M (gfx1035), Vulkan/RADV, Mesa 26.1.4, build b10066.
-ngl 99(empty output, device wedge requiring a GPU reset).-ngl 99.