mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #5041] [RFC]: [TE] HipTransport: fast, correct intra-node XGMI for P/D KV transfer on AMD #1276
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1276
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Jasen2201 on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/5041
Changes proposed
Summary
This RFC tracks a set of changes to classic Transfer Engine's
HipTransport(intra-node XGMI on AMD Instinct). The goal is for same-node P/D KV transfer over XGMI to be correct, and faster than RDMA loopback through the NICs for the copy shapes that inference engines actually send.Today neither holds:
MC_DISABLE_HIP=1, and same-node P/D goes GPU → NIC → switch → NIC → GPU.hipMemcpyAsync. Until #4953, every submit also blocked until the copy finished. P/D KV transfer is thousands of small, scattered copies per request: KV pages, per-head slices, scales and index pages. These run at 0.1–0.7 GB/s over XGMI, 5–20× slower than the same copies over RDMA loopback.Work items:
getTransferStatusMotivation: measured on real P/D shapes
Setup: 8× MI355X with all-to-all XGMI, 8 × 400G ionic NICs (one per GPU), ROCm 7.2. One process per GPU over P2PHANDSHAKE, with one submit thread and at most 4096 requests per batch, as in a typical P/D connector. Each case is one request's incremental KV (about 12K tokens) from one prefill GPU, with decode pages scattered at random. The shapes come from the ATOM P/D connector for GLM-5.2 (CPP4 prefill → DCP4 decode) and MiniMax-M3.1 (PP4 prefill → TP4 decode). The table shows p50 per request, with GB/s per prefill GPU in brackets.
What the numbers show:
hipMemcpyAsynccosts about 2.4 µs per call.hipPointerGetAttributes,hipSetDeviceandhipEventQuerycost 30–50 ns each, so the transport's own bookkeeping was the next limit.hipMemcpyAsynccopies collapse to 0.03–0.04 GB/s: one request takes 1–12 s.Design of #5040 (item 3)
MC_HIP_BATCH_COPY_MIN(default 16) copies of at most 1 MiB runs them as one kernel launch over a(src, dst, len)descriptor array.hipMemcpyAsync. The copy engines are as fast for them, faster across several links, and use no CUs.libhiprtcisdlopened, so there is no new link dependency and noCMAKE_HIP_ARCHITECTURESlist for wheels.hipMemcpyAsync.hipSetDeviceper request.Item 4: ordering after the caller's stream
Pool streams are non-blocking, so a copy can start before the kernel that produced its source on the caller's stream has finished. That was also true before #4953.
The obvious fix is to record an event on the null stream and make the pool stream wait on it. That halves fan-out bandwidth: 1→4 with 8 MiB copies drops from 207 to 103 GB/s, measured on the setup above.
Options to evaluate:
Item 6: Store on the same host
The Store client passes explicit RDMA devices, which disables auto-discovery. Only
rdmais installed, so same-host GPU↔GPU Store traffic never uses XGMI.This matters only once Store segments can live in HBM.
USE_VRAM_SEGMENTis CUDA-only today. Store owner segments in DRAM are not reachable over XGMI at all. Item 6 is therefore a question for after items 1–3.Non-goals
hylinktoday; that is tracked separately.Open questions
TransferRequestand one task per 64 B–16 KiB piece? The remaining 170 ns per request is generic TE bookkeeping (task, slice,markSuccess), not HIP.Before submitting a new issue...
@github-actions[bot] commented on GitHub (Oct 28, 2026):
Thanks for opening this issue, @Jasen2201!
38908462A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide