[FP8][MoE] Honor UE8M0 activation scales in Triton MoE - #33005
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
More context: On Blackwell, native block-scaled MMA backends can consume E8M0 scale factors directly. The Triton MoE path here performs FP8 dot products and applies FP32 scales outside the dot; it does not use the block-scaled MMA interface that consumes packed E8M0 scale operands. However, when the checkpoint declares scale_fmt: ue8m0, those FP32 scale values should still be restricted to powers of two. This is not expected to materially affect model accuracy, but it removes a numerical-contract mismatch and helps align Triton with native block-scaled backends and FP8 trainers such as Miles/Megatron during RL (example). |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
@nvpohanh @maocheng23 can you help review or find right people? |
b8zhong
left a comment
There was a problem hiding this comment.
Question: why don't we use trtllm-gen MoE?
|
For pure SGLang inference with
The load-time FP4-to-FP8 conversion already derives power-of-two FP8 weight scales from the checkpoint's serialized E8M0 scales. |
This PR does not decide the MoE backend; it follows SGLang’s existing runner selection. Our use case sets |
|
I see. Though unless there are issues using that backend, I'd also recommend directly selecting it with |
|
@kaixih Please resolve conflicts |
# Conflicts: # python/sglang/srt/layers/quantization/fp8.py
|
/rerun-test test/registered/models_e2e/test_deepseek_v4_flash_fp8_h200.py |
|
/rerun-test test/registered/models_e2e/test_deepseek_v4_flash_fp4_b200.py |
|
/rerun-test test/registered/models_e2e/test_dsa_glm52_tp_mtp.py |
|
Results for 🚀 |
|
Results for 🚀 |
|
Results for 🚀 |
Motivation
DeepSeek-V4 checkpoint metadata declares
scale_fmt: ue8m0for its FP8 path. The official DSV4 reference applies this policy when quantizing activations before every expert Linear, so both FC1 and FC2 require power-of-two activation scales. The Triton MoE path previously dropped that policy and used continuousamax / 448FP32 scales instead.Test
Made Triton MoE recognize
use_scale_ue8m0and apply power-of-two activation scales to both FC1 and FC2, then ran the following model-level A/B evaluation.DeepSeek-V4-Flashlmsysorg/sglang:latest(sha256:7b6a35df9839fd593a94a1eaee82d7777f472225d9f3ad1f8a2e0cb2bd1785d0)SGLANG_DSV4_FP4_DEQUANT=1, allowing the Triton FP8 MoE path to be evaluated--moe-a2a-backend none; runtime logs confirmed the Triton MoE implementationc039e1a7)47f3c98c)CI States
Latest PR Test (Base): ✅ Run #31798419785
Latest PR Test (Extra): ❌ Run #31798423103