Skip to content

[Bugfix][950][MXFP] defer NZ conversion to fused preprocess for MLA bakcend with MLAPO - #16868

Closed
linfeng-yuan wants to merge 1 commit into
vllm-project:mainfrom
linfeng-yuan:bugfix/nightly-a5-mla-mxfp8-nz
Closed

linfeng-yuan wants to merge 1 commit into
vllm-project:mainfrom
linfeng-yuan:bugfix/nightly-a5-mla-mxfp8-nz

Conversation

@linfeng-yuan

@linfeng-yuan linfeng-yuan commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it?

Does this PR introduce any user-facing change?

How was this patch tested?

Signed-off-by: linfeng-yuan <1102311262@qq.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 refines how layers are marked for fused preprocessing in the MLA backend. By decoupling the management logic from the existence of an explicit type resolver, the system now correctly handles dense MLA scenarios where MLAPO or FA quantization is active, ensuring that NZ conversion is properly deferred.

Highlights

  • Logic Update for Fused Preprocess Management: Updated the logic for marking layers as '_fused_preprocess_managed' to support cases where MLAPO or FA quantization is enabled, even when an explicit type resolver is absent.
  • Test Suite Expansion: Refactored the unit tests in 'test_mla.py' to cover multiple scenarios, including various combinations of type resolvers, MLAPO status, and FA quantization layers.
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. ↩

@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 SFA or MLA fused preprocess in MLA attention

Suggested PR Summary:

### What this PR does / why we need it?
This pull request updates the MLA attention initialization logic to handle cases where `_fused_preprocess_type` is not explicitly defined on the attention implementation. In such cases, it falls back to checking if `enable_mlapo` or `fa_quant_layer` is enabled to determine if fused preprocessing is managed. Unit tests in `tests/ut/ops/test_mla.py` have been updated to cover these new conditions.

Feedback has been provided to use `getattr` when accessing attributes on `impl` to avoid potential `AttributeError`s if a different attention backend is used.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
The changes were tested using the updated unit tests in `tests/ut/ops/test_mla.py`.

Comment thread vllm_ascend/ops/mla.py
Comment on lines +228 to 231
else:
fused_preprocess_managed = impl.enable_mlapo or impl.fa_quant_layer
if fused_preprocess_managed:
for _layer in (impl.fused_qkv_a_proj, impl.q_proj):

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

Accessing attributes like 'enable_mlapo', 'fa_quant_layer', 'fused_qkv_a_proj', and 'q_proj' directly on 'impl' can raise an AttributeError if a different attention backend implementation is used. Using 'getattr' with a default value is safer and more robust.

Suggested change
else:
fused_preprocess_managed = impl.enable_mlapo or impl.fa_quant_layer
if fused_preprocess_managed:
for _layer in (impl.fused_qkv_a_proj, impl.q_proj):
else:
fused_preprocess_managed = getattr(impl, "enable_mlapo", False) or getattr(impl, "fa_quant_layer", False)
if fused_preprocess_managed:
for _layer in (getattr(impl, "fused_qkv_a_proj", None), getattr(impl, "q_proj", None)):

@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!

@linfeng-yuan

linfeng-yuan commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

/nightly DeepSeek_V31_W4A4C8_A5,DeepSeek_V31_Terminus_w4a8_w8a8_A5
nightly command triggered.

@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