Support multi node nvlink fabric - #23
Conversation
asp0ex
left a comment
There was a problem hiding this comment.
Two things before merge:
- Split the cutlass 4.4.2 → 4.6.0 bump (and the
make_fragment→
make_rmem_tensorrename) into a separate PR — we need to stay on 4.4.2
for compatibility with other kernels (inline onsetup.py/
grad_reduce.py). benchmarks/bench_vs_deepep.pyneeds to follow thefds→shareables
rename; it callsnvl_dist_mapdirectly and now raisesTypeError
(inline onbindings.cu).
Rest of the fabric change LGTM.
|
Thanks @asp0ex. nvidia-cutlass-dsl version change is removed. I upgraded it as my environment and sglang use 4.6.0. bench_vs_deepep.py is also updated. |
995acc1 to
fc0be86
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends MoonEP’s NVLink-backed shared-buffer implementation to support EP groups that span multiple nodes within the same NVLink/IMEX domain (e.g., GB200) by introducing CUDA fabric handles (in addition to POSIX FD-based sharing), and updates tests/benchmarks to use local device indexing rather than assuming rank == cuda device.
Changes:
- Add fabric-handle based memory sharing path in NVLink buffer allocation/mapping (C++ + Python bindings), with an env var to force/auto-select handle type.
- Update distributed tests to select CUDA devices via
LOCAL_RANK(and use"cuda"device strings so current device routing works). - Update benchmarks to use
LOCAL_RANKand barrier on the current CUDA device.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
moonep/buffer.py |
Adds fabric-handle selection and fabric-based handle exchange/map paths for distributed and single-owner NVLink tensors. |
csrc/nvl_shared_buffer.cuh |
Implements fabric handle export/import, validates handle tensors, and supports mapping via fabric handles. |
csrc/bindings.cu |
Exposes new fabric APIs/flags to Python (FABRIC_HANDLE_BYTES, nvl_fabric_supported, new args). |
tests/kernel_test_utils.py |
Introduces local_device_index() helper and updates helpers to rely on current CUDA device. |
tests/conftest.py |
Sets CUDA device using local rank and aligns barriers to the selected device. |
tests/test_prefetch.py |
Updates device selection and device_ids barriers to use local device index/current device routing. |
tests/test_grad_reduce.py |
Same as above for grad-reduce tests (device selection, barriers, tensor device strings). |
tests/test_e2e.py |
Switches device selection to local rank and uses "cuda" device strings. |
tests/test_dispatch.py |
Uses "cuda" device strings so tests follow the current device set by the fixture. |
tests/test_combine.py |
Uses "cuda" device strings for allocations, relying on fixture-selected device. |
benchmarks/bench_vs_deepep.py |
Updates benchmark’s internal NVLink sharing to use fabric handles when selected. |
benchmarks/bench_prefetch.py |
Sets device from LOCAL_RANK, uses "cuda", and barriers on current device. |
benchmarks/bench_grad_reduce.py |
Same as above for grad-reduce benchmark. |
Suppressed comments (1)
moonep/buffer.py:61
- This uses
assertto enforce a user-facing runtime constraint (MOONEP_MEM_HANDLE_TYPE=fabricrequires fabric support on all ranks). Assertions can be disabled with-O, which would let execution continue and likely fail later in harder-to-debug ways.
if mode == "fabric":
assert not unsupported, (
f"{_HANDLE_TYPE_ENV}=fabric, but fabric memory handles are "
f"unsupported on group ranks {unsupported}."
)
return True
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Current MoonEP supports each rank of an EP group lives on the same node. This PR adds support for multi node with nvlink via CUDA fabric handles, valid for every GPU in the same NVLink/IMEX domain, e.g., GB200.
Tests
Run the benchmark on single node and two nodes.