Repository navigation
[Fix][ROCm] MXFP4 MoE round-up inflates TP-sharded expert weights on CDNA3, starving KV cache - #56359
Conversation
5b31ca6 to
fb28983
Compare
|
✅ @vllmellm, CI is now available for this PR.
|
|
/ci run |
|
❌ @Rohan138, Only reviewers with write access can use CI commands before CI is delegated to the PR author. |
|
/ci run |
|
❌ This PR is 250 commits behind upstream |
|
@vllmellm can you rebase and run ci? |
…ghts on CDNA3 Signed-off-by: vllmellm <vllm.ellm@embeddedllm.com>
63d4d57 to
c7798c2
Compare
|
/ci run |
|
❌ This PR is 1 commit behind upstream |
|
/ci run |
|
✅ Triggered Buildkite CI #89518 for commit |
|
Hi @vllmellm, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
Signed-off-by: vllmellm <vllm.ellm@embeddedllm.com>
Signed-off-by: vllmellm <vllm.ellm@embeddedllm.com>
|
/ci run |
|
✅ Triggered Buildkite CI #89526 for commit |
|
/ci run |
|
✅ Triggered Buildkite CI #89622 for commit |
|
/ci run |
|
/amd-ci run |
|
✅ Triggered Buildkite CI #89626 for commit |
|
❌ This PR is 1 commit behind upstream |
Purpose
Fixes #53961
While testing #53961, I found that the per-GPU VRAM used for weight loading is 135.35 GiB (without EP) vs 103.54 GiB (with EP). Upon closer investigation, it is caused by the rocm's branch of
mxfp4_round_up_hidden_size_and_intermediate_sizewhich rounds the intermediate moe size to 256 which inflated the expert weights usage. Before this PR, an existing special case for Kimi-K3 (AITER+SiLU/SiTU) already aligns to 128 instead of 256.Concretely, for DeepSeek-V4-Pro (
moe_intermediate_size=3072, TP=8, no EP):w13_weightcreated as(384, 1024, 3584)instead of(384, 768, 3584)→ +33% expert weights = +30 GiB/GPUmax_num_batched_tokens(16384 since [Config] Update default_max_num_batched_tokensfrom 8192 to 16384 #51726), caused the observation from [Bug]: PR #51726's >=160GiB tier captures MI300X (191.98 GiB), doubling max_num_batched_tokens and breaking KV cache init for DeepSeek-V4-Pro at 1M #53961EP wasn't affected because each GPU holds whole experts, so the intermediate dimension stays at its native 3072 (already aligned); without EP, TP slices it to 384 per GPU, which is not aligned and gets padded.
Change
I extended the existing 128-alignment exception to also cover TRITON_UNFUSED with SiLU/SiTU activation. The pre-existing AITER arm is unchanged: K3's AITER kernel (gfx950-only) handles its native intermediate size (moe_intermediate 3072; e.g. 384/partition at TP8), so K3 keeps 128 on CDNA4.
For the new TRITON_UNFUSED arm, the 128-alignment is gated to CDNA != 4, because opt_flags_amd sets matmul_ogs's block_k=128 whenever weight scales are present on CDNA != 4 (always the case for mxfp4 W4A16 checkpoints) — the unpadded 384-element shard already satisfies the kernel's even-K requirement. gpt-oss (SWIGLUOAI, tuned in #38043) keeps 256.
In essence, the checks keeps the pre-existing Kimi-K3, gpt-oss handling while letting DeepSeek-V4 Pro (TRITON_UNFUSED + SiLU/SiTU on CDNA3) keeps the 128 size without rounding up to 256.
Test Plan
Tested the before/after using this serve command:
Test Result
Model loading took(TP8, no EP)Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.