[WIP][NPU]Add DSV4 NPU ubatch async connector - #264
Conversation
5bbeadc to
5399493
Compare
jiangkuaixue123
left a comment
There was a problem hiding this comment.
Please address the inline comments.
| _logger = logging.getLogger(__name__) | ||
| _registered = False | ||
|
|
||
|
|
There was a problem hiding this comment.
Why do we need this process-wide multiprocessing override here? It does not appear necessary for the AFD plugin itself, and mutating Python's global multiprocessing context (including the private _concrete_contexts registry) is quite intrusive. Please remove this unless there is a concrete AFD-specific requirement and reproducer that cannot be addressed in the affected NPU runtime path.
| # fail_if_unsupported_npu_afd_features; the AFD async MoE ubatching | ||
| # path drives stage counts through connector_extra_config | ||
| # (async_moe_num_ubatches), which is validated there as well. | ||
| if self.vllm_config.parallel_config.use_ubatching: |
There was a problem hiding this comment.
This check does not look correct. Rejecting use_ubatching in the wrapper disables native ubatching for ordinary decode as well, rather than only restricting the CAM async path. Please remove this change so normal decode ubatching can still be enabled.
| from vllm.platforms import current_platform | ||
|
|
||
| if current_platform.device_type == "npu": | ||
| from afd_plugin.model_executor.models.deepseek_v4_npu import ( |
There was a problem hiding this comment.
Could we place the GPU and NPU implementations under dedicated gpu/ and npu/ directories, respectively, and keep the two backend implementations isolated? Please avoid sharing/reusing backend-specific DeepSeek-V4 code across GPU and NPU.
| @@ -0,0 +1,164 @@ | |||
| # SPDX-License-Identifier: Apache-2.0 | |||
There was a problem hiding this comment.
I do not understand why this KV-cache patch is necessary. What concrete upstream issue does it address, and why must it be patched in AFD rather than fixed in vLLM-Ascend? Please provide a minimal reproducer and explain the necessity of this patch; otherwise, please remove it.
| @@ -0,0 +1,119 @@ | |||
| # SPDX-License-Identifier: Apache-2.0 | |||
There was a problem hiding this comment.
I do not understand why this ModelSlim patch is necessary. What exact incompatibility requires AFD to override the upstream prefix mapping, and why cannot it be handled in vLLM-Ascend? Please provide a concrete reproducer and justify the patch; otherwise, please remove it.
|
Please fix conflict. |
2cc1aa8 to
053b808
Compare
|
It seems that there are a lot of documents and operation manuals in the repository about specific test environments. Please make sure that the documents you submit are general guidance and avoid submitting irrelevant documents and startup scripts. |
| # Keep EngineCore's synthetic KV-cache profile local so that workspace | ||
| # is not mistaken for reclaimable KV capacity. The first real request | ||
| # performs the normal CAM dispatch/receive sequence below. | ||
| if forward_context.in_profile_run: |
There was a problem hiding this comment.
Could you explain why the startup profile must skip CAM dispatch/combine here?
PR #248 intentionally removed an equivalent guard to fix #247. Matched profile traffic ensures that every Attention DP rank enters the CAM operators before live serving; skipping it appears to defer lazy CAM/HCCL initialization to the first real request, potentially reintroducing the DP>1 first-request deadlock.
Has the CAM 209 initialization contract changed? If so, how does this PR initialize all Attention ranks before serving, and has the DP2 single-cold-request scenario from #247 been validated?
This also appears to conflict with the existing test_async_cam_profile_forward_runs_matched_connector_io regression test added by #248.
|
Could you clarify the motivation for replacing the previous global-DP topology with multiple independent DP1 Attention services? The previous setup already supported a cross-node DP3TP8 + EP8 topology (for example, local DP2 on one node and DP1 on another), while vLLM handled request routing across the Attention DP replicas automatically. With this change, request routing must be moved to an external load balancer, and the FFN side additionally needs multiple CAM/HCCL communicators plus a TCPStore scheduler. What concrete limitation or failure in the previous global CAM world requires this higher-complexity design? Is this mandated by a DSV4/CAM 209 contract, or does the old topology exhibit a reproducible correctness or performance issue under concurrent DP traffic? It would also be helpful to explain why the existing cross-node DP mechanism cannot satisfy the intended deployment and what benefit justifies giving up vLLM built-in DP routing. |
Signed-off-by: bjf-frz <frz123db@gmail.com>
Signed-off-by: bjf-frz <frz123db@gmail.com>
Signed-off-by: bjf-frz <frz123db@gmail.com>
Signed-off-by: bjf-frz <frz123db@gmail.com>
eaada78 to
ca2eacb
Compare
| depends_on: upload-merge-pipeline | ||
| steps: | ||
| - label: "E2E · DeepSeekV2-Lite" | ||
| - label: "E2E · DeepSeekV2-Lite · Legacy" |
There was a problem hiding this comment.
This file change is not needed.
| depends_on: upload-ready-pipeline | ||
| steps: | ||
| - label: "E2E · DeepSeekV2-Lite" | ||
| - label: "E2E · DeepSeekV2-Lite · Legacy" |
There was a problem hiding this comment.
This file change is not needed.
Signed-off-by: bjf-frz <frz123db@gmail.com>
Signed-off-by: bjf-frz <frz123db@gmail.com>
Signed-off-by: bjf-frz <frz123db@gmail.com>
ca2eacb to
ea44030
Compare
| ): | ||
| # Install DSV4's Ascend KV grouping compatibility before an EngineCore can | ||
| # ask vLLM to construct its cache configuration. | ||
| from afd_plugin.compat.patches.npu.deepseek_v4_kv_cache import ( |
There was a problem hiding this comment.
Remove these two patches if there is no need.
| llama_4_scaling, | ||
| ) | ||
|
|
||
| # CAM allocates persistent operator workspace on its first dispatch. |
There was a problem hiding this comment.
Please remove this.
Signed-off-by: bjf-frz <frz123db@gmail.com>
| # small dummy batch with an FFN receive-capacity buffer and leave the | ||
| # external communicator in a broken state. Keep the profile local; | ||
| # live forwards below retain the real remote-FFN exchange. | ||
| if bool(getattr(forward_context, "in_profile_run", False)): |
There was a problem hiding this comment.
There is no need. Please remove.
| # dispatch-recv for all following MoE layers can reuse CAM's | ||
| # bounded buffers while the prior combine is still in flight. | ||
| # The target baseline is deliberately serialized per layer; | ||
| # async MoE ubatching will introduce explicit stage credits. |
…m-patch [NPU] Remove redundant DSV4 ModelSlim patch
d7d3b20 to
ff23e6d
Compare
| if not self.connector.is_initialized: | ||
| self.connector.init_afd_connector() | ||
|
|
||
| def _is_dsv4_model(self) -> bool: |
PLEASE FILL IN THE PR DESCRIPTION AND MAKE SURE THE CHECKLIST ITEMS HAVE BEEN CONSIDERED.
Purpose
Issue
Scope
Implementation Notes
Test Plan
Test Result
Docs Impact
Essential PR Checklist