Skip to content

Optimize fused_dynamic_mxfp4_quant_moe_sort_hip in small M#2700

Merged
valarLip merged 3 commits intomainfrom
jun/fp4_sort_update
Apr 13, 2026
Merged

Optimize fused_dynamic_mxfp4_quant_moe_sort_hip in small M#2700
valarLip merged 3 commits intomainfrom
jun/fp4_sort_update

Conversation

@junhaha666
Copy link
Copy Markdown
Contributor

test on MI355: python3 op_tests/test_moe_sorting_mxfp4.py -dim1 7168 -dim2 256 -ek 256,8
Stage1:
before:
image
now:
image

Stage2:
before:
image
now:
image

@junhaha666 junhaha666 requested review from a team and Copilot April 11, 2026 11:10
@github-actions
Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:triton-355 Run Triton tests on MI355 in addition to MI325
ci:sglang SGLang integration tests
ci:atom ATOM benchmark (DeepSeek-R1 + GPT-OSS)
ci:vllm vLLM benchmark
ci:all All of the above

Add labels via the sidebar or gh pr edit 2700 --add-label <label>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Optimizes the HIP fused MXFP4 quantization + MoE scale sorting path for smaller M by changing the sorted_ids access pattern and adjusting the Python-side heuristic for when to use the fused kernel.

Changes:

  • Update mxfp4_quant_moe_sort_kernel to use a strided indexing scheme within block_m for sorted_ids traversal.
  • Pass tgs_per_block_m into the kernel and derive it from block_m / sub_block_m.
  • Adjust the stage2 dispatch threshold in fused_dynamic_mxfp4_quant_moe_sort to account for topk.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
csrc/kernels/quant_kernels.cu Implements strided sorted_ids traversal and adds tgs_per_block_m plumbing for the fused HIP kernel.
aiter/ops/quant.py Updates the stage2 cutoff heuristic for selecting the fused HIP path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread csrc/kernels/quant_kernels.cu
Comment thread csrc/kernels/quant_kernels.cu
@valarLip valarLip merged commit b025f09 into main Apr 13, 2026
34 of 35 checks passed
@valarLip valarLip deleted the jun/fp4_sort_update branch April 13, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants