Repository navigation
[Bugfix][ROCm] RDNA3 W4A16 MoE: handle the N-first CT weight layout - #60388
Merged
Merged
Conversation
vllm-project#52798 moved compressed-tensors WNA16 MoE weights to the canonical N-first layout, but _process_weights_rdna3 still read them as K-first, and the synthesized zero points were no longer registered for the RDNA3 backend, so the experts asserted on w1_zp at the first forward. Transpose weights and scales to the kernel's K-first layout before the exllama shuffle, and register the synthesized zero points again. Signed-off-by: JartX <sagformas@epdcenter.es>
JartX
marked this pull request as ready for review
October 7, 2026 11:01
JartX
requested review from
mgoin,
pavanimajety,
robertgshaw2-redhat,
tlrmchlsmth,
wzhao18,
yewentao256 and
zyongye
as code owners
October 7, 2026 11:01
JartX
marked this pull request as draft
October 7, 2026 11:06
…yout The RDNA3 MoE tests built the kernel's K-first packed weights directly, so they kept passing when vllm-project#52798 changed the layout compressed-tensors hands to the oracle. Feed N-first compressed-tensors weights through _process_weights_rdna3 and a full MoE forward, against a dequantized reference. Signed-off-by: JartX <sagformas@epdcenter.es>
Member
|
/ci run |
tjtanaa
enabled auto-merge (squash)
October 8, 2026 13:44
|
✅ Triggered Buildkite CI #93601 for commit |
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.
Purpose
#52798 ("Use canonical N-first weight format for CT WNA16 MoE", merged
September 28) changed the layout compressed-tensors WNA16 MoE weights reach
the backends in, but the RDNA3 (gfx1100) path was not updated. Since then any
compressed-tensors W4A16 MoE checkpoint fails on RDNA3 at the first forward,
with an assertion on
w1_zpin the experts.Two things broke:
_process_weights_rdna3still read the weights as K-first(
[E, K // 8, N], scales[E, groups, N]), which is whatmoe_gptq_gemm_rdna3needs, but they now arrive N-first(
[E, N, K // 8], scales[E, N, groups]).CompressedTensorsWNA16MoEMethodregistered the synthesized zero pointsonly for the CPU backend. The RDNA3 kernel needs them too, even for
symmetric checkpoints (the oracle synthesizes them), so
w13/w2_qzerosnever reached the layer.
What changes
oracle/int_wna16.py:_process_weights_rdna3transposes weights andscales to the kernel's K-first layout before the exllama shuffle.
compressed_tensors_moe_wna16.py: register the synthesized zero pointsfor
WNA16MoEBackend.RDNA3as well as CPU.Nothing changes for other backends.
Not a duplicate
upstream/main(df417f7) still has the K-first read. I searched open PRsfor
rdna3 moe,rdna3 w4a16,gfx1100 moe,moe_gptq_gemm_rdna3,rdna3 compressed-tensorsand52798. The only open PR touchingint_wna16.pyfor RDNA3 is #59783, which adds a group-size check in backendselection and does not touch weight processing.
Test plan
test_process_weights_from_compressed_tensors_layout:it builds weights the way compressed-tensors hands them to the oracle
(N-first, packed
[E, N, K // 8], scales[E, N, groups]), runs themthrough
_process_weights_rdna3and a full MoE forward (w1, SiLU, w2,top-k reduce), and compares with a dequantized PyTorch reference. The
existing tests build the kernel's K-first layout directly and call the op,
so they never exercised weight processing, which is why this regression
went unnoticed.
checkpoint (Qwen3.6-35B-A3B GPTQ W4A16, g32,
pack-quantized): fails onmainwithout this change, starts and passes GSM8K with it (below).Test results
On gfx1100, in an image built from
main(df417f7):rejects the weights (
group size (K/groups = 1) must be a multiple of 32),because it reads N-first data as K-first.
int_wna16.pyapplied on the samemainand mountedinto that image; the C++ kernel is unchanged): the new test passes, and
test_rdna3_moe_w4a16.pypassesin full (99 passed).
update-dockerfile-graph, which needs/bin/bashand could not run on my machine.End to end, on an image built from
main(df417f7) for gfx1100, 4x RX7900 XTX, TP4,
--dtype float16, Qwen3.6-35B-A3B GPTQ W4A16 g32 (symmetric,compressed-tensors):
assert self.w1_zp is not None and self.w2_zp is not None.Rdna3WNA16Experts, starts, and scores 97.5% onGSM8K (
tests/evals/gsm8k/gsm8k_eval.py --use-chat-completions --chat-template-kwargs '{"enable_thinking": false}' --num-questions 200 --temperature 0.6 --top-p 0.95 --max-tokens 2048, 5-shot, 0% invalid).The two files of this change were mounted over that image; the C++ kernel is
unchanged. The stock RCCL in the image could not set up P2P between these
GPUs, so it was rebuilt; this is unrelated to this PR.
AI assistance
I used AI assistance to find the cause and write this change. I have
reviewed every changed line and will run the tests above before marking it
ready.