Skip to content

[BugFix][310p] Fixing the aclgraph error caused by blocktable - #8948

Merged
weijinqian0 merged 3 commits into
vllm-project:mainfrom
Tflowers-0129:507fixBlocktableAclgraph
May 20, 2026
Merged

weijinqian0 merged 3 commits into
vllm-project:mainfrom
Tflowers-0129:507fixBlocktableAclgraph

Conversation

@Tflowers-0129

@Tflowers-0129 Tflowers-0129 commented May 7, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it?

This PR fixes an ACL Graph error on Ascend 310P devices by moving the block table's slot mapping computation to the CPU. On 310P, certain device-side arithmetic operations used in the default slot mapping computation are unsupported or cause errors during graph execution.

Key changes:

  • Overrode BlockTable for 310P to use NumPy for slot mapping computation.
  • Updated NPUModelRunner to perform this computation on the CPU early in the input preparation phase.
  • Avoided unsupported device-side additions for positions and seq_lens on 310P by using CPU buffers.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Verified on Ascend 310P hardware with vLLM v0.19.1.

@Tflowers-0129
Tflowers-0129 requested a review from MengqingCao as a code owner May 7, 2026 09:24
@github-actions

github-actions Bot commented May 7, 2026

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.

@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 an aclgraph error related to block table operations on 310P hardware. By shifting specific metadata computations, such as slot mapping and sequence length updates, from the NPU to the CPU, the changes bypass unsupported device-side arithmetic operations. The update ensures compatibility with 310P constraints while maintaining existing functionality for other configurations like PCP.

Highlights

  • 310P Metadata Handling: Implemented CPU-based metadata computation for 310P to avoid unsupported NPU device arithmetic operations.
  • Slot Mapping Logic: Refactored slot mapping to support CPU-side computation and added strict validation to prevent device tensor inputs.
  • Model Runner Integration: Updated model runner input preparation to integrate 310P-specific logic alongside existing PCP workflows.
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

This pull request addresses ACL Graph errors on Ascend 310P devices by moving slot mapping computations and metadata updates (positions and sequence lengths) from the NPU to the CPU. It introduces a specialized BlockTable for 310P that utilizes NumPy and updates NPUModelRunner to use CPU buffers, thereby avoiding unsupported device-side arithmetic operations. Feedback includes a request to restore removed type hints for maintainability and a concern regarding a potential device-side addition for seq_lens during async speculative decoding that might still trigger errors on 310P hardware.

Suggested PR Title:

[310p][Worker][BugFix] Fixing the aclgraph error caused by blocktable

Suggested PR Summary:

### What this PR does / why we need it?
This PR fixes an ACL Graph error on Ascend 310P devices by moving the block table's slot mapping computation to the CPU. On 310P, certain device-side arithmetic operations used in the default slot mapping computation are unsupported or cause errors during graph execution. 

Key changes:
- Overrode `BlockTable` for 310P to use NumPy for slot mapping computation.
- Updated `NPUModelRunner` to perform this computation on the CPU early in the input preparation phase.
- Avoided unsupported device-side additions for `positions` and `seq_lens` on 310P by using CPU buffers.

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

### How was this patch tested?
Verified on Ascend 310P hardware with vLLM v0.19.1.

self.slot_mapping.copy_to_gpu(num_tokens)

def _get_block_table_indices(self, req_indices: np.ndarray, logical_block_idx: np.ndarray) -> np.ndarray:
def _get_block_table_indices(self, req_indices, logical_block_idx):

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

Suggested PR Title:

[310p][Worker][BugFix] Fixing the aclgraph error caused by blocktable

Suggested PR Summary:

### What this PR does / why we need it?
This PR fixes an ACL Graph error on Ascend 310P devices by moving the block table's slot mapping computation to the CPU. On 310P, certain device-side arithmetic operations used in the default slot mapping computation are unsupported or cause errors during graph execution. 

Key changes:
- Overrode `BlockTable` for 310P to use NumPy for slot mapping computation.
- Updated `NPUModelRunner` to perform this computation on the CPU early in the input preparation phase.
- Avoided unsupported device-side additions for `positions` and `seq_lens` on 310P by using CPU buffers.

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

### How was this patch tested?
Verified on Ascend 310P hardware with vLLM v0.19.1.

Review Comment:

The type hints for req_indices and logical_block_idx were removed in this version. This is a regression in code maintainability and consistency with the rest of the file (e.g., _compute_slot_mapping_numpy at line 16). Please restore the type hints to ensure clarity and better IDE support.

Suggested change
def _get_block_table_indices(self, req_indices, logical_block_idx):
def _get_block_table_indices(self, req_indices: np.ndarray, logical_block_idx: np.ndarray) -> np.ndarray:
References
  1. Maintain consistent type hinting for code clarity and maintainability. (link)

Comment thread vllm_ascend/worker/model_runner_v1.py Outdated
@Tflowers-0129 Tflowers-0129 changed the title [Bugfix][310p] Fixing the aclgraph error caused by blocktable. [BugFix][310p] Fixing the aclgraph error caused by blocktable May 12, 2026
@Tflowers-0129
Tflowers-0129 force-pushed the 507fixBlocktableAclgraph branch 3 times, most recently from 02d11b4 to 6e553c7 Compare May 18, 2026 12:33
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
@Tflowers-0129
Tflowers-0129 force-pushed the 507fixBlocktableAclgraph branch from 7c7edb7 to af4042e Compare May 19, 2026 12:47
@Tflowers-0129
Tflowers-0129 requested a review from wangxiyuan as a code owner May 19, 2026 12:47
@weijinqian0
weijinqian0 merged commit 4ba23cc into vllm-project:main May 20, 2026
173 of 178 checks passed
panther-zhu pushed a commit to panther-zhu/vllm-ascend that referenced this pull request May 20, 2026
…roject#8948)

### What this PR does / why we need it?
This PR fixes an ACL Graph error on Ascend 310P devices by moving the
block table's slot mapping computation to the CPU. On 310P, certain
device-side arithmetic operations used in the default slot mapping
computation are unsupported or cause errors during graph execution.

Key changes:
- Overrode `BlockTable` for 310P to use NumPy for slot mapping
computation.
- Updated `NPUModelRunner` to perform this computation on the CPU early
in the input preparation phase.
- Avoided unsupported device-side additions for `positions` and
`seq_lens` on 310P by using CPU buffers.

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

### How was this patch tested?
Verified on Ascend 310P hardware with vLLM v0.19.1.
- vLLM version: v0.19.1
- vLLM main:
vllm-project/vllm@d886c26

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
panther-zhu pushed a commit to panther-zhu/vllm-ascend that referenced this pull request May 20, 2026
…roject#8948)

### What this PR does / why we need it?
This PR fixes an ACL Graph error on Ascend 310P devices by moving the
block table's slot mapping computation to the CPU. On 310P, certain
device-side arithmetic operations used in the default slot mapping
computation are unsupported or cause errors during graph execution.

Key changes:
- Overrode `BlockTable` for 310P to use NumPy for slot mapping
computation.
- Updated `NPUModelRunner` to perform this computation on the CPU early
in the input preparation phase.
- Avoided unsupported device-side additions for `positions` and
`seq_lens` on 310P by using CPU buffers.

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

### How was this patch tested?
Verified on Ascend 310P hardware with vLLM v0.19.1.
- vLLM version: v0.19.1
- vLLM main:
vllm-project/vllm@d886c26

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
LostFox11 pushed a commit to LostFox11/vllm-ascend that referenced this pull request Jun 15, 2026
…roject#8948)

### What this PR does / why we need it?
This PR fixes an ACL Graph error on Ascend 310P devices by moving the
block table's slot mapping computation to the CPU. On 310P, certain
device-side arithmetic operations used in the default slot mapping
computation are unsupported or cause errors during graph execution.

Key changes:
- Overrode `BlockTable` for 310P to use NumPy for slot mapping
computation.
- Updated `NPUModelRunner` to perform this computation on the CPU early
in the input preparation phase.
- Avoided unsupported device-side additions for `positions` and
`seq_lens` on 310P by using CPU buffers.

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

### How was this patch tested?
Verified on Ascend 310P hardware with vLLM v0.19.1.
- vLLM version: v0.19.1
- vLLM main:
vllm-project/vllm@d886c26

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
LostFox11 pushed a commit to LostFox11/vllm-ascend that referenced this pull request Jun 15, 2026
…roject#8948)

### What this PR does / why we need it?
This PR fixes an ACL Graph error on Ascend 310P devices by moving the
block table's slot mapping computation to the CPU. On 310P, certain
device-side arithmetic operations used in the default slot mapping
computation are unsupported or cause errors during graph execution.

Key changes:
- Overrode `BlockTable` for 310P to use NumPy for slot mapping
computation.
- Updated `NPUModelRunner` to perform this computation on the CPU early
in the input preparation phase.
- Avoided unsupported device-side additions for `positions` and
`seq_lens` on 310P by using CPU buffers.

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

### How was this patch tested?
Verified on Ascend 310P hardware with vLLM v0.19.1.
- vLLM version: v0.19.1
- vLLM main:
vllm-project/vllm@d886c26

---------

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

### What this PR does / why we need it?
This PR fixes an ACL Graph error on Ascend 310P devices by moving the
block table's slot mapping computation to the CPU. On 310P, certain
device-side arithmetic operations used in the default slot mapping
computation are unsupported or cause errors during graph execution.

Key changes:
- Overrode `BlockTable` for 310P to use NumPy for slot mapping
computation.
- Updated `NPUModelRunner` to perform this computation on the CPU early
in the input preparation phase.
- Avoided unsupported device-side additions for `positions` and
`seq_lens` on 310P by using CPU buffers.

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

### How was this patch tested?
Verified on Ascend 310P hardware with vLLM v0.19.1.
- vLLM version: v0.19.1
- vLLM main:
vllm-project/vllm@d886c26

---------

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
…roject#8948)

### What this PR does / why we need it?
This PR fixes an ACL Graph error on Ascend 310P devices by moving the
block table's slot mapping computation to the CPU. On 310P, certain
device-side arithmetic operations used in the default slot mapping
computation are unsupported or cause errors during graph execution.

Key changes:
- Overrode `BlockTable` for 310P to use NumPy for slot mapping
computation.
- Updated `NPUModelRunner` to perform this computation on the CPU early
in the input preparation phase.
- Avoided unsupported device-side additions for `positions` and
`seq_lens` on 310P by using CPU buffers.

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

### How was this patch tested?
Verified on Ascend 310P hardware with vLLM v0.19.1.
- vLLM version: v0.19.1
- vLLM main:
vllm-project/vllm@d886c26

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
pisceskkk pushed a commit to pisceskkk/vllm-ascend that referenced this pull request Jun 29, 2026
…roject#8948)

### What this PR does / why we need it?
This PR fixes an ACL Graph error on Ascend 310P devices by moving the
block table's slot mapping computation to the CPU. On 310P, certain
device-side arithmetic operations used in the default slot mapping
computation are unsupported or cause errors during graph execution.

Key changes:
- Overrode `BlockTable` for 310P to use NumPy for slot mapping
computation.
- Updated `NPUModelRunner` to perform this computation on the CPU early
in the input preparation phase.
- Avoided unsupported device-side additions for `positions` and
`seq_lens` on 310P by using CPU buffers.

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

### How was this patch tested?
Verified on Ascend 310P hardware with vLLM v0.19.1.
- vLLM version: v0.19.1
- vLLM main:
vllm-project/vllm@d886c26

---------

Signed-off-by: Tflowers-0129 <2906339855@qq.com>
shiqiangA pushed a commit to shiqiangA/vllm-ascend that referenced this pull request Aug 20, 2026
…roject#8948)

### What this PR does / why we need it?
This PR fixes an ACL Graph error on Ascend 310P devices by moving the
block table's slot mapping computation to the CPU. On 310P, certain
device-side arithmetic operations used in the default slot mapping
computation are unsupported or cause errors during graph execution.

Key changes:
- Overrode `BlockTable` for 310P to use NumPy for slot mapping
computation.
- Updated `NPUModelRunner` to perform this computation on the CPU early
in the input preparation phase.
- Avoided unsupported device-side additions for `positions` and
`seq_lens` on 310P by using CPU buffers.

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

### How was this patch tested?
Verified on Ascend 310P hardware with vLLM v0.19.1.
- vLLM version: v0.19.1
- vLLM main:
vllm-project/vllm@d886c26

---------

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants