Skip to content

[Feat][310p] 310P support w8a8s quantization and saving w8a8sc state#6878

Merged
wangxiyuan merged 5 commits intovllm-project:mainfrom
pu-zhe:w8a8s
Mar 2, 2026
Merged

[Feat][310p] 310P support w8a8s quantization and saving w8a8sc state#6878
wangxiyuan merged 5 commits intovllm-project:mainfrom
pu-zhe:w8a8s

Conversation

@pu-zhe
Copy link
Contributor

@pu-zhe pu-zhe commented Feb 28, 2026

What this PR does / why we need it?

This pull request introduces significant enhancements for 310P device support, primarily by enabling W8A8S quantization and facilitating the saving of models with W8A8SC state outputs. It provides an example script for saving sharded and compressed model states, implements the core W8A8S quantization method, and integrates metadata generation within the 310P worker to accurately describe the quantization types of saved parameters. These changes aim to improve efficiency and compatibility for quantized models on 310P hardware.

Does this PR introduce any user-facing change?

No

How was this patch tested?

W8A8S accuarcy test and W8A8SC states save.
image

@github-actions
Copy link

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

@gemini-code-assist
Copy link
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 introduces significant enhancements for 310P device support, primarily by enabling W8A8S quantization and facilitating the saving of models with W8A8SC state outputs. It provides an example script for saving sharded and compressed model states, implements the core W8A8S quantization method, and integrates metadata generation within the 310P worker to accurately describe the quantization types of saved parameters. These changes aim to improve efficiency and compatibility for quantized models on 310P hardware.

Highlights

  • New Example Script for Sharded State Saving: A new example script, save_sharded_state.py, was added to facilitate saving sharded model checkpoints. This script supports sparse-compress-quantization (W8A8S) and includes logic to update the quantization description to W8A8SC after compression.
  • W8A8S Quantization for 310P: The AscendW8A8SLinearMethod310 quantization scheme has been implemented for 310P devices, defining the specific handling of W8A8S (8-bit weights, 8-bit activations, sparse) linear layers, including weight and parameter retrieval, and the apply operation.
  • Quantization Metadata Generation: The 310P worker now includes a method to generate a parameters_type_map.json file when saving sharded states. This file maps model parameter names to their corresponding quantization types, which is crucial for W8A8SC state outputs.
  • Unit Tests for W8A8S: Comprehensive unit tests were added for the AscendW8A8SLinearMethod310 to ensure the correct behavior of weight initialization, parameter handling, and the quantization application logic.

🧠 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
  • examples/save_sharded_state.py
    • Added a new script to save sharded model state, incorporating sparse-compress-quantization and updating quantization descriptions.
  • tests/ut/_310p/quantization/test_w8a8s_310.py
    • Added unit tests for the AscendW8A8SLinearMethod310 quantization scheme, verifying weight, parameter retrieval, and apply method functionality.
  • vllm_ascend/_310p/quantization/methods/init.py
    • Imported the newly added w8a8s quantization method.
  • vllm_ascend/_310p/quantization/methods/w8a8s.py
    • Implemented the AscendW8A8SLinearMethod310 class, defining the W8A8S sparse linear quantization scheme for 310P, including methods for weight, parameter handling, and the apply operation.
  • vllm_ascend/_310p/worker_310p.py
    • Added a save_sharded_state method to the Worker310P class to save sharded model states.
    • Implemented a _generate_quant_description method to create a JSON file mapping parameter names to their quantization types.
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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 introduces support for W8A8S quantization and W8A8SC state outputs for 310P devices. This includes a new script for saving sharded model states with compression, the implementation of the AscendW8A8SLinearMethod310 quantization scheme, and corresponding unit tests. My review has identified a critical race condition and an unsafe dictionary access in the new save_sharded_state.py script. Additionally, the new unit tests contain incorrect assertions that do not accurately reflect the implementation's behavior. I have provided specific code suggestions to address these high-severity issues.

@pu-zhe pu-zhe changed the title [Feat][310p] 310P support w8a8s quantization and w8a8sc state outputs [Feat][310p] 310P support w8a8s quantization and saving w8a8sc state Feb 28, 2026
Signed-off-by: pu-zhe <zpuaa@outlook.com>
pu-zhe added 2 commits March 2, 2026 16:21
Signed-off-by: pu-zhe <zpuaa@outlook.com>
Signed-off-by: pu-zhe <zpuaa@outlook.com>
pu-zhe added 2 commits March 2, 2026 18:13
Signed-off-by: pu-zhe <zpuaa@outlook.com>
@pu-zhe
Copy link
Contributor Author

pu-zhe commented Mar 2, 2026

@wangxiyuan Could you please help to check and merge this PR. CI passed.

@wangxiyuan wangxiyuan merged commit 5899438 into vllm-project:main Mar 2, 2026
25 checks passed
maoxx241 pushed a commit to maoxx241/vllm-ascend that referenced this pull request Mar 2, 2026
…llm-project#6878)

### What this PR does / why we need it?
This pull request introduces significant enhancements for 310P device
support, primarily by enabling W8A8S quantization and facilitating the
saving of models with W8A8SC state outputs. It provides an example
script for saving sharded and compressed model states, implements the
core W8A8S quantization method, and integrates metadata generation
within the 310P worker to accurately describe the quantization types of
saved parameters. These changes aim to improve efficiency and
compatibility for quantized models on 310P hardware.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
W8A8S accuarcy test and W8A8SC states save.
<img width="886" height="184" alt="image"
src="https://github.com/user-attachments/assets/e9bcac54-1f69-4d3a-a5b8-221a147ef99d"
/>

- vLLM version: v0.16.0
- vLLM main:
vllm-project/vllm@15d76f7

---------

Signed-off-by: pu-zhe <zpuaa@outlook.com>
Zhujiyang2 pushed a commit to Zhujiyang2/vllm-ascend that referenced this pull request Mar 3, 2026
…llm-project#6878)

### What this PR does / why we need it?
This pull request introduces significant enhancements for 310P device
support, primarily by enabling W8A8S quantization and facilitating the
saving of models with W8A8SC state outputs. It provides an example
script for saving sharded and compressed model states, implements the
core W8A8S quantization method, and integrates metadata generation
within the 310P worker to accurately describe the quantization types of
saved parameters. These changes aim to improve efficiency and
compatibility for quantized models on 310P hardware.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
W8A8S accuarcy test and W8A8SC states save.
<img width="886" height="184" alt="image"
src="https://github.com/user-attachments/assets/e9bcac54-1f69-4d3a-a5b8-221a147ef99d"
/>

- vLLM version: v0.16.0
- vLLM main:
vllm-project/vllm@15d76f7

---------

Signed-off-by: pu-zhe <zpuaa@outlook.com>
Signed-off-by: Zhu Jiyang <zhujiyang2@huawei.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.

2 participants