Skip to content

[BugFix][MiniMax M3] Fix MXFP8 RMSNorm, row-parallel reduce, and sparse index bounds - #14704

Open
HaoxinZong wants to merge 3 commits into
vllm-project:mainfrom
HaoxinZong:fix-minimax-m3-a5-followups-main
Open

[BugFix][MiniMax M3] Fix MXFP8 RMSNorm, row-parallel reduce, and sparse index bounds#14704
HaoxinZong wants to merge 3 commits into
vllm-project:mainfrom
HaoxinZong:fix-minimax-m3-a5-followups-main

Conversation

@HaoxinZong

@HaoxinZong HaoxinZong commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

What this PR does

This PR carries the remaining follow-up fixes from HaoxinZong/vllm-ascend:adapt-a5-sparse-attention-ops after the main MiniMax M3 MXFP8 support was merged in #14412.

  • tolerate quantization configs without quant_description in RMSNorm
  • support pre-quantized MXFP8 tuple inputs in sequence row-parallel reduction
  • clamp the MiniMax M3 zero-prefix index score range to avoid negative block access
  • add focused unit/E2E coverage for these cases

Scope

This PR intentionally excludes the entire sparse_attention_score_950 adaptation and its Ascend 950 build selection, which are handled separately in #14642.

Validation

  • full pre-commit suite passed locally except gitleaks-offline-scan and shellcheck, which could not run because the local machine lacks their system binaries

  • Ruff, 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, and vllm are unavailable in this environment

  • vLLM version: v0.27.1

  • vLLM main: vllm-project/vllm@58d3918

Support MXFP8 RMSNorm configuration and row-parallel reduction, and clamp zero-prefix sparse index ranges.

Signed-off-by: zonghaoxin <z00946994@china.huawei.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • RMSNorm Quantization Robustness: Updated RMSNorm to gracefully handle quantization configurations that lack a 'quant_description' field.
  • MXFP8 Support: Enabled support for pre-quantized MXFP8 tuple inputs in sequence row-parallel reduction operations, including custom operator registration.
  • Bug Fixes: Clamped the MiniMax M3 zero-prefix index score range to prevent negative block access errors.
  • Testing: Added targeted unit and E2E test coverage for the new quantization and parallel reduction scenarios.
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 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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. 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.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.


Tip

💡 Consider Linking a Related Issue or RFC

Your 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:

  • Fixes #<issue_number>
  • Closes #<issue_number>
  • Resolves #<issue_number>
  • Refs #<rfc_or_issue_number> (for RFCs)

🙏 Thanks for helping us keep the project well-organized!

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Suggested PR Title:

[Ops][Feature] Support MXFP8 quantization in SequenceRowParallelOp and register matmul_and_reduce_mxfp8 custom op

Suggested 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.

Comment thread vllm_ascend/ops/register_custom_ops.py Outdated
return torch.empty(
size=(num_tokens, self.output_size_per_partition),
device=quantized_input.device,
dtype=torch.bfloat16,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
dtype=torch.bfloat16,
dtype=self.params_dtype,

@HaoxinZong HaoxinZong changed the title [BugFix][MiniMax M3] Handle MXFP8 follow-up issues [BugFix][MiniMax M3] Fix MXFP8 RMSNorm, row-parallel reduce, and sparse index bounds Aug 21, 2026
@HaoxinZong
HaoxinZong marked this pull request as ready for review August 21, 2026 04:02
zonghaoxin added 2 commits August 21, 2026 16:33
Signed-off-by: zonghaoxin <z00946994@china.huawei.com>
Signed-off-by: zonghaoxin <z00946994@china.huawei.com>
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant