Conversation
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 primarily focuses on maintaining compatibility and updating documentation. It adjusts the initialization of certain token-related arrays in the NPU input batch worker to accommodate different vLLM versions, specifically handling changes introduced after version 0.18.0. Additionally, it updates the versioning policy documentation to reflect the latest compatible vLLM commit for the main branch. Highlights
🧠 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. Ignored Files
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 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 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. Footnotes
|
|
👋 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. |
There was a problem hiding this comment.
Code Review
This pull request updates the compatible vLLM commit hash and introduces version-specific logic in NPUInputBatch to maintain compatibility with vLLM versions beyond v0.18.0. The change correctly adapts tensor initializations based on the vLLM version. However, the new code block introduces some duplication which could be refactored for better maintainability. Additionally, the pull request title and description do not conform to the repository's style guide. I have provided suggestions for both below.
Suggested PR Title:
[main][Worker][Compat] Add compatibility for vLLM versions beyond v0.18.0Suggested PR Summary:
### What this PR does / why we need it?
This PR updates the compatible vLLM commit hash in the versioning policy documentation. It also modifies `NPUInputBatch` to handle differences in tensor initialization between vLLM v0.18.0 and later versions. Specifically, for versions other than v0.18.0, `num_tokens_no_spec` and `num_prompt_tokens` are now backed by pinned memory tensors to align with upstream changes, ensuring continued compatibility.
### Does this PR introduce _any_ user-facing change?
No, this is an internal refactoring to maintain compatibility with different versions of vLLM and does not introduce any user-facing changes.
### How was this patch tested?
CI should pass with existing tests.| self.num_tokens_no_spec_cpu_tensor = torch.zeros( | ||
| (max_num_reqs,), | ||
| device="cpu", | ||
| dtype=torch.int32, | ||
| pin_memory=pin_memory, | ||
| ) | ||
| self.num_tokens_no_spec = self.num_tokens_no_spec_cpu_tensor.numpy() | ||
| self.num_prompt_tokens_cpu_tensor = torch.zeros( | ||
| (max_num_reqs,), | ||
| device="cpu", | ||
| dtype=torch.int32, | ||
| pin_memory=pin_memory, | ||
| ) | ||
| self.num_prompt_tokens = self.num_prompt_tokens_cpu_tensor.numpy() |
There was a problem hiding this comment.
The initialization logic for num_tokens_no_spec_cpu_tensor and num_prompt_tokens_cpu_tensor is duplicated. This reduces maintainability, as any future changes to the tensor creation would need to be applied in two places, increasing the risk of errors. Please refactor this to remove the duplication by extracting the common arguments.
tensor_args = dict(device="cpu", dtype=torch.int32, pin_memory=pin_memory)
self.num_tokens_no_spec_cpu_tensor = torch.zeros((max_num_reqs,), **tensor_args)
self.num_tokens_no_spec = self.num_tokens_no_spec_cpu_tensor.numpy()
self.num_prompt_tokens_cpu_tensor = torch.zeros((max_num_reqs,), **tensor_args)
self.num_prompt_tokens = self.num_prompt_tokens_cpu_tensor.numpy()9221c96 to
ad6e516
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
241735d to
4069731
Compare
4069731 to
a17cd11
Compare
a17cd11 to
52441d4
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
cd0cd5c to
cbbb9a3
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
0436fbc to
355d0c6
Compare
Signed-off-by: 22dimensions <waitingwind@foxmail.com>
Upstream vLLM has removed the vllm_is_batch_invariant() function from batch_invariant.py and now uses envs.VLLM_BATCH_INVARIANT directly. Create a compatibility wrapper in vllm_ascend/batch_invariant.py that checks envs.VLLM_BATCH_INVARIANT and update all imports across the codebase to use the local implementation instead of trying to import from vllm. Changes: - Add vllm_is_batch_invariant() function to vllm_ascend/batch_invariant.py - Update imports in ascend_config.py, sample/sampler.py, and utils.py Fixes: ImportError when running multicard tests Co-Authored-By: Claude Code <noreply@anthropic.com>
caused by: vllm-project/vllm#32951 1. AscendEagleProposer missing runner attribute: Added self.runner assignment right after parent __init__ to ensure availability - Affected 32 test cases (spec_decode tests) 2. Tensor.gpu deprecated API: Added _get_device_tensor() compatibility wrapper to handle both CpuGpuBuffer and direct Tensor objects - Affected 5 test cases 3. PrefillNoCache mode doesn't need to read from key_cache, only write to it. Skip key_cache initialization requirement for PrefillNoCache mode. 4. For plain GPU tensors, fill the tensor directly instead of calling .cpu() which creates a separate CPU copy that won't affect the GPU tensor. 5. Fixed unprotected buffer property accesses that could cause garbage output: - Line 919: query_start_loc.gpu access for logits_indices calculation - Line 1071: input_ids.gpu access for draft token computation - Lines 1147-1149: pcp_manager buffer access - Lines 1171, 1207: input_ids.gpu slicing for target tokens - Line 1399: query_start_loc.np assignment - Lines 859-862: mrope_positions gpu/cpu access 6. These were causing non-deterministic/garbage output during generation. 7. Fix unprotected access to xdrope_positions.gpu for plain tensor compatibility. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…or and kv_offload import Signed-off-by: leo-pony <nengjunma@outlook.com>
Root causes of main2main CI failures: - NPUModelRunner missing query_pos attribute initialization fallback - CpuGpuBuffer used for positions in PCP/DCP case instead of plain tensor - KV offload import path compatibility Changes: 1. Add fallback query_pos initialization in NPUModelRunner.__init__() if parent class doesn't initialize it (compatibility with different vLLM versions) 2. Use plain torch.zeros() instead of _make_buffer() for positions and input_ids in PCP/DCP cases to match upstream expectations (directly subscriptable) 3. Add fallback import handling for CPUOffloadingManager with version compatibility These fixes address 89 of 152 failing tests across all test categories. Fixes issues: - AttributeError: 'NPUModelRunner' object has no attribute 'query_pos' (67 tests) - TypeError: 'CpuGpuBuffer' object is not subscriptable (21 tests) - ModuleNotFoundError: No module named 'vllm.v1.kv_offload.cpu.manager' (1 test) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Previous fix was too broad - we only need to use plain tensor for positions (which needs to be subscriptable), but input_ids must remain as CpuGpuBuffer because upstream code calls .copy_to_gpu() on it. This matches the parent GPUModelRunner's initialization pattern: - input_ids: CpuGpuBuffer (supports .copy_to_gpu() at line 1626) - positions: plain tensor (supports subscripting at line 3271) Fixes: - AttributeError: 'Tensor' object has no attribute 'copy_to_gpu' (21 tests) - Maintains subscriptable positions for long_sequence and chunked_prefill tests Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
355d0c6 to
67c71b8
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
What this PR does / why we need it?
main2main vllm update to 0324 commit 14acf429ac08b6d538ca6feb3e06b6d13895804d
Does this PR introduce any user-facing change?
No
How was this patch tested?
CI