Repository navigation
feat(capture): NVLink publication in the v0.5.18 capture sink - #938
Merged
Merged
Conversation
With MOONCAKE_PROTOCOL=nvlink the sink keeps capture objects in one fabric-memory arena that the Mooncake TransferEngine allocates on the writer GPU: the NVLink transport can only export such memory, and the Mooncake store cannot place objects there. Responses carry each object's device address plus the TransferEngine session and a control endpoint, where POST /free is the counterpart of the store's remove. Capture hooks are unchanged; NVLink always selects device publication. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 6, 2026
Serving frees from an HTTP thread competed with the SGLang scheduler for the GIL: each request took tens of milliseconds under load. Clients now write JSON key lists to a TCP control connection, and the writer thread, the only thread that touches the arena, drains them before it allocates. The arena needs no locks and the HTTP server is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The arena reused MOONCAKE_GLOBAL_SEGMENT_SIZE, whose 32 GiB default was chosen for the store's host-memory segment; with NVLink it is HBM on the writer GPU. SGLANG_SPEC_CAPTURE_NVLINK_ARENA_BYTES now sets it and is required, so the arena never silently takes GPU memory. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sport NvlinkArena becomes CaptureArena, the result field "nvlink" becomes "arena" and SGLANG_SPEC_CAPTURE_NVLINK_ARENA_BYTES becomes SGLANG_SPEC_CAPTURE_ARENA_BYTES. Where a sample waits (store or arena) is independent of how its bytes move; currently only online NVLink capture uses the arena, decided in one place (arena_enabled), so an arena over another transport can be added without renaming again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
MOONCAKE_PROTOCOL=nvlink (managed_local.mooncake.protocol or deployment.disaggregated.mooncake_protocol) reads capture objects straight from the server GPU into receive_buffers=cuda. NvlinkObjectClient implements the Mooncake store calls MooncakeFeatureStore makes, so generations, leases and removal retries are unchanged; objects are located from the addresses the sink returns on each SampleRef and freed through its control endpoint. The launch plan sets MC_FORCE_MNNVL so Mooncake picks NVLink over the RDMA NICs, and external NVLink deployments need no Mooncake store endpoints. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first version freed each object with an HTTP request that a Python thread inside the busy SGLang scheduler process served. GIL handoffs made each request take tens of milliseconds, so on GB300 the durable ack took 0.16-0.29 s per step and blocked the training thread. remove() now writes the key to a persistent TCP connection and returns; the sink applies frees before it allocates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
managed_local.mooncake.nvlink_arena_bytes sets the HBM each capture server reserves for NVLink capture objects (SGLANG_SPEC_CAPTURE_NVLINK_ARENA_BYTES) and is required with protocol nvlink. Because those objects stay on the servers until the optimizer-boundary ack, runtime.resident_high_watermark_bytes must be set and, for managed-local stacks, fit in the servers' summed arenas; the producer then stops capturing before an arena fills. The trainer side keeps its existing receive_pool_bytes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
NvlinkObjectClient becomes ArenaObjectClient (runtime/data_plane/ mooncake_arena.py), the ref metadata key becomes "mooncake_arena", the sink's result field becomes "arena" and nvlink_arena_bytes becomes arena_bytes (SGLANG_SPEC_CAPTURE_ARENA_BYTES). Where a sample waits is independent of how its bytes move; currently only online NVLink capture uses the arena, which is noted at each place that decides it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve the RDMA environment checks while resolving the capture sink conflict. Ignore malformed free frames without dropping subsequent valid frames, and share one allocation deadline across each published batch. Add regressions for message validation and timeout rollback.
jiapingW
self-requested a review
October 18, 2026 08:29
jiapingW
approved these changes
Oct 18, 2026
feat(mooncake): read server captures over multi-node NVLink
jiapingW
requested review from
FlamingoPg,
shuaills and
sleepcoo
as code owners
October 18, 2026 08:52
khazic
pushed a commit
to khazic/SpecForge_lao
that referenced
this pull request
Oct 19, 2026
Port the NvlinkArena from the v0.5.18 capture patch (sgl-project#938 at 9ad9ff8) into the plugin's sink. With MOONCAKE_PROTOCOL=nvlink the sink copies each batch into one fabric-memory arena that the Mooncake TransferEngine allocates on the writer GPU, sized by the required SGLANG_SPEC_CAPTURE_NVLINK_ARENA_BYTES. Results gain "nvlink": {"session", "control"} and a per-feature "address". Clients free objects by writing JSON key lists to the control TCP connection, which the writer thread drains before it allocates. NVLink always selects device publication, and SGLANG_SPEC_CAPTURE_GPU_PUT=0 is rejected. The scheduler now checks the arena size at startup, like the plugin's flag checks, instead of failing every capture batch. The tcp and rdma paths are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Multi-node NVLink capture transport, part 1 of 2 (server side). Part 2: #939.
Why
On GB200/GB300 NVL72 the capture servers and trainers sit in one NVLink domain, but online capture still moves hidden states through host memory or the NICs. Mooncake's NVLink (MNNVL) transport can only export memory allocated with a fabric handle, and the Mooncake store cannot place objects in such memory, so the store path cannot use it.
Changes
MOONCAKE_PROTOCOL=nvlinkswitches the v0.5.18 sink from the store to aCaptureArena, memory the capture server owns. The arena is named by placement (where samples wait) rather than transport; currently only online NVLink capture uses it, decided in one place (arena_enabled()).SGLANG_SPEC_CAPTURE_ARENA_BYTES. It's a separate variable from the store'sMOONCAKE_GLOBAL_SEGMENT_SIZE, whose 32 GiB default was chosen for host memory, so GPU memory is never taken silently.{store_id}/{sample_id}/g{gen}/{name}), one object per tensor. Each result adds"arena": {"session", "control"}, and every feature gains an"address".remove. Clients write a JSON list of keys, one per line, to thecontrolTCP endpoint (portSGLANG_SPEC_CAPTURE_CONTROL_PORT, ephemeral by default).SGLANG_SPEC_CAPTURE_GPU_PUT=0is rejected.Not included: the Kimi K3 patch and the SGLang plugin port (
maocheng/sglang-capture-plugin) still need the same sink change.Tests
sglang-v0.5.18-cu130-arm64, Mooncake 0.3.13.post1): the sink tests pass, including the CUDA ones (publishing into the arena through a fake engine).MooncakeFeatureStorefrom part 2 read every byte back correctly (3.5 ms per ~100 MB sample on average), then freed them, and the arena returned to fully free.🤖 Generated with Claude Code