Repository navigation
[DSV4] perf: Make FP8 quant output tensor contiguous - #27926
Conversation
…bit_v2 Add support for row-major FP8 quantization with UE8M0 scaling in the per_token_group_quant_8bit_v2 CUDA kernel. When SCALE_UE8M0 is enabled with row-major layout, the kernel now directly rounds scales to power-of-two format, eliminating the need for a separate deep_gemm.ceil_to_ue8m0 call. Split from sgl-project#26582 for wheel release purposes.
…python) Use the new row-major UE8M0 scale support in sgl-kernel to fuse the separate deep_gemm.ceil_to_ue8m0 call into sglang_per_token_group_quant_fp8 with scale_ue8m0=True for the wo_a path. Depends on the kernel change in the sgl-kernel PR. Split from sgl-project#26582 for wheel release purposes.
There was a problem hiding this comment.
Code Review
This pull request adds support for row-major float32 scale layouts with power-of-2 values (scale_ue8m0) and outer-major scale layouts (scale_outer_major) in the per-token group quantization FP8 kernel, updating both the CUDA kernel and Python APIs, and integrating them into the DeepSeek-V4 model. Feedback on the changes suggests wrapping the deep_gemm import in a try-except block and adding a guard in the new tests to prevent ImportError and test failures on non-Hopper platforms where deep_gemm is not installed.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
On B300 with eval commands from #29036: == gpqa ==
198 examples (single-shot) | 1796.4s | 1146 tok/s | 2.1M tokens
* score = 89.39%
stop_rate = 100.00%
truncated_rate = 0.00%
error_rate = 0.00% |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
1 similar comment
|
/rerun-failed-ci |
|
/rerun-test test/registered/models_e2e/test_deepseek_v4_flash_fp4_h200.py test/registered/models_e2e/test_deepseek_v4_flash_fp8_h200.py test/registered/models_e2e/test_deepseek_v4_flash_fp4_b200.py test/registered/models_e2e/test_deepseek_v4_flash_fp4_megamoe_b200.py test/registered/cp/test_deepseek_v4_flash_fp4_b200_cp.py test/registered/disaggregation/test_disaggregation_dsv4.py |
|
/rerun-test test/registered/gb300/test_deepseek_v4_pro_fp4.py |
|
Results for 🚀 🚀 |
|
Results for ⛔ |
|
/rerun-test test/registered/jit/deepseek_v4/test_fp8_wo_a.py |
|
Results for 🚀 |
…ensor contiguous (sgl-project#27926) (sgl-project#30449) Co-authored-by: Kaixi <matteochen3@gmail.com> Co-authored-by: liqichao <liqichao@baidu.com> Co-authored-by: chenbong <bhchen@stu.xmu.edu.cn>
Co-authored-by: liqichao <liqichao@baidu.com> Co-authored-by: chenbong <bhchen@stu.xmu.edu.cn>

Motivation
This PR is an alternative way to achieve #27680.
Deep gemm FP8 einsum silently falls back to an unoptimized path if the input tensor is not contiguous. We can make the
per_token_group_quant_8bit_v2to emit the scale layout needed by deep gemm.This also implicitly fixes #29038. The previous DSV4
wo_aFP8 DeepGEMM path flattenedo: [T, G, D]into[T * G, D]and then viewed the scales back as[T, G, -1]. On the SM100 FP8 einsum path, scales are consumed as per-group slabs, so flattening acrossT * Gcan associate a token's FP8 codes with another group's scale. This PR quantizesoas[T, G, D]and emits the scale tensor in DeepGEMM's expected outer/group-major layout, preserving thescale[t, g]too[t, g, :]association.Modifications
Accuracy Tests
Speed Tests and Profiling
Node: 8XB300 + DSV4-Pro
Pareto for 1k1k, no MTP:
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #28783296006
Latest PR Test (Extra): ❌ Run #28783295767