[Perf] Tune MiniMax M2 fused moe kernel on H100 GPU#18851
[Perf] Tune MiniMax M2 fused moe kernel on H100 GPU#18851Kangyan-Zhou merged 1 commit intosgl-project:mainfrom
Conversation
Summary of ChangesHello @zhendonghua, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the inference performance of the MiniMax-M2 model when deployed on H100 GPUs. It addresses a sub-optimal throughput issue by integrating a newly tuned configuration for the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a performance optimization for the MiniMax-M2 model on H100 GPUs by adding a new pre-tuned configuration file for the fused MoE Triton kernel. The PR description clearly outlines the tuning process and provides benchmark results demonstrating a ~5% throughput improvement, which is a valuable contribution. The new configuration file is well-structured and follows the existing conventions within the project. The change is self-contained and looks good.
Motivation
MiniMax-M2 is not tuned on fused_moe_kernel and H100 gpu, which leads to a sub-optimal performance of throughput.
This PR runs the script that tunes Triton MoE Kernel, benchmarks the decode throughput and profiles the performance of tuned fused_moe_kernel.
The fused_moe_kernel is tuned by the following instruction.
Modifications
Add a configuration json file
python/sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_5_1/E=256,N=384,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].jsonAccuracy Tests
Benchmarking and Profiling
Serve the model with
Benchmark the performance with
The output is as depicted below. The output throughput is 1008 token/s. Without the tuned kernel, the output throughput is 960 token/s. It brings about 5% speedup.

Profile with
python3 -m sglang.bench_serving --dataset-name random --backend sglang-oai --random-range-ratio 1 --random-input-len 1200 --random-output-len 20 --max-concurrency 1 --num-prompts 5 --port 23333 --profile.The performance is as depicted below. The fused_moe_kernel takes ~12 us. The un-tuned kernel takes ~15.5 us

Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci