Dispatch GQA group size 5, 6, 7#2684
Conversation
Summary of ChangesHello, 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 FlashInfer library by expanding the range of supported GQA group sizes. This ensures compatibility with a broader spectrum of large language models that utilize non-power-of-2 GQA ratios, preventing runtime errors and improving the library's versatility and robustness. 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
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
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds support for GQA group sizes 5, 6, and 7 to enable models like Qwen3.5-27B. The change in include/flashinfer/utils.cuh is correct. I've added two comments: one suggesting a refactoring for better maintainability, and another pointing out missing test cases for the new group sizes to ensure correctness and robustness.
| } else if (group_size == 5) { \ | ||
| constexpr size_t GROUP_SIZE = 5; \ | ||
| __VA_ARGS__ \ | ||
| } else if (group_size == 6) { \ | ||
| constexpr size_t GROUP_SIZE = 6; \ | ||
| __VA_ARGS__ \ | ||
| } else if (group_size == 7) { \ | ||
| constexpr size_t GROUP_SIZE = 7; \ | ||
| __VA_ARGS__ \ |
There was a problem hiding this comment.
| } else if (group_size == 5) { \ | ||
| constexpr size_t GROUP_SIZE = 5; \ | ||
| __VA_ARGS__ \ | ||
| } else if (group_size == 6) { \ | ||
| constexpr size_t GROUP_SIZE = 6; \ | ||
| __VA_ARGS__ \ | ||
| } else if (group_size == 7) { \ | ||
| constexpr size_t GROUP_SIZE = 7; \ | ||
| __VA_ARGS__ \ |
There was a problem hiding this comment.
yzh119
left a comment
There was a problem hiding this comment.
GQA case should all go through tensor cores implementation, you can enable them by use_tensor_cores=True in attention APIs.
CUDA cores-based implementation (which your PR would affect) have bad performance on GQA.
|
Thanks for the insight! |
📌 Description
Models like Qwen3.5-27B use 24 Q heads with 4 KV heads, producing a
GQA group_size of 6. The existing macro only handled {1, 2, 3, 4, 8},
causing "Unsupported group_size: 6" errors at batch decode plan time.
Add the missing group sizes 5, 6, and 7 so that non-power-of-2 GQA
ratios are dispatched correctly.
🔍 Related Issues
🚀 Pull Request Checklist
Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.
✅ Pre-commit Checks
pre-commitby runningpip install pre-commit(or used your preferred method).pre-commit install.pre-commit run --all-filesand fixed any reported issues.🧪 Tests
unittest, etc.).Reviewer Notes
Summary by CodeRabbit