Repository navigation
[3/3] [Store] Avoid staging for remote GPU reads - #3431
Conversation
|
Core change: remote memory reads no longer equate |
|
@neverhook I think this direction looks good to me, recently merged PR #3159 avoids staging for same-node tensor writes, while #3197 covers same-node reads. This PR further avoids staging for remote node reads. But could we test it on real NVLink devices to validate both correctness and performance? |
78b70a7 to
77b965e
Compare
|
@yokinoshitayoki The real NVLink validation is now complete on two GB200 nodes in the same NVL72 NVLink domain. For the direct remote-memory read covered by this PR, Consumer The complete acceptance context is in the Store PR validation report and the RFC update. |
77b965e to
2ce9f53
Compare
|
Stack maintenance update:
GB200 was not rerun because this was a patch-equivalent baseline rebase with no functional-path change. |
e8caa64 to
1743f7e
Compare
|
Stack update:
|
1743f7e to
5d17c90
Compare
|
Rebased onto #3335 with the direct-read patch unchanged. All three regression tests pass with and without CUDA. Full CI is running again. |
5d17c90 to
7957c54
Compare
7957c54 to
26c6c6c
Compare
|
Rebased on the updated Store layer. No changes to the direct-read logic; the new CI run will check the combined stack. |
c316f1d to
882a0d0
Compare
|
Rebased onto the updated Store layer after #2966 merged. The direct-read patch is unchanged, and its CUDA-on/off regressions still pass. Fresh CI will check the combined stack. |
882a0d0 to
d0acafe
Compare
|
Replayed this on the simplified EGM Store layer in #3335. The direct-read logic |
d0acafe to
16b212e
Compare
aa23e02 to
577f772
Compare
Signed-off-by: wugou.cyf <wugou.cyf@antfin.com>
577f772 to
db195f7
Compare
|
@yokinoshitayoki #3335 has merged, and this PR is now rebased onto |
The PR changed registered_buffer_sizes_ from unordered_map<void*, size_t> to unordered_map<void*, BufferRegistrationRecord>; the test merged from main (kvcache-ai#3431) still assigned a bare size_t. Use aggregate initialization.
…nted with A memory replica's descriptor reported `protocol_ == "tcp"` for every segment except CXL: `AllocatedBuffer::protocol` defaulted to "tcp" and only `change_to_cxl` / `copyTransferProtocolFrom` ever changed it, so the protocol a client mounted its segment with (rdma, nvlink, ...) never reached readers. `RealClient::can_use_direct_memory_read` (kvcache-ai#3431) decides from that field, so a GPU-destination read always fell back to staging through the local buffer, even from an nvlink/EGM segment. The protocol is now a property of the allocator, like the transport endpoint: every allocator creation site passes the mounted segment's protocol (SegmentManager and SegmentPool mounts, snapshot restore, the CXL global allocator as "cxl", NoF segments as "nvmeof"), and a buffer carved from an allocator carries that protocol in its descriptor. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…nted with A memory replica's descriptor reported `protocol_ == "tcp"` for every segment except CXL: `AllocatedBuffer::protocol` defaulted to "tcp" and only `change_to_cxl` / `copyTransferProtocolFrom` ever changed it, so the protocol a client mounted its segment with (rdma, nvlink, ...) never reached readers. `RealClient::can_use_direct_memory_read` (kvcache-ai#3431) decides from that field, so a GPU-destination read always fell back to staging through the local buffer, even from an nvlink/EGM segment. The protocol is now a property of the allocator, like the transport endpoint: every allocator creation site passes the mounted segment's protocol (SegmentManager and SegmentPool mounts, snapshot restore, the CXL global allocator as "cxl", NoF segments as "nvmeof"), and a buffer carved from an allocator carries that protocol in its descriptor. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: JinYan Su <751080330@qq.com>
…ts keep a GPU context on their own socket (#4951) * [Bugfix][Store] Replicas advertise the protocol their segment was mounted with A memory replica's descriptor reported `protocol_ == "tcp"` for every segment except CXL: `AllocatedBuffer::protocol` defaulted to "tcp" and only `change_to_cxl` / `copyTransferProtocolFrom` ever changed it, so the protocol a client mounted its segment with (rdma, nvlink, ...) never reached readers. `RealClient::can_use_direct_memory_read` (#3431) decides from that field, so a GPU-destination read always fell back to staging through the local buffer, even from an nvlink/EGM segment. The protocol is now a property of the allocator, like the transport endpoint: every allocator creation site passes the mounted segment's protocol (SegmentManager and SegmentPool mounts, snapshot restore, the CXL global allocator as "cxl", NoF segments as "nvmeof"), and a buffer carved from an allocator carries that protocol in its descriptor. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: JinYan Su <751080330@qq.com> * [Bugfix][TE] An EGM segment keeps a GPU context on its own socket NvlinkHostNumaAllocation::Create allocates one HOST_NUMA segment per NUMA node, but the provider process only ever holds a context on device 0. When a peer imports the fabric handle, the driver routes the mapping through a GPU of the exporting process that sits on the memory's socket if the process has a context on one, and otherwise through whatever GPU it has; for the far socket's segment every access then also crosses the host's CPU-to-CPU link. On a GB300 tray that is 87 GiB/s instead of the 197 GiB/s C2C rate, and the route is fixed when the handle is imported. Create now retains the primary context of the first visible GPU whose HOST_NUMA_ID is the segment's node, for as long as the allocation lives. A node with no GPU attached keeps the old behaviour. Measured with the store's nvlink consumer reading a 1 GiB object from a 64 GiB EGM pool on another tray: get_into GPU 86 -> 182-184 GiB/s, get_into host 87 -> 171 GiB/s. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: JinYan Su <751080330@qq.com> * [Bugfix][Store] A remounted replica advertises its segment's current protocol ReMountSegment imports each segment's allocator with the protocol the segment is mounted with, so the rebuilt buffers carry it, but Replica::replace_memory_buffer then copied the protocol of the buffer being replaced onto the new one. Before the previous commit that copy was a no-op, every buffer said "tcp"; after it, the copy put the snapshot's stale protocol back, so replicas restored from a pre-upgrade snapshot kept advertising "tcp" until the object was rewritten, and a segment remounted under another protocol kept advertising the old one. The imported buffer keeps its segment's protocol; copyTransferProtocolFrom goes with its only caller. The new test restores a standby snapshot whose descriptor says "tcp", remounts the segment with protocol "nvlink" and reads "nvlink" back; without the fix it reads "tcp". Reported by Aionw in the review of #4951. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: JinYan Su <751080330@qq.com> * [Bugfix][Store] The cachelib remount test mounts its segment with the protocol it expects RemountRestoresCachelibMemoryReplica wrote "rdma" into the snapshot descriptor and expected it back after remount, but remounted a segment with no protocol. Since the previous commit a remounted replica takes its segment's current protocol, so it read back "". The segment now mounts with "rdma", which is what the assertion means. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: JinYan Su <751080330@qq.com> --------- Signed-off-by: JinYan Su <751080330@qq.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Description
Avoid mandatory CPU staging when the selected remote memory replica can be
read directly into a GPU destination through Transfer Engine.
Stack
This is [3/3] of the RFC implementation stack:
#3335 has merged, and this PR has been rebased onto
mainby replaying thedirect-read patch. GitHub now shows only this PR's single-commit, four-file
direct-read change against
main.Problem
Remote memory reads into GPU buffers fall back to CPU staging even when
Transfer Engine can write directly to the destination. Direct-read eligibility
must follow the selected replica's transport, which can differ from the
protocol requested at client setup.
The staging path adds a CPU allocation and host-to-device copy, which can
become the throughput bottleneck for cross-node paths such as EGM to HBM.
Fix
The private direct-read predicate now receives the selected
Replica::Descriptorand uses the memory replica's actualbuffer_descriptor.protocol_:nvlinkrdmaThe affected full, ranged, and batched GPU-read paths pass the selected replica.
The newer snapshot APIs retain their existing registration and lease contracts.
There is no new Transfer Engine introspection API, public C++/Python API, wire
schema, or configuration change.
Relationship to existing work
the remote path.
remote memory-read decision and does not add the broader lifecycle changes.
EGM-to-HBM reads.
Review size
main.Validation
The direct-read logic and tests are unchanged. This update replays the patch
onto
mainafter #3335 merged; the direct-read increment retains the samepatch-id.
Current-head CI (
db195f7f7cad61a0a3c3141b8ecf6ca399a54fca):The Sphinx documentation job was skipped by path filtering in this run; it
was not rerun on this head.
Earlier validation, retained as history rather than new results for this replay:
git diff --checkand all applicable PR-scoped hooks, including CMake formatting.The earlier upstream CMake formatting issue is fixed in the new base; no hook
exception is needed. Repository-wide
pre-commit run --all-filesis not a merge gate.The regression matrix intentionally crosses requested and selected protocols:
nvlink+ selected RDMA replica: staging until the fulldestination range is registered;
rdma+ selected NVLink replica: direct GPU destination;The existing two-node GB200 result is historical supporting evidence, not
validation of this head. No GB200 run is included in this update. The simplified EGM lifecycle in
#3335 still needs fresh hardware evidence; its previous results are not reused.
Module
mooncake-store)Type of Change
Checklist
Repository-wide pre-commit is intentionally not used as a merge gate for this
focused change.
AI Assistance Disclosure
AI assistance was used to inspect the Store/Transfer Engine path, implement the
focused fix, add regression coverage, run validation, and update this PR. The
human submitter remains responsible for reviewing and defending the change.