Skip to content

[Feat.][310P]: weightNZ feature with quant or unquant. - #6705

Merged
wangxiyuan merged 8 commits into
vllm-project:mainfrom
Tflowers-0129:weightNZ
Feb 13, 2026
Merged

wangxiyuan merged 8 commits into
vllm-project:mainfrom
Tflowers-0129:weightNZ

Conversation

@Tflowers-0129

@Tflowers-0129 Tflowers-0129 commented Feb 11, 2026 •

Copy link
Copy Markdown
Collaborator

NZ Format Support for Linear Layers: Implemented support for the NZ (N-dimensional Z-order) format for linear layer weights on Ascend 310P, enhancing performance for both quantized and unquantized layers.
Unquantized Linear Method for Ascend 310P: Introduced AscendUnquantizedLinearMethod310 to specifically handle and apply NZ format casting to unquantized linear layer weights during the loading process.
MRotaryEmbedding Integration: Extended Rotary Embedding support by adding AscendMRotaryEmbedding310 to provide an Ascend-specific implementation for MRotaryEmbedding.
Quantization Method Updates: Updated the w8a8_static quantization method to directly transpose weights and apply NZ format casting, ensuring consistency with the new format.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Tflowers-0129, 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 introduces significant optimizations for linear layer operations on Ascend 310P by enabling the use of the NZ (N-dimensional Z-order) tensor format for weights. This change aims to improve computational efficiency for both quantized and unquantized linear layers by optimizing memory access patterns. Additionally, it expands the compatibility of Rotary Embedding by integrating support for MRotaryEmbedding within the Ascend 310P framework, further enhancing model performance and feature parity.

Highlights

  • NZ Format Support for Linear Layers: Implemented support for the NZ (N-dimensional Z-order) format for linear layer weights on Ascend 310P, enhancing performance for both quantized and unquantized layers.
  • Unquantized Linear Method for Ascend 310P: Introduced AscendUnquantizedLinearMethod310 to specifically handle and apply NZ format casting to unquantized linear layer weights during the loading process.
  • MRotaryEmbedding Integration: Extended Rotary Embedding support by adding AscendMRotaryEmbedding310 to provide an Ascend-specific implementation for MRotaryEmbedding.
  • Quantization Method Updates: Updated the w8a8_static quantization method to directly transpose weights and apply NZ format casting, ensuring consistency with the new format.

🧠 New Feature in Public Preview: You can now enable Memory 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.

Changelog
  • tests/ut/_310p/quantization/test_w8a8_static_310.py
    • Updated npu_quant_matmul mock assertions to explicitly verify positional and keyword arguments.
    • Added a new test case to confirm that npu_format_cast is invoked during the weight processing phase for NZ format.
  • vllm_ascend/_310p/ops/linear.py
    • Added AscendUnquantizedLinearMethod310 to apply NZ format casting to unquantized linear layer weights.
    • Introduced AscendLinearBase310 to integrate the new unquantized linear method into the Ascend 310P operations.
  • vllm_ascend/_310p/ops/rotary_embedding.py
    • Imported MRotaryEmbedding from vllm.model_executor.layers.rotary_embedding.
    • Added AscendMRotaryEmbedding310 to provide an Ascend-specific implementation for MRotaryEmbedding.
  • vllm_ascend/_310p/quantization/methods/w8a8_static.py
    • Modified the apply method to transpose layer.weight.data before passing it to torch_npu.npu_quant_matmul.
    • Updated process_weights_after_loading to apply torch_npu.npu_format_cast for NZ format to layer.weight.data.
  • vllm_ascend/_310p/quantization/modelslim_config.py
    • Updated the get_quant_method function to utilize the newly introduced AscendUnquantizedLinearMethod310 for skipped linear layers.
  • vllm_ascend/utils.py
    • Imported AscendMRotaryEmbedding310.
    • Registered AscendMRotaryEmbedding310 in the REGISTERED_ASCEND_OPS dictionary for Ascend 310P operations.
Activity
  • No specific activity (comments, reviews, progress) has been recorded for this pull request yet.
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 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 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

  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

This pull request introduces support for the weightNZ format on the 310P platform for both quantized and unquantized weights. The changes are generally in the right direction, but I've identified two significant issues. First, there's a critical performance regression in AscendMRotaryEmbedding310 where an optimized NPU kernel is bypassed. Second, there's an inefficiency in the w8a8_static quantization method due to transposing the weight tensor on every forward pass. I've provided detailed feedback and suggestions to address these points.

Comment thread vllm_ascend/_310p/ops/rotary_embedding.py Outdated
@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.

Comment thread vllm_ascend/_310p/quantization/modelslim_config.py
Comment thread vllm_ascend/_310p/ops/linear.py
Comment thread vllm_ascend/_310p/ops/linear.py Outdated
Comment thread vllm_ascend/_310p/ops/linear.py Outdated
Comment thread vllm_ascend/_310p/ops/rotary_embedding.py Outdated
Comment thread vllm_ascend/_310p/quantization/methods/w8a8_static.py Outdated
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
@wangxiyuan
wangxiyuan merged commit b6bc3d2 into vllm-project:main Feb 13, 2026
25 checks passed
845473182 pushed a commit to 845473182/vllm-ascend that referenced this pull request Feb 24, 2026
…ascend into qwen3next_rebase

* 'qwen3next_rebase' of https://github.com/845473182/vllm-ascend:
  [Bugfix][DispatchFFNCombine] resolve vec error caused by unaligned UB access (vllm-project#6707)
  [Lint] Adapt lint tools for windows (vllm-project#6727)
  [main][Docs] Fix typos across documentation (vllm-project#6728)
  [Feat.][310P]: weightNZ feature with quant or unquant. (vllm-project#6705)
  [Feat.][310P] addrmsnorm for 300I DUO (vllm-project#6704)
  [Graph][Fusion] Integrating inductor pass and npugraph ex pass (vllm-project#6354)
  [bugfix] adapt bugfix for norm_quant_fusion_pass to npugraph_ex (vllm-project#6726)
  [doc] add A2 series doc for GLM5.md (vllm-project#6717)
@wangxiyuan wangxiyuan mentioned this pull request Feb 24, 2026
HF-001 pushed a commit to HF-001/vllm-ascend that referenced this pull request Feb 25, 2026
…6705)

NZ Format Support for Linear Layers: Implemented support for the NZ
(N-dimensional Z-order) format for linear layer weights on Ascend 310P,
enhancing performance for both quantized and unquantized layers.
Unquantized Linear Method for Ascend 310P: Introduced
AscendUnquantizedLinearMethod310 to specifically handle and apply NZ
format casting to unquantized linear layer weights during the loading
process.
MRotaryEmbedding Integration: Extended Rotary Embedding support by
adding AscendMRotaryEmbedding310 to provide an Ascend-specific
implementation for MRotaryEmbedding.
Quantization Method Updates: Updated the w8a8_static quantization method
to directly transpose weights and apply NZ format casting, ensuring
consistency with the new format.
- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@9562912

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
banxiaduhuo pushed a commit to banxiaduhuo/vllm-ascend that referenced this pull request Feb 26, 2026
…6705)

NZ Format Support for Linear Layers: Implemented support for the NZ
(N-dimensional Z-order) format for linear layer weights on Ascend 310P,
enhancing performance for both quantized and unquantized layers.
Unquantized Linear Method for Ascend 310P: Introduced
AscendUnquantizedLinearMethod310 to specifically handle and apply NZ
format casting to unquantized linear layer weights during the loading
process.
MRotaryEmbedding Integration: Extended Rotary Embedding support by
adding AscendMRotaryEmbedding310 to provide an Ascend-specific
implementation for MRotaryEmbedding.
Quantization Method Updates: Updated the w8a8_static quantization method
to directly transpose weights and apply NZ format casting, ensuring
consistency with the new format.
- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@9562912

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
maoxx241 pushed a commit to maoxx241/vllm-ascend that referenced this pull request Mar 2, 2026
…6705)

NZ Format Support for Linear Layers: Implemented support for the NZ
(N-dimensional Z-order) format for linear layer weights on Ascend 310P,
enhancing performance for both quantized and unquantized layers.
Unquantized Linear Method for Ascend 310P: Introduced
AscendUnquantizedLinearMethod310 to specifically handle and apply NZ
format casting to unquantized linear layer weights during the loading
process.
MRotaryEmbedding Integration: Extended Rotary Embedding support by
adding AscendMRotaryEmbedding310 to provide an Ascend-specific
implementation for MRotaryEmbedding.
Quantization Method Updates: Updated the w8a8_static quantization method
to directly transpose weights and apply NZ format casting, ensuring
consistency with the new format.
- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@9562912

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
LCAIZJ pushed a commit to LCAIZJ/vllm-ascend that referenced this pull request Mar 7, 2026
…6705)

NZ Format Support for Linear Layers: Implemented support for the NZ
(N-dimensional Z-order) format for linear layer weights on Ascend 310P,
enhancing performance for both quantized and unquantized layers.
Unquantized Linear Method for Ascend 310P: Introduced
AscendUnquantizedLinearMethod310 to specifically handle and apply NZ
format casting to unquantized linear layer weights during the loading
process.
MRotaryEmbedding Integration: Extended Rotary Embedding support by
adding AscendMRotaryEmbedding310 to provide an Ascend-specific
implementation for MRotaryEmbedding.
Quantization Method Updates: Updated the w8a8_static quantization method
to directly transpose weights and apply NZ format casting, ensuring
consistency with the new format.
- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@9562912

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
yangzhe-2026 pushed a commit to yangzhe-2026/vllm-ascend that referenced this pull request May 6, 2026
…6705)

NZ Format Support for Linear Layers: Implemented support for the NZ
(N-dimensional Z-order) format for linear layer weights on Ascend 310P,
enhancing performance for both quantized and unquantized layers.
Unquantized Linear Method for Ascend 310P: Introduced
AscendUnquantizedLinearMethod310 to specifically handle and apply NZ
format casting to unquantized linear layer weights during the loading
process.
MRotaryEmbedding Integration: Extended Rotary Embedding support by
adding AscendMRotaryEmbedding310 to provide an Ascend-specific
implementation for MRotaryEmbedding.
Quantization Method Updates: Updated the w8a8_static quantization method
to directly transpose weights and apply NZ format casting, ensuring
consistency with the new format.
- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@9562912

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
nanxingMy pushed a commit to nanxingMy/vllm-ascend that referenced this pull request May 15, 2026
…6705)

NZ Format Support for Linear Layers: Implemented support for the NZ
(N-dimensional Z-order) format for linear layer weights on Ascend 310P,
enhancing performance for both quantized and unquantized layers.
Unquantized Linear Method for Ascend 310P: Introduced
AscendUnquantizedLinearMethod310 to specifically handle and apply NZ
format casting to unquantized linear layer weights during the loading
process.
MRotaryEmbedding Integration: Extended Rotary Embedding support by
adding AscendMRotaryEmbedding310 to provide an Ascend-specific
implementation for MRotaryEmbedding.
Quantization Method Updates: Updated the w8a8_static quantization method
to directly transpose weights and apply NZ format casting, ensuring
consistency with the new format.
- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@9562912

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
Signed-off-by: nanxing <1014662416@qq.com>
ader47 pushed a commit to ader47/vllm-ascend that referenced this pull request Jun 18, 2026
…6705)

NZ Format Support for Linear Layers: Implemented support for the NZ
(N-dimensional Z-order) format for linear layer weights on Ascend 310P,
enhancing performance for both quantized and unquantized layers.
Unquantized Linear Method for Ascend 310P: Introduced
AscendUnquantizedLinearMethod310 to specifically handle and apply NZ
format casting to unquantized linear layer weights during the loading
process.
MRotaryEmbedding Integration: Extended Rotary Embedding support by
adding AscendMRotaryEmbedding310 to provide an Ascend-specific
implementation for MRotaryEmbedding.
Quantization Method Updates: Updated the w8a8_static quantization method
to directly transpose weights and apply NZ format casting, ensuring
consistency with the new format.
- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@9562912

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
CXY-Katrina pushed a commit to CXY-Katrina/vllm-ascend that referenced this pull request Jun 27, 2026
…6705)

NZ Format Support for Linear Layers: Implemented support for the NZ
(N-dimensional Z-order) format for linear layer weights on Ascend 310P,
enhancing performance for both quantized and unquantized layers.
Unquantized Linear Method for Ascend 310P: Introduced
AscendUnquantizedLinearMethod310 to specifically handle and apply NZ
format casting to unquantized linear layer weights during the loading
process.
MRotaryEmbedding Integration: Extended Rotary Embedding support by
adding AscendMRotaryEmbedding310 to provide an Ascend-specific
implementation for MRotaryEmbedding.
Quantization Method Updates: Updated the w8a8_static quantization method
to directly transpose weights and apply NZ format casting, ensuring
consistency with the new format.
- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@9562912

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
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.

4 participants