-
Notifications
You must be signed in to change notification settings - Fork 37
[Feat]: first impliment for async GPU connector #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
specture724
wants to merge
18
commits into
vllm-project:main
Choose a base branch
from
specture724:AsyncGPU
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
896f30b
init: first impliment for async GPU connector
specture724 71892a3
fix: flash_comm_v1_enabled for NPU only
specture724 69bf40b
perf: gather dispatch rows into the peer window, poll off the compute…
specture724 84bcd6c
perf: drop the per-work-item device synchronizes from the FFN path
specture724 5b20d7c
perf: ship each token once per destination and reduce on the FFN side
specture724 f2c9a08
refactor: fold the two receive spin loops into SymmWindow.wait
specture724 1f38e07
feat: run async MoE ubatching on GPU
specture724 741db0d
perf: weight and reduce the expert output in the payload dtype
specture724 a3421e4
perf: wait for the expert reply on the stream, not on the host
specture724 32aeace
perf: resolve the Ascend DBO yield once instead of per MoE layer
specture724 cbb8a24
perf: cut the per-layer host work on the dispatch path
specture724 3f8c6b0
perf: read the dispatch plan back into pinned memory
specture724 a094760
perf: find the expert boundaries with searchsorted, not bincount
specture724 ce2a6ac
test: give the lifecycle connector fake an extra_info
specture724 6d26165
perf: build dispatch headers on the device and write slots at capacity
specture724 8a0e7b9
style: reformat the window roundtrip smoke test
specture724 48ac7ec
perf: size the shared field by the per-rank split, not by the batch
specture724 c26c3da
fix: make the shutdown broadcast callable
specture724 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright contributors to the AFD plugin project | ||
| """Rank layout shared by the asynchronous AFD connectors. | ||
|
|
||
| Both async connectors -- Ascend CAM and CUDA NVSHMEM -- lay their world out | ||
| Attention-first and derive expert placement the same way. Keeping that here lets | ||
| the CUDA connector reuse it without importing a backend module. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from dataclasses import dataclass | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| if TYPE_CHECKING: | ||
| from afd_plugin.config import AFDConfig | ||
|
|
||
| ASYNC_MOE_REQUEST_SPLIT = "request" | ||
| ATTN_RANKS_PER_DP_CONFIG_KEY = "attn_ranks_per_dp" | ||
|
|
||
|
|
||
| @dataclass(frozen=True, slots=True) | ||
| class AFDAsyncTopology: | ||
| """Role-local and world rank information for one async participant.""" | ||
|
|
||
| role: str | ||
| role_rank: int | ||
| world_rank: int | ||
| attn_size: int | ||
| ffn_size: int | ||
| expert_per_rank: int | ||
|
|
||
| @property | ||
| def world_size(self) -> int: | ||
| """Return the total number of Attention and FFN ranks.""" | ||
| return self.attn_size + self.ffn_size | ||
|
|
||
|
|
||
| def build_async_topology( | ||
| afd_config: AFDConfig, | ||
| role_rank: int, | ||
| *, | ||
| num_routed_experts: int | None = None, | ||
| ) -> AFDAsyncTopology: | ||
| """Validate role-local rank settings and derive the async world rank. | ||
|
|
||
| The world is Attention-first: Attention role rank ``i`` maps to world rank | ||
| ``i`` and FFN role rank ``j`` maps to ``num_attention_ranks + j``. Routed | ||
| experts are distributed across FFN ranks using a ceiling division; | ||
| production model layouts should keep the routed-expert count divisible by | ||
| the FFN rank count. | ||
| """ | ||
| attn_size = afd_config.num_attention_ranks | ||
| ffn_size = afd_config.num_ffn_ranks | ||
| if attn_size <= 0 or ffn_size <= 0: | ||
| raise ValueError("AFD async topology sizes must be positive") | ||
| if role_rank < 0: | ||
| raise ValueError(f"AFD async role rank must be non-negative, got {role_rank}") | ||
|
|
||
| if afd_config.role == "attention": | ||
| if role_rank >= attn_size: | ||
| raise ValueError( | ||
| "Attention role rank must be within attention size " | ||
| f"(rank={role_rank}, size={attn_size})", | ||
| ) | ||
| world_rank = role_rank | ||
| elif afd_config.role == "ffn": | ||
| if role_rank >= ffn_size: | ||
| raise ValueError( | ||
| "FFN role rank must be within FFN size " | ||
| f"(rank={role_rank}, size={ffn_size})", | ||
| ) | ||
| world_rank = attn_size + role_rank | ||
| else: | ||
| raise ValueError(f"unknown AFD role {afd_config.role!r}") | ||
|
|
||
| expert_count = num_routed_experts or 1 | ||
| expert_per_rank = (expert_count + ffn_size - 1) // ffn_size | ||
| return AFDAsyncTopology( | ||
| role=afd_config.role, | ||
| role_rank=role_rank, | ||
| world_rank=world_rank, | ||
| attn_size=attn_size, | ||
| ffn_size=ffn_size, | ||
| expert_per_rank=expert_per_rank, | ||
| ) | ||
|
|
||
|
|
||
| __all__ = [ | ||
| "ASYNC_MOE_REQUEST_SPLIT", | ||
| "ATTN_RANKS_PER_DP_CONFIG_KEY", | ||
| "AFDAsyncTopology", | ||
| "build_async_topology", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Validate the async-GPU execution contract. This only checks that
async=trueuses an async connector; it does not requireGpuAsyncAFDConnectorto use async mode. Configurations without async mode, Attention-side gating, eager execution, or with native DBO are accepted and later hang, overwrite slots, or fail for missing top-k payloads. Add GPU-specific validation before either role initializes the connector.