Support flashinfer_cutlass Fused MoE on SM90 for FP8#18388
Support flashinfer_cutlass Fused MoE on SM90 for FP8#18388b8zhong wants to merge 5 commits intosgl-project:mainfrom
flashinfer_cutlass Fused MoE on SM90 for FP8#18388Conversation
Summary of ChangesHello @b8zhong, 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 Mixture-of-Experts (MoE) capabilities by integrating a new 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 adds support for the flashinfer_cutlass backend for Fused MoE on SM90 for FP8, which is a great performance enhancement. The implementation is well-structured, adding a new code path for this backend and refactoring the existing cutlass logic for better clarity. The documentation is also updated accordingly. My main feedback is to add more robust error handling for activation functions to prevent potential runtime errors.
| activation = self.moe_runner_config.activation | ||
| activation_type = { | ||
| "silu": ActivationType.Swiglu, | ||
| "relu2": ActivationType.Relu2, | ||
| }[activation] |
There was a problem hiding this comment.
The direct dictionary access [activation] to determine activation_type is unsafe. If an unsupported activation function is provided (e.g., 'gelu'), this will raise a KeyError and crash the server. It's better to handle this case gracefully by checking if the activation is supported and raising a more informative error like NotImplementedError if it's not.
activation = self.moe_runner_config.activation
activation_map = {
"silu": ActivationType.Swiglu,
"relu2": ActivationType.Relu2,
}
activation_type = activation_map.get(activation)
if activation_type is None:
raise NotImplementedError(
f"Unsupported activation function for flashinfer_cutlass: {activation}"
)|
/tag-and-rerun-ci |
Motivation
Currently, we use
cutlass_fused_moein NVFP4, but it supports FP8 on SM90 and SM100 (in SM100 case, it's only used for large scale prefill, and for decode,flashinfer_trtllmis better, thus not really for that use case, but rather just to support SM90 and do some comparisons to thecutlassand originaltritonbackend created in #7278.In TP MoE it seems triton is quite efficient. I didn't try the EP scenario. It can be left in the future
Modifications
Add it
Benchmarking and Profiling
For

flashinfer_cutlassAssoc. GSM8K:
cutlasstritonAssoc. GSM8K (baseline):