feat(p2p): add direct RDMA reads into GPU KV cache - #454
Draft
GentleCold wants to merge 5 commits into
Draft
GentleCold wants to merge 5 commits into
GentleCold wants to merge 5 commits into
Conversation
Export full CUDA allocations in the owner and hand off live DMA-BUF descriptors during registration. Keep imported tensors with registered and queued RDMA memory, drain accepted completions, and flush writes before reporting success. Group standardized dense BHNC physical rows into logical cache blocks. Add real cross-process GPU integration and make the same-process E2E load probe exercise a complete dense block.
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.
Cross-node KV hits currently pass through requester host staging before being copied into GPU KV slots. This draft adds opt-in RDMA READs from remote registered host memory directly into GPU KV slots after vLLM allocates destination blocks. Set
PEGA_DIRECT_GPU_RDMA=1on the participating processes. Direct-mode errors fail explicitly; no host-staging fallback is added.The initial scope is dense attention storage group 0, including multi-layer and split K/V destinations. Page-first and recurrent/HMA direct layouts remain unsupported. Direct-loaded data is neither inserted into the requester host ReadCache nor advertised as a persistent owner. Ordinary host staging remains an independently selected reference/control.
Implementation
cuFlushGPUDirectRDMAWrites(CURRENT_CTX, TO_OWNER)before reporting success. RC transport failure teardown remains a draft blocker below.[B,H,N,C]registration: group physical rows when physical blocks are smaller than logical blocks, as already done for MLA. On vLLM 0.29, 64-token physical rows back 128-token logical blocks. This shared connector defect caused incorrect cache-hit outputs on both raw master and the initial feature build.Validation at
da22d2dMaiyi: one 8×B300 host, CUDA 13/RDMA, vLLM 0.29, torch 2.13+cu130, NIXL 1.4.1. Only GPUs 0–3 were used; production GPUs 4–7 were untouched. Local/remote SHA256 values match all 22 files changed by this repair.
-D warningspassed. Only GPU 3 was exposed to this Rust gate; cases requiring additional GPUs can return early.prekpassed. CUDA release/Clippy hooks were run remotely instead of on the Mac.Longer PD replay and output verification
Qwen3-0.6B, 2P2D/TP1, 8 GiB host pool per instance, concurrency 1, one output token, no explicit warmup or retries. Both variants independently replayed the full 19,610-record trace: 11,188 records exceed the 32K context limit, leaving the same 8,422 eligible requests, with zero preparation failures. The underlying tar SHA256 is
d142c26674bada87414ab37f26587ed103a74a8aef68c250b563bd7127b2ecf3; lossless recompression for transfer changed only the gzip container.Raw master also has the dense-layout defect. The control is master
1a20960with only the common BHNC mapping repair inworker.py, using unchanged master native/server binaries. Feature isda22d2d, based on2ab8fbf; the master snapshot additionally includes #451. Feat ran first, then the control, each from a cold service start.Both had zero HTTP failures/retries and zero load failures. Startup, trace preparation, output checks and cleanup are excluded from measured replay; total wall time was 3,304.01 s for control and 3,308.81 s for feature. Workload manifests, normalized replay configurations, per-request index/token/block/completion/attempt shapes and all six synthetic output fingerprints match across variants.
Feature recorded 1,387 direct successes, 0 direct errors, 0 MR registration failures and 0 pinned-pool allocation failures during replay. Post-replay cache-hit output checks matched independent D0 recomputation 6/6 on each variant; feature added 7 direct successes in that separate window. The replay exercised cache churn: 1,411,413 feature and 1,447,213 control block evictions.
Control recorded 735 successful host RDMA fetches and 1 failed fetch. At 05:29:19, a 256 MiB NUMA0 fetch allocation failed (global pool usage 3.8/8.0 GiB); the prefetch returned 0/203 remote blocks. The connector retained 12 local hit blocks and the request still completed through ordinary computation. The pool-allocation and host-fetch error counters each increased by one. HTTP/load success therefore does not mean the control transport had no errors. Generic host-tier counters do not include direct loads, and direct-operation counts cannot be compared directly with host block counts.
Feature mean TTFT was 0.036% higher, p99 0.857% higher, and throughput 0.061% lower. This single pair shows no end-to-end speedup. In request-order quarters, relative mean-TTFT changes were -1.295%, +0.457%, +0.293%, +0.650%; input lengths vary by quarter. It remains one host, one model, TP1 and concurrency 1, not a repeated or two-node performance claim.
During the final approximately 15 minutes, both variants had constant GPU memory, bounded server FD counts, and less than 4 MiB RSS variation per server. Feature FD counts stayed fixed. There were no resource/metrics sampling failures. Fixed 8 GiB pools and RSS including shared mappings do not establish pinned-host memory savings or prove every failure-path lifetime.
HTTP replay success is separate from the six synthetic output checks; fingerprints for every trace response were not recorded. The additional 1032-token cold PD probe still differs from recomputation in both variants. The same fingerprint difference was previously reproduced with PegaFlow removed and pure NIXL enabled; the internal NIXL/vLLM cause remains unresolved. Both long runs logged unregister RPC connection refused during SIGTERM cleanup after validation, so teardown is not claimed warning-free.
Before ready for review / merge
Long-run evidence:
/home/linux2/kexi/pd_bench/direct_gpu_long19610_20260917{,_feat,_master-layout}/. Local raw copies, paired analysis and report:.local/pd_bench/artifacts/maiyi-direct-gpu-long-20260917/. Earlier build/integration/E2E and pure-NIXL isolation evidence remains in.local/pd_bench/artifacts/maiyi-direct-gpu-fix-20260917/and the corresponding remote directories. All test processes exited; GPUs 0–3 were free after each run. Production GPUs 4–7 stayed at 273,102 MiB throughout resource samples, and PID 25188/kern-serve remained alive. No product source changed during this longer replay.Tracking: AIINF-286. Keep this PR Draft and the issue In Progress until the remaining acceptance criteria are met.