[BugFix][MiniMax M3] Fix MXFP8 RMSNorm, row-parallel reduce, and sparse index bounds - #14704
[BugFix][MiniMax M3] Fix MXFP8 RMSNorm, row-parallel reduce, and sparse index bounds#14704HaoxinZong wants to merge 3 commits into
Conversation
Support MXFP8 RMSNorm configuration and row-parallel reduction, and clamp zero-prefix sparse index ranges. Signed-off-by: zonghaoxin <z00946994@china.huawei.com>
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 addresses several follow-up issues identified after the initial integration of MiniMax M3 MXFP8 support. The changes improve the robustness of quantization handling in normalization layers, extend the parallel reduction logic to support pre-quantized MXFP8 inputs, and fix a potential out-of-bounds memory access in the sparse attention kernel. These updates ensure better stability and compatibility for the Ascend-based vLLM implementation. Highlights
New Features🧠 You can now enable Memory (public preview) 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. 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 the 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 counterproductive. 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. Footnotes
|
|
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. Tip 💡 Consider Linking a Related Issue or RFCYour PR title contains the [BugFix] tag, indicating a bug fix or new feature. Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:
🙏 Thanks for helping us keep the project well-organized! |
There was a problem hiding this comment.
Code Review
Suggested PR Title:
[Ops][Feature] Support MXFP8 quantization in SequenceRowParallelOp and register matmul_and_reduce_mxfp8 custom opSuggested PR Summary:
### What this PR does / why we need it?
This PR introduces support for pre-quantized MXFP8 inputs in `SequenceRowParallelOp` by registering and routing to a new custom op `matmul_and_reduce_mxfp8`. It also fixes a potential out-of-bounds memory access in Triton kernels by clamping index calculations, handles missing `quant_description` in LayerNorm configurations, and adds corresponding unit tests.
Feedback: In `vllm_ascend/ops/register_custom_ops.py`, the fake implementation of `matmul_and_reduce_mxfp8` hardcodes `torch.bfloat16` as the output dtype, which can cause mismatches for other precisions like `float16`. It is recommended to use `self.params_dtype` instead.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Tested with new unit tests in `tests/ut/ops/test_layernorm.py` and `tests/ut/ops/test_linear.py`, as well as updates to end-to-end tests.| return torch.empty( | ||
| size=(num_tokens, self.output_size_per_partition), | ||
| device=quantized_input.device, | ||
| dtype=torch.bfloat16, |
There was a problem hiding this comment.
Hardcoding torch.bfloat16 as the output data type in the fake implementation can cause dtype mismatch errors or compilation failures when running models configured with other activation precisions (such as float16). To ensure compatibility and robustness across different model configurations, use self.params_dtype instead.
| dtype=torch.bfloat16, | |
| dtype=self.params_dtype, |
Signed-off-by: zonghaoxin <z00946994@china.huawei.com>
Signed-off-by: zonghaoxin <z00946994@china.huawei.com>
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
What this PR does
This PR carries the remaining follow-up fixes from
HaoxinZong/vllm-ascend:adapt-a5-sparse-attention-opsafter the main MiniMax M3 MXFP8 support was merged in #14412.quant_descriptionin RMSNormScope
This PR intentionally excludes the entire
sparse_attention_score_950adaptation and its Ascend 950 build selection, which are handled separately in #14642.Validation
full pre-commit suite passed locally except
gitleaks-offline-scanandshellcheck, which could not run because the local machine lacks their system binariesRuff, Codespell, Typos, Clang-format, Markdownlint, Actionlint, and repository-local policy hooks passed
Python AST parsing passed for all 7 changed files
pytest was not run locally because
torch,torch_npu, andvllmare unavailable in this environmentvLLM version: v0.27.1
vLLM main: vllm-project/vllm@58d3918