[BugFix][310p] Fixing the aclgraph error caused by blocktable - #8948
Conversation
|
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. |
Summary of ChangesHello, 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
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 AssistThe 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
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 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
|
There was a problem hiding this comment.
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 blocktableSuggested 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): |
There was a problem hiding this comment.
Suggested PR Title:
[310p][Worker][BugFix] Fixing the aclgraph error caused by blocktableSuggested 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.
| 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
- Maintain consistent type hinting for code clarity and maintainability. (link)
02d11b4 to
6e553c7
Compare
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
Signed-off-by: Tflowers-0129 <2906339855@qq.com>
7c7edb7 to
af4042e
Compare
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
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:
BlockTablefor 310P to use NumPy for slot mapping computation.NPUModelRunnerto perform this computation on the CPU early in the input preparation phase.positionsandseq_lenson 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.