Repository navigation
[MoE] Add MoE configs for Qwen3.5 122B (TP1/2/4) and 35B (TP1/2), hotfix prefill Co kernels and retune MoE kernels - #3453
Merged
yixionghuo merged 7 commits intoJun 2, 2026
Conversation
apinge
marked this pull request as ready for review
June 1, 2026 08:33
apinge
marked this pull request as draft
June 1, 2026 08:56
apinge
force-pushed
the
qwen3.5_35b_tp1_tp2_122b_tp1_tp2_tp4
branch
from
June 1, 2026 08:58
3551781 to
fbd7fe3
Compare
apinge
marked this pull request as ready for review
June 1, 2026 09:48
apinge
marked this pull request as draft
June 1, 2026 10:00
apinge
marked this pull request as ready for review
June 2, 2026 05:45
This was referenced Sep 20, 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.
Motivation
In this PR, configs have been added to cover Qwen3.5 122B (TP1/2/4) and Qwen3.5 35B (TP1/2). At these problem sizes, MoE falls back to CK 2-stage kernels.
A hotfix replaces several prefill Co kernels for
Qwen3.5 397B TP8 (HIDDEN_SIZE, INTER_SIZE_TP, E, TOPK = 4096, 128, 513, 11),
Qwen3.5 122B TP8 (3072, 1024//8, 257, 9), and
Qwen3.5 35B TP4 (2048, 512//4, 257, 9)
to prevent potential out-of-bound reads.
It also adds coverage for token lengths
32 < token_len < 8192for these configs, generating Co kernels for all original AIter ASM kernels to improve accuracy, while keeping the first original line unchanged.Finally, we refined and re-tuned several pyhip asmjit kernels for Qwen3.5 397B TP8, Qwen3.5 122B TP8, and Qwen35B TP4. For Qwen3.5 122B (TP1/2/4) and Qwen3.5 35B (TP1/2), the CK kernels are updated and re-tuned to avoid mistakenly selecting the original aiter asm kernels under these configs.
Technical Details
Add MoE configs for Qwen3.5 122B (TP1/2/4) and 35B (TP1/2)
Force
run_1stage = Falseinaiter/fused_moe.pyfused_moe to prevent selecting the single-stage asm MoE kernel.In
csrc/ck_gemm_moe_2stages_codegen/gemm_moe_tune.py, comment outtasks.extend(self.gen_2stages_asm1_task(info, blockMs))andtask_1stage.extend(self.gen_1stage_asm_task(info))to avoid selecting the single-stage asm kernel and the stage-1 asm kernel.Note: These changes are only intended for kernel tuning purposes. Once tuning is complete, these files should be reverted to their original state.
Prefill Co kernel hotfix
A hotfix adds tuned prefill kernel configs (moe_2stage_down and moe_2stage_gateup) with
dyn=True, based on commit tingqli/pyhip@8a58deapyhip code as
Extended Token Length Coverage
We supplement the previous two PR #3400 and #3341 by adding coverage for token lengths
32 < token_len < 8192for the following configs: Qwen3.5 397B TP8, Qwen122B TP8, and Qwen35B TP4.Test Plan
Test Result
MoE Performance Comparison for Qwen3.5 122B (TP1/2/4) and 35B (TP1/2): Before vs After Tuning (us)
Unit: us. Lower is better.
35B TP1
35B TP2
122B TP1
122B TP 2
122B TP 4
Accuracy of Co Kernels
All tests passed.
Performance of Co Kernels
397B TP8
122B TP8
35B TP4
Submission Checklist
Co-authored-by: Cheng Luo [email protected]
Co-authored-by: Xiake.Sun [email protected]