mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #4918] [RFC]: nvlink_intra support for VMM (cuMemCreate) buffers, including PyTorch expandable segments #1250
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#1250
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 @whn09 on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4918
Changes proposed
Motivation
nvlink_intrashares registered GPU buffers withcudaIpcGetMemHandle. That call fails for memory from the CUDA virtual memory management API (cuMemCreate+cuMemMap), so such buffers cannot be registered at all. The common case is PyTorch withPYTORCH_CUDA_ALLOC_CONF=expandable_segments:True, which serving stacks often enable (#2511 reported it and was closed without a fix for this transport; #3538 fixed the RDMA dma-buf path only).Proposed design
Detection and registration.
cuMemRetainAllocationHandlesucceeds only for VMM memory, so it decides between the existing cudaIpc path and the new one.cuMemGetAddressRangereturns only the physical allocation mapped at an address, not the whole reservation. Registration therefore walks the range chunk by chunk and requires every byte to be mapped.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTORinrequestedHandleTypes; otherwise registration fails with a message that says what to change.Publishing. One
BufferDesccovers the chunks. Itsshm_namecarries, behind a magic and version, the chunk layout and the address of a per-process fd server.cudaIpcMemHandle_tand fail with the existing "Mismatched NVLink data transfer method" error instead of crashing.Passing fds. An exported POSIX fd is a per-process object, so it travels over a Unix domain socket with
SCM_RIGHTS.SOCK_SEQPACKET, abstract by default (@mooncake-nvlink-<pid>-<nonce>), or a socket file inMC_NVLINK_FD_DIRfor peers that share a directory but not a network namespace.SO_PEERCRED).pidfd_getfd(PyTorch's approach) is not used: with Yamaptrace_scope=1it only works for descendants.Import. On first use, the initiator fetches the fds, runs
cuMemImportFromShareableHandle, maps the chunks back to back into a new reservation, and grants access to the visible devices (falling back to the current device). Teardown unmaps per chunk, frees the reservation and releases the handles.Configuration.
MC_NVLINK_VMM=0restores today's behaviour.MC_NVLINK_FD_DIRselects socket files instead of an abstract socket.Out of scope
expandable_segments_handle_type:posix_fd.nvlink, RDMA, EFA).Validation (HGX B200, driver 595.91, CUDA 13.2, PyTorch 2.13)
MC_NVLINK_FD_DIRworks.Before submitting a new issue...
@github-actions[bot] commented on GitHub (Oct 25, 2026):
Thanks for opening this issue, @whn09!
964527A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@whn09 commented on GitHub (Oct 25, 2026):
Implementation: #4919