[CI] main2mian v0.24.0 - #11227
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 updates the vllm_ascend repository to support vLLM version 0.24.0. It introduces robust conditional logic to handle breaking changes in upstream vLLM APIs, ensuring that the Ascend NPU platform remains compatible with both older (0.23.0) and newer versions. The changes span across tool call parsing, speculative decoding, model runner initialization, and graph management. 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. 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 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
|
|
👋 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. |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
990d8ca to
fd8387f
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
2432904 to
14970a8
Compare
14970a8 to
3a79707
Compare
3a79707 to
5ccbef3
Compare
f295369 to
a282451
Compare
6d6dcf1 to
09ea2dc
Compare
|
|
||
| # CUDA_VISIBLE_DEVICES for each DP rank is set automatically inside the | ||
| # engine processes. | ||
| # vLLM v0.24.0 (PR #45026) stopped isolating devices per worker process |
There was a problem hiding this comment.
I think we should add _build_device_ids in vllm/entrypoints/openai/dp_supervisor.py in the example.
…BLE_DEVICES unset vLLM v0.24.0 (PR #45026) removed per-process device isolation. For application-level DP (separate LLM() per rank), both ranks now see all NPU devices, causing HCCL MoE all-to-all communicators to fail with same physical device errors. Auto-discover device count via torch.npu.device_count() when the env var is absent, and assign each DP rank a distinct slice. Signed-off-by: hfadzxy <starmoon_zhang@163.com>
09ea2dc to
f13be37
Compare
| self.assertEqual(layer.w13_weight.shape, (8, 128, 256)) | ||
| self.assertEqual(layer.w13_weight_scale.shape, (8, 4, 256)) | ||
| self.assertEqual(layer.w2_weight.shape, (8, 256, 16)) | ||
| self.assertEqual(layer.w2_weight.shape, (8, 256, 128)) | ||
| self.assertEqual(layer.w2_weight_scale.shape, (8, 8, 128)) | ||
| self.assertEqual(layer.w13_weight.dtype, torch.float32) | ||
| self.assertEqual(layer.w2_weight.dtype, torch.float32) |
There was a problem hiding this comment.
why do we change the assertion check in the test case?
There was a problem hiding this comment.
This pr skips this use case and notes subsequent fixes.No need to modify it now
| import vllm_ascend.patch.worker.patch_fused_moe # noqa | ||
|
|
||
| # Ascend NPU does not support DT_UINT64 in aclnnInplaceZero. | ||
| # CpuGpuBuffer with dtype=torch.uint64 (used by MambaCopyBuffers) |
There was a problem hiding this comment.
It seems more reasonable to patch MambaCopyBuffers instead of CpuGpuBuffer?
There was a problem hiding this comment.
Sure, this is more elegant
| # [num_speculative_steps] | ||
| synthetic_conditional_rates: torch.Tensor | None = None, | ||
| use_fp64: bool = False, | ||
| use_block_verification: bool = False, |
There was a problem hiding this comment.
plz add a todo here as this is a new feature for speculative decoding in vllm, but we already implement the block verify in vllm-ascend before, maybe we should refactor it later
| register_model() | ||
|
|
||
|
|
||
| import vllm_ascend.logger # noqa: E402, F401 |
There was a problem hiding this comment.
To avoid circular imports when vLLM's plugin chain triggers during logger loading.
| if dp_local_rank is None: | ||
| dp_local_rank = parallel_config.data_parallel_index | ||
| self.local_rank += dp_local_rank * tp_pp_world_size | ||
|
|
There was a problem hiding this comment.
I think you can adapt the init_device just as that of gpu_worker.py https://github.com/vllm-project/vllm/pull/45026/changes?diff=unified#diff-62b35645ec2e0a565f1367fda869f582ca181cdc04d7b8ca36db71218216d6d7
There was a problem hiding this comment.
I will align it
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
01914d8 to
6bb24f7
Compare
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
6bb24f7 to
ec74a26
Compare
| # DP local_rank shift below would push local_rank past the | ||
| # length of the per-rank device list and trip the assert | ||
| # in this same method. Skip the shift in that case. | ||
| and parallel_config.assigned_physical_gpu_ids is None |
There was a problem hiding this comment.
when using ray as the distributed backend, device-ids doesn't have effect, thus let's remove this check.
31bf142 to
954d773
Compare
### What this PR does / why we need it? This PR upgrades the verified vLLM main commit to ee0da84ab9e04ac7610e28580af62c365e898389 (v0.24.0 tag) and adapts vLLM Ascend to upstream API changes introduced after the previous verified commit. Changes # Changes ### `examples/offline_data_parallel.py` - Slice `ASCEND_RT_VISIBLE_DEVICES` according to the local DP rank before creating the `LLM` instance. - Fall back to `torch.npu.device_count()` when `ASCEND_RT_VISIBLE_DEVICES` is not set. - Keep application-level DP compatible with the upstream removal of automatic device isolation. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `tests/e2e/conftest.py` - Slice `ASCEND_RT_VISIBLE_DEVICES` for each DP rank before creating `LLM()` instances or worker processes. - Fall back to `torch.npu.device_count()` when the environment variable is unavailable. - Ensure each test process uses an independent NPU subset after upstream removed automatic device isolation. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `tests/ut/quantization/methods/test_w4a16_mxfp4.py` - Skip the test to match the upstream behavior. --- ### `tests/ut/spec_decode/test_speculators_vwn_eagle3.py` - Mock `vllm.v1.attention.selector._cached_get_attn_backend()` for non-NPU unit tests. - Avoid attention backend initialization failures introduced by the updated v0.24.0 initialization path. - Keep spec decode unit tests runnable without physical NPU devices. --- ### `vllm_ascend/_310p/worker_310p.py` - Use `MemorySnapshot(device=device)` for non-0.23.0 releases. - Align the 310P worker with the updated worker implementation. - Related upstream changes: - [vllm#30868](vllm-project/vllm#30868) --- ### `vllm_ascend/patch/platform/patch_dp_device_ids.py` - Add a patch for `get_physical_gpu_ids_for_local_dp_rank()`. - Support pre-sharded `ASCEND_RT_VISIBLE_DEVICES` by avoiding the upstream DP-rank offset when device isolation is already handled externally. - Prevent `IndexError` for application-level DP after the upstream device isolation changes. - Wire the patch into the platform initialization for non-0.23.0. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `vllm_ascend/patch/platform/patch_kv_cache_utils.py` - Patch `_get_kv_cache_config_deepseek_v4()` on v0.23.0. - Patch `_get_kv_cache_config_packed()` for non-0.23.0 by reusing the existing non-packed implementation. - Avoid excessive KV-cache allocation introduced by the packed KV-cache layout and prevent NPU OOM. - Upstream source: [vllm#46205](vllm-project/vllm#46205). --- ### `vllm_ascend/patch/worker/__init__.py` - Monkey-patch `vllm.v1.utils.CpuGpuBuffer.__init__()` to remap `torch.uint64` to `torch.int64` on non-0.23.0. - Preserve the original behavior for all other data types. - Avoid the Ascend runtime failure caused by unsupported `DT_UINT64` in `aclnnInplaceZero`. - Upstream source: [vllm#44665](vllm-project/vllm#44665). --- ### `vllm_ascend/spec_decode/ngram_proposer.py` - Preserve the original initialization path on v0.23.0. - Delay the Ascend-specific `propose()` implementation during base-class initialization on newer releases. - Avoid eager GPU-only initialization introduced upstream while preserving the original behavior afterward. - Upstream source: [vllm#29184](vllm-project/vllm#29184). --- ### `vllm_ascend/worker/utils.py` - Correct the type annotation of `kernel_block_sizes` to match its actual nested-list usage. - Keep the implementation consistent with the upstream interface. --- ### `vllm_ascend/worker/worker.py` - Adjust the local device rank for single-node application-level DP on non-Ray backends. - Match the upstream device assignment behavior after automatic device isolation was removed. - Ensure each DP worker is mapped to the correct NPU subset. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `vllm_ascend/__init__.py` - Reorganize imports to eliminate circular dependencies during package initialization. - vLLM version: v0.23.0 - vLLM main: vllm-project/vllm@b9a7cd4 --------- Signed-off-by: zhangxinyuehfad <starmoon_zhang@163.com> Signed-off-by: hfadzxy <starmoon_zhang@163.com>
### What this PR does / why we need it? This PR upgrades the verified vLLM main commit to ee0da84ab9e04ac7610e28580af62c365e898389 (v0.24.0 tag) and adapts vLLM Ascend to upstream API changes introduced after the previous verified commit. Changes # Changes ### `examples/offline_data_parallel.py` - Slice `ASCEND_RT_VISIBLE_DEVICES` according to the local DP rank before creating the `LLM` instance. - Fall back to `torch.npu.device_count()` when `ASCEND_RT_VISIBLE_DEVICES` is not set. - Keep application-level DP compatible with the upstream removal of automatic device isolation. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `tests/e2e/conftest.py` - Slice `ASCEND_RT_VISIBLE_DEVICES` for each DP rank before creating `LLM()` instances or worker processes. - Fall back to `torch.npu.device_count()` when the environment variable is unavailable. - Ensure each test process uses an independent NPU subset after upstream removed automatic device isolation. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `tests/ut/quantization/methods/test_w4a16_mxfp4.py` - Skip the test to match the upstream behavior. --- ### `tests/ut/spec_decode/test_speculators_vwn_eagle3.py` - Mock `vllm.v1.attention.selector._cached_get_attn_backend()` for non-NPU unit tests. - Avoid attention backend initialization failures introduced by the updated v0.24.0 initialization path. - Keep spec decode unit tests runnable without physical NPU devices. --- ### `vllm_ascend/_310p/worker_310p.py` - Use `MemorySnapshot(device=device)` for non-0.23.0 releases. - Align the 310P worker with the updated worker implementation. - Related upstream changes: - [vllm#30868](vllm-project/vllm#30868) --- ### `vllm_ascend/patch/platform/patch_dp_device_ids.py` - Add a patch for `get_physical_gpu_ids_for_local_dp_rank()`. - Support pre-sharded `ASCEND_RT_VISIBLE_DEVICES` by avoiding the upstream DP-rank offset when device isolation is already handled externally. - Prevent `IndexError` for application-level DP after the upstream device isolation changes. - Wire the patch into the platform initialization for non-0.23.0. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `vllm_ascend/patch/platform/patch_kv_cache_utils.py` - Patch `_get_kv_cache_config_deepseek_v4()` on v0.23.0. - Patch `_get_kv_cache_config_packed()` for non-0.23.0 by reusing the existing non-packed implementation. - Avoid excessive KV-cache allocation introduced by the packed KV-cache layout and prevent NPU OOM. - Upstream source: [vllm#46205](vllm-project/vllm#46205). --- ### `vllm_ascend/patch/worker/__init__.py` - Monkey-patch `vllm.v1.utils.CpuGpuBuffer.__init__()` to remap `torch.uint64` to `torch.int64` on non-0.23.0. - Preserve the original behavior for all other data types. - Avoid the Ascend runtime failure caused by unsupported `DT_UINT64` in `aclnnInplaceZero`. - Upstream source: [vllm#44665](vllm-project/vllm#44665). --- ### `vllm_ascend/spec_decode/ngram_proposer.py` - Preserve the original initialization path on v0.23.0. - Delay the Ascend-specific `propose()` implementation during base-class initialization on newer releases. - Avoid eager GPU-only initialization introduced upstream while preserving the original behavior afterward. - Upstream source: [vllm#29184](vllm-project/vllm#29184). --- ### `vllm_ascend/worker/utils.py` - Correct the type annotation of `kernel_block_sizes` to match its actual nested-list usage. - Keep the implementation consistent with the upstream interface. --- ### `vllm_ascend/worker/worker.py` - Adjust the local device rank for single-node application-level DP on non-Ray backends. - Match the upstream device assignment behavior after automatic device isolation was removed. - Ensure each DP worker is mapped to the correct NPU subset. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `vllm_ascend/__init__.py` - Reorganize imports to eliminate circular dependencies during package initialization. - vLLM version: v0.23.0 - vLLM main: vllm-project/vllm@b9a7cd4 --------- Signed-off-by: zhangxinyuehfad <starmoon_zhang@163.com> Signed-off-by: hfadzxy <starmoon_zhang@163.com>
### What this PR does / why we need it? This PR upgrades the verified vLLM main commit to ee0da84ab9e04ac7610e28580af62c365e898389 (v0.24.0 tag) and adapts vLLM Ascend to upstream API changes introduced after the previous verified commit. Changes # Changes ### `examples/offline_data_parallel.py` - Slice `ASCEND_RT_VISIBLE_DEVICES` according to the local DP rank before creating the `LLM` instance. - Fall back to `torch.npu.device_count()` when `ASCEND_RT_VISIBLE_DEVICES` is not set. - Keep application-level DP compatible with the upstream removal of automatic device isolation. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `tests/e2e/conftest.py` - Slice `ASCEND_RT_VISIBLE_DEVICES` for each DP rank before creating `LLM()` instances or worker processes. - Fall back to `torch.npu.device_count()` when the environment variable is unavailable. - Ensure each test process uses an independent NPU subset after upstream removed automatic device isolation. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `tests/ut/quantization/methods/test_w4a16_mxfp4.py` - Skip the test to match the upstream behavior. --- ### `tests/ut/spec_decode/test_speculators_vwn_eagle3.py` - Mock `vllm.v1.attention.selector._cached_get_attn_backend()` for non-NPU unit tests. - Avoid attention backend initialization failures introduced by the updated v0.24.0 initialization path. - Keep spec decode unit tests runnable without physical NPU devices. --- ### `vllm_ascend/_310p/worker_310p.py` - Use `MemorySnapshot(device=device)` for non-0.23.0 releases. - Align the 310P worker with the updated worker implementation. - Related upstream changes: - [vllm#30868](vllm-project/vllm#30868) --- ### `vllm_ascend/patch/platform/patch_dp_device_ids.py` - Add a patch for `get_physical_gpu_ids_for_local_dp_rank()`. - Support pre-sharded `ASCEND_RT_VISIBLE_DEVICES` by avoiding the upstream DP-rank offset when device isolation is already handled externally. - Prevent `IndexError` for application-level DP after the upstream device isolation changes. - Wire the patch into the platform initialization for non-0.23.0. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `vllm_ascend/patch/platform/patch_kv_cache_utils.py` - Patch `_get_kv_cache_config_deepseek_v4()` on v0.23.0. - Patch `_get_kv_cache_config_packed()` for non-0.23.0 by reusing the existing non-packed implementation. - Avoid excessive KV-cache allocation introduced by the packed KV-cache layout and prevent NPU OOM. - Upstream source: [vllm#46205](vllm-project/vllm#46205). --- ### `vllm_ascend/patch/worker/__init__.py` - Monkey-patch `vllm.v1.utils.CpuGpuBuffer.__init__()` to remap `torch.uint64` to `torch.int64` on non-0.23.0. - Preserve the original behavior for all other data types. - Avoid the Ascend runtime failure caused by unsupported `DT_UINT64` in `aclnnInplaceZero`. - Upstream source: [vllm#44665](vllm-project/vllm#44665). --- ### `vllm_ascend/spec_decode/ngram_proposer.py` - Preserve the original initialization path on v0.23.0. - Delay the Ascend-specific `propose()` implementation during base-class initialization on newer releases. - Avoid eager GPU-only initialization introduced upstream while preserving the original behavior afterward. - Upstream source: [vllm#29184](vllm-project/vllm#29184). --- ### `vllm_ascend/worker/utils.py` - Correct the type annotation of `kernel_block_sizes` to match its actual nested-list usage. - Keep the implementation consistent with the upstream interface. --- ### `vllm_ascend/worker/worker.py` - Adjust the local device rank for single-node application-level DP on non-Ray backends. - Match the upstream device assignment behavior after automatic device isolation was removed. - Ensure each DP worker is mapped to the correct NPU subset. - Upstream source: [vllm#45026](vllm-project/vllm#45026). --- ### `vllm_ascend/__init__.py` - Reorganize imports to eliminate circular dependencies during package initialization. - vLLM version: v0.23.0 - vLLM main: vllm-project/vllm@b9a7cd4 --------- Signed-off-by: zhangxinyuehfad <starmoon_zhang@163.com> Signed-off-by: hfadzxy <starmoon_zhang@163.com>
What this PR does / why we need it?
This PR upgrades the verified vLLM main commit to ee0da84ab9e04ac7610e28580af62c365e898389 (v0.24.0 tag) and adapts vLLM Ascend to upstream API changes introduced after the previous verified commit.
Changes
Changes
examples/offline_data_parallel.pyASCEND_RT_VISIBLE_DEVICESaccording to the local DP rank before creating theLLMinstance.torch.npu.device_count()whenASCEND_RT_VISIBLE_DEVICESis not set.tests/e2e/conftest.pyASCEND_RT_VISIBLE_DEVICESfor each DP rank before creatingLLM()instances or worker processes.torch.npu.device_count()when the environment variable is unavailable.tests/ut/quantization/methods/test_w4a16_mxfp4.pytests/ut/spec_decode/test_speculators_vwn_eagle3.pyvllm.v1.attention.selector._cached_get_attn_backend()for non-NPU unit tests.vllm_ascend/_310p/worker_310p.pyMemorySnapshot(device=device)for non-0.23.0 releases.vllm_ascend/patch/platform/patch_dp_device_ids.pyget_physical_gpu_ids_for_local_dp_rank().ASCEND_RT_VISIBLE_DEVICESby avoiding the upstream DP-rank offset when device isolation is already handled externally.IndexErrorfor application-level DP after the upstream device isolation changes.vllm_ascend/patch/platform/patch_kv_cache_utils.py_get_kv_cache_config_deepseek_v4()on v0.23.0._get_kv_cache_config_packed()for non-0.23.0 by reusing the existing non-packed implementation.vllm_ascend/patch/worker/__init__.pyvllm.v1.utils.CpuGpuBuffer.__init__()to remaptorch.uint64totorch.int64on non-0.23.0.DT_UINT64inaclnnInplaceZero.vllm_ascend/spec_decode/ngram_proposer.pypropose()implementation during base-class initialization on newer releases.vllm_ascend/worker/utils.pykernel_block_sizesto match its actual nested-list usage.vllm_ascend/worker/worker.pyvllm_ascend/__init__.pyDoes this PR introduce any user-facing change?
How was this patch tested?