Repository navigation
feat(vllm): support single-node TP/PP CPU KV offloading - #602
Draft
shipiyouniao wants to merge 2 commits into
Draft
shipiyouniao wants to merge 2 commits into
shipiyouniao wants to merge 2 commits into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Extends the CPU offloading path from TP=1/2/4, PP=1 to validated single-node TP/PP layouts on vLLM 0.29–0.30. Pipeline stages may have different KV payloads: all ranks now share one chunk count, with native pinned CPU buffers sized for each rank.
Stacked on #598 (
feat/offload-copy-pins). Its copy pins, retirement fence and ordered compute-release barrier remain the foundation.Implementation and scope
floor(cpu_bytes / (blocks_per_chunk * sum(rank_payload_bytes))); reserved VMM storage size is not payload.CPUOffloadingSpecsubclass selects rank-private buffers and adapts the 0.29num_blocks/ 0.30num_chunksAPI. Native workers still perform transfers. Validate canonical tensors against the plan and preserve empty pipeline-local group indices.TP * PP. Queued execution requires the existing all-rank compute barrier, including PP with async scheduling disabled. CLI float-valued byte budgets retain native truncation behavior.mp(unifor one worker only), Model Runner V2, soleOffloadingConnector, DP/PCP/DCP=1. Rejectcanonical_layout, ranks without KV tensors, and strided state-only partitions unsupported by native registration. Existing backend and page-geometry constraints still apply.Before / after architecture
flowchart TB subgraph Before["Before: TP 1/2/4, PP 1"] BG["Topology guard"] --> BN["Native CPU spec and workers"] BN --> BC["Native buffers; shared slots where eligible"] BG --> BR["PP greater than 1 rejected"] end subgraph After["After: validated single-node TP x PP"] D["Per-rank logical KV descriptors"] --> P["Common chunk budget"] P --> S["Scheduler: common chunk IDs and count"] P --> RPC["Collective RPC before native KV initialization"] RPC --> R0["Rank 0 native worker"] RPC --> RN["Rank N native worker"] R0 <--> C0["Rank 0 private pinned CPU buffer"] RN <--> CN["Rank N private pinned CPU buffer"] R0 --> Q["Copy-completion quorum: TP x PP"] RN --> Q Q --> F["Existing retirement and compute-release fence"] F --> U["Unmap when all holds are clear"] endBefore: restricted path
sequenceDiagram participant E as Engine participant W as TP workers participant M as KV manager Note over E,W: TP=1/2/4, PP=1, PP rejected before initialization E->>W: Native KV and CPU offloader initialization E->>M: Pin transfer pages before dispatch E->>W: Dispatch native load/store jobs W-->>E: Copy-complete reports E->>M: Unpin after configured worker quorum opt Queued execution E->>W: Existing ordered compute barrier W-->>E: All workers finish earlier CUDA work end E->>M: Drain eligible retired pages Note over E,M: Pinning and release fence inherited from #598After: rank-private capacity and all-rank release
sequenceDiagram participant E as Engine participant W as All TP x PP workers participant S as Native CPU specs participant M as KV manager E->>E: Derive rank payloads and common chunk count E->>W: Collective RPC installs capacity plan W-->>E: Verify every expected rank acknowledged E->>W: Native KV initialization W->>S: Validate local tensors and create private pinned buffers E->>S: Scheduler uses the same chunk count E->>M: Pin transfer pages before dispatch E->>W: Dispatch native load/store jobs W-->>E: Copy-complete counts E->>M: Unpin only after TP x PP completions opt Queued execution, including synchronous PP E->>W: Existing ordered all-rank compute barrier W-->>E: All ranks finish earlier CUDA work end E->>M: Drain fenced retirements with no remaining holds Note over E,M: Copy completion and compute safety both precede unmapValidation