Support hidden_dim % 4 == 0 in per_token_quant_fp8#12883
Conversation
Summary of ChangesHello @BBuf, 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 the flexibility of the 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 correctly extends sgl_per_token_quant_fp8 to support hidden dimensions divisible by 4, which is a necessary change for compatibility with certain models. The logic is sound, and the test cases have been updated appropriately to cover the new functionality. My review includes suggestions to refactor the kernel dispatch logic in sgl-kernel/csrc/gemm/per_token_quant_fp8.cu. These changes would reduce code duplication and improve the overall maintainability of the file.
Summary
This PR extends
sgl_per_token_quant_fp8to support hidden dimensions divisible by 4 (previously required divisibility by 8).Changes
TORCH_CHECKfromhidden_dim % 8 == 0tohidden_dim % 4 == 0kVecSize=4code path for both kernel variantshidden_dim=1076Motivation
Fixes deployment issue with qwen3-30b-a3b-moe-fp8 model which has layers with
hidden_dim=1076(1076 % 4 == 0 but 1076 % 8 != 0).The model is generate by following script and serving with TP4 :
And when serving with sglang tp4, the bug happend: