Repository navigation
[None][perf] NIXL transfer agent: direct peer copy over NVLink for VRAM writes - #21931
Draft
Wanli-Jiang wants to merge 1 commit into
Draft
Wanli-Jiang wants to merge 1 commit into
Wanli-Jiang wants to merge 1 commit into
Conversation
1 task done
Wanli-Jiang
force-pushed
the
user/williamj/nixl-direct-peer-copy
branch
from
November 10, 2026 07:54
f290ab5 to
6dc5e0e
Compare
…AM writes With TRTLLM_NIXL_DIRECT_COPY=1 on both agents, the receiver exports the fabric handles of its registered VMM chunks in an AgentDesc extension envelope (a raw bounce handshake from an older peer still decodes). The sender imports and maps them, then serves each VRAM -> VRAM write with one gather-scatter kernel (at most 32 CTAs, 256 KiB units, plan read from mapped pinned host memory) and one event, instead of one cuda_ipc copy plus event record per descriptor. Off by default. The direct path serves any peer whose fabric handles this process may import: the same node, or another node of the same NVLink domain when both processes hold the same IMEX channel (one Slurm job under switch/nvidia_imex, or one Kubernetes ComputeDomain). A peer whose import fails (another IMEX channel or NVLink domain) keeps the bounce / NIXL path, as do writes it cannot serve (non-VRAM, sync message, destination outside the mapped regions); the direct path is tried before bounce. Imports run on four background threads, so loadRemoteAgent returns at once and writes go through NIXL until a peer's mapping is published; a generation per peer name drops mappings made stale by an invalidate or reload during the import. Plans whose work units average at most 32 KiB (per-layer KV head slices between ranks with different KV heads per rank) use one warp per unit instead of one CTA per unit. Evidence (Qwen3.8 FP8 agentic serving, GB300, disaggregated, ctx workers also with CUDA_DEVICE_MAX_CONNECTIONS=32): - 3600 s runs, switch off -> on: c240 output +2.5 %, TTFT p90 2.14 / 2.33 -> 1.16 / 1.18 s; c256 output +7.5 %, TTFT p90 9.13 -> 1.77 s. - Transfer microbenchmark on GB300 NVL72 with the native transceiver's mappers: direct 637 to 2,764 GB/s against NIXL 5 to 185 GB/s across TP1 / TEP / DEP ctx-gen pairs on one, two and four nodes, every byte checked; cross-node bandwidth equals same-node bandwidth. - Greedy outputs 160/160 identical; GSM8K 95.49 with the switch on. The cpp_bounce transfer tests set TRTLLM_NIXL_DIRECT_COPY=0, so they keep exercising the bounce when the switch is on in the job environment. Signed-off-by: Wanli Jiang <[email protected]>
Wanli-Jiang
force-pushed
the
user/williamj/nixl-direct-peer-copy
branch
from
November 13, 2026 04:27
6dc5e0e to
cf8bb49
Compare
1 task
Collaborator
Author
|
hand over to disagg team. |
Collaborator
Author
|
some further effort to close the gap, but not touch the direct-peer-copy standards: #22412 |
This branch has not been deployed
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.
@coderabbitai summary
Description
With
TRTLLM_NIXL_DIRECT_COPY=1on both agents, the receiver exports the fabric handles of its registered VMM chunks in an AgentDesc extension envelope (a raw bounce handshake from an older peer still decodes). The sender imports and maps them, then serves each VRAM -> VRAM write with one gather-scatter kernel (at most 32 CTAs, 256 KiB units, plan read from mapped pinned host memory) and one event, instead of one cuda_ipc copy plus event record per descriptor. Off by default.Which peers it serves:
switch/nvidia_imex, or one Kubernetes ComputeDomain). For any other peer the import fails (CUDA_ERROR_NOT_PERMITTEDfor another IMEX channel), and that peer keeps the bounce / NIXL path.loadRemoteAgentreturns at once; writes to a peer go through NIXL until its mapping is published. Mapping a peer's pools costs about 0.2 ms per physical chunk on one node and up to about 1 ms across nodes (seconds for a full KV pool). A generation per peer name drops a mapping made stale by an invalidate or reload during its import.Kernel: plans whose work units average at most 32 KiB use one warp per unit, larger units one CTA per unit. Small units are what a transfer between ranks with different KV heads per rank produces (ctx TEP -> gen DEP or the reverse moves per-layer head slices, 8 KiB with fp8 KV and 32-token blocks).
Counters on the Python agent:
direct_submit_count,direct_cross_node_submit_count,direct_mapped_peer_count.Evidence, serving (Qwen3.8 FP8 agentic serving, GB300, disaggregated ctx TEP2 + gen TEP2 on one node, ctx workers also with
CUDA_DEVICE_MAX_CONNECTIONS=32):One more 3600 s run at the highest point measured, concurrency 272, same deployment and configuration with only the switch off: total throughput 279.7K tok/s per GPU and TTFT p90 13.4 s, against 314.5K and 1.30 s with the switch on. One of two runs with the switch on at that concurrency saw 17 KV-transfer timeouts during a whole-deployment stall; the run with the switch off saw none. Whether the stall involves the direct copy is not settled, which is why the switch stays opt-in.
Evidence, transfer microbenchmark (GB300 NVL72; one process per GPU, receiver pools allocated like KVCacheManagerV2 (fabric VMM, 32 MiB chunks, 160 GiB), descriptors produced by the native transceiver's own mappers and routing for Qwen3.8 KV geometry, every destination byte checked):
GB/s is the bytes of one round of 16 or 32 requests (8K to 64K tokens) over the slowest sender's round time, all senders together; every write to a peer on another node took the direct path.
CUDA_ERROR_NOT_PERMITTED, all writes take NIXL, bytes correct.loadRemoteAgentuntil every peer is mapped: 2 peers on one node 4.0 s; 4 / 8 peers on other nodes 5 to 17 s / 27 to 29 s.The cpp_bounce transfer tests set
TRTLLM_NIXL_DIRECT_COPY=0, so they keep exercising the bounce when the switch is on in the job environment.Test Coverage
tests/unittest/disaggregated/test_nixl_direct_copy.py: direct peer copy against the descriptors on two GPUs with fabric memory (skips otherwise): mixed descriptor sizes through the CTA-per-unit kernel; head-slice-sized descriptors through the warp-per-unit kernel, with a write issued while the background import may still run and an invalidate + reload of the peer around it; and the same writes through NIXL. The writes checked after the mapping must take the direct path.test_nixl_direct_copy.pyandtest_mamba_transfer.py16 passed.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.