[Piecewise CUDA Graph] Support ModelOpt FP4#13101
[Piecewise CUDA Graph] Support ModelOpt FP4#13101ispobock merged 16 commits intosgl-project:mainfrom
Conversation
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 enhances SGLang's capabilities by integrating ModelOpt FP4 quantization with its piecewise CUDA graph functionality. The core change involves defining a custom PyTorch operator for FP4 GEMM, which allows these quantized operations to be effectively captured and optimized by CUDA graphs. This integration aims to improve performance, as evidenced by the provided benchmarks showing better throughput and reduced latency, particularly at lower concurrency levels, while maintaining comparable accuracy. Highlights
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 ModelOpt FP4 quantization with Piecewise CUDA Graph. It achieves this by wrapping the FP4 GEMM and quantization kernels as torch.library custom ops, complete with fake implementations for torch.compile. This is a robust approach for integrating custom kernels with CUDA graphs and should yield performance benefits. The implementation is clean and correct. I have one minor suggestion for code cleanup.
| backend = ( | ||
| FLASHINFER_FP4_GEMM_BACKEND if FLASHINFER_FP4_GEMM_BACKEND else "cutlass" | ||
| ) |
|
With:
Without:
Acc:
Before:
After: