-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[Bugfix] Fix topk_ids indices_type for CUTLASS w8a8 FP8 MoE #20166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ming Yang <yming@meta.com>
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @minosfuture, 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 provides a crucial bugfix for the Mixture of Experts (MoE) implementation, specifically for FP8 quantization with CUTLASS. It resolves a runtime IndexError
that prevented the successful initialization and execution of models utilizing this configuration, ensuring the stability and functionality of FP8 MoE operations.
Highlights
- Bugfix: MoE FP8 Indexing: This pull request addresses a critical
IndexError
occurring during the execution of CUTLASS w8a8 FP8 MoE (Mixture of Experts) operations. The error stemmed fromtopk_ids
tensors being incorrectly cast totorch.uint32
, which is not a valid type for indexing in PyTorch. - Code Correction: The fix involves removing the explicit
indices_type=torch.uint32
argument from theapply
function call within thefused_experts
initialization incompressed_tensors_moe.py
. This allows the system to use the correct default or inferred integer type (e.g.,torch.long
) for indexing, resolving the runtime crash.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
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 .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and 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 to provide feedback.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly fixes a runtime IndexError
that occurred during MoE execution with CUTLASS. The error was caused by topk_ids
having an unsupported uint32
dtype for indexing. The fix, which removes the indices_type=torch.uint32
argument from the routing function call, is direct and effective, allowing the topk_ids
tensor to default to a valid type for indexing. The change is well-supported by the provided error log and test results.
thanks for the fix! could you also share the eval result? has cudagraph worked it? cc: @ElizaWszola @bnellnm to take a look! |
updated with lm-eval results. Note that it's tested with the correctness fix #20167. Yes, both eager and cuda graph work. |
Thanks for the fix! Can you please check if the kernels in |
Signed-off-by: Ming Yang <yming@meta.com>
updated. In PplxPrepareAndFinalize and DeepEPLLPrepareAndFinalize, |
Purpose
This PR fixes the following error when starting EP on Maverick:
In the PPLX implementation #18762, the dtype got flipped to uint32, here.
Besides this fix, the
workspace_shapes
needed another fix here from #19168, which is already merged; otherwise, the torch.zeros is slow for processing much larger size of data here.Test Plan
Test Result
runtime exception during init is fixed. Attaching benchmark results:
lm_eval results:
local-chat-completions (model=meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8,base_url=http://127.0.0.1:8081/v1/chat/completions,num_concurrent=32), gen_kwargs: (None), limit: 200.0, num_fewshot: 5, batch_size: 1
with cuda graph:
(Optional) Documentation Update