add fused fp8 moe kernel for low-latency llm inference#49
Open
VAthree wants to merge 1 commit into
Open
Conversation
3249469 to
2c6778b
Compare
|
请问这一版本和之前版本的hpc ops提供的fused_moe接口相比,性能有提升吗? |
2c6778b to
09886e3
Compare
Author
Yes. This version keeps the FusedMoE interface compatible while improving the underlying implementation. The performance gain is especially noticeable in TP-oriented low-latency scenarios. We have also provided a reproducible benchmark for users to validate the results directly. More detailed numbers will follow. Stay tuned. |
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.
Summary
This PR adds a fused per-tensor FP8 MoE operator for LLM MoE inference.
The operator fuses routing, Gate-Up GEMM, activation quantization, Down GEMM, and top-k weighted reduction into one pipelined execution path. Existing implementations commonly follow a gather-then-GEMM design: tokens are first sorted by expert and gathered into contiguous memory, then grouped GEMM is launched per expert. Their SM90 kernels usually rely on TMA plus Warp Specialization in a persistent mode to overlap data movement and compute within each CTA. In low-latency scenarios, the extra gather traffic and manually staged pipeline become major overheads.
This implementation restructures the full pipeline:
Benchmark
Benchmark scripts are included under:
bench/fused_moeOn NVIDIA H20 with CUDA 13 and PyTorch 2.11.0+cu130, this per-tensor FP8 path was benchmarked against recent vLLM CUTLASS, vLLM Triton, and SGLang backends across DeepSeek-V3, Hunyuan-V3, and Qwen3-235B shapes.
Relative to the median of the compared backends:
TP=8 EP=1: about1.5xto1.6xfasterTP=1 EP=8: about1.2xto1.5xfasterThe tests show no accuracy regression.
Tests
make format-checkpython3 setup.py build_extpytest -q tests/test_fuse_moe_cp_async.py tests/test_group_gemm_cp_async.pypytest -q tests/test_fuse_moe_pertensor.py tests/test_group_gemm_pertensor.pypytest -q tests/test_fuse_moe_blockwise.py tests/test_group_gemm_blockwise.py