-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix the run-time error when calling fused_rms_mxfp4_quant that change return output number #12803
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
Fix the run-time error when calling fused_rms_mxfp4_quant that change return output number #12803
Conversation
… the return output number
Summary of ChangesHello @kkHuang-amd, 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 resolves a critical runtime error affecting 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.
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 addresses a runtime error caused by a change in the number of return values from the fused_rms_mxfp4_quant function. The changes correctly update the call sites to unpack the new number of return values across communicator.py and deepseek_v2.py. The fix is correct and directly addresses the issue. I have added a few suggestions to use extended iterable unpacking (*_) which would make the code more robust against potential future changes to the function's return signature.
|
|
||
| if _use_aiter and _is_gfx95_supported and ("mxfp4" in qaunt_format): | ||
| hidden_states = fused_rms_mxfp4_quant( | ||
| hidden_states, _, _ = fused_rms_mxfp4_quant( |
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.
To improve robustness against future changes in the fused_rms_mxfp4_quant function's return signature, consider using *_ to capture all unused return values. This makes the code more resilient if the number of returned values changes again.
| hidden_states, _, _ = fused_rms_mxfp4_quant( | |
| hidden_states, *_ = fused_rms_mxfp4_quant( |
| else: | ||
| if _use_aiter and _is_gfx95_supported and ("mxfp4" in qaunt_format): | ||
| hidden_states, residual = fused_rms_mxfp4_quant( | ||
| hidden_states, _, residual = fused_rms_mxfp4_quant( |
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.
To improve robustness against future changes in the fused_rms_mxfp4_quant function's return signature, consider using *_ to capture all unused return values. This makes the code more resilient if the number of returned values changes again.
| hidden_states, _, residual = fused_rms_mxfp4_quant( | |
| hidden_states, *_, residual = fused_rms_mxfp4_quant( |
| else: | ||
| if _use_aiter_gfx95 and self.q_b_proj.weight.dtype == torch.uint8: | ||
| q, k_nope = fused_rms_mxfp4_quant( | ||
| q, k_nope, _ = fused_rms_mxfp4_quant( |
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.
To improve robustness against future changes in the fused_rms_mxfp4_quant function's return signature, consider using *_ to capture all unused return values. This also helps to fix the minor trailing whitespace issue.
| q, k_nope, _ = fused_rms_mxfp4_quant( | |
| q, k_nope, *_ = fused_rms_mxfp4_quant( |
| else: | ||
| if _use_aiter_gfx95 and self.q_b_proj.weight.dtype == torch.uint8: | ||
| q, k_nope = fused_rms_mxfp4_quant( | ||
| q, k_nope, _ = fused_rms_mxfp4_quant( |
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.
To improve robustness against future changes in the fused_rms_mxfp4_quant function's return signature, consider using *_ to capture all unused return values. This makes the code more resilient if the number of returned values changes again.
| q, k_nope, _ = fused_rms_mxfp4_quant( | |
| q, k_nope, *_ = fused_rms_mxfp4_quant( |
Motivation
Handle multiple output number to solve the incorrect type in attention call when running deepseek mxfp4 model
Modifications
All used fused_rms_mxfp4_quant places
Accuracy Tests
Benchmarking and Profiling
# python3 benchmark/gsm8k/bench_sglang.py --num-questions 2000 --parallel 2000 --port 8000 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1319/1319 [01:23<00:00, 15.74it/s] Accuracy: 0.939 Invalid: 0.000 Latency: 84.240 s Output throughput: 1574.955 token/sChecklist