Repository navigation
Allow SGLang EP at tensor width, refuse non-none MoE A2A, and add parallel-group ring checks - #402
Merged
Merged
Conversation
A stock runtime derives its NCCL communicators from the parallelism widths
alone, and libsircl creates each as a child of the deployment's communicator
through ncclCommSplit. Under LIBSIRCL_RING_ONLY=1 a process holds queue pairs
only to its ring neighbours, so such a child can start only when its ranks
occupy one contiguous arc of the ring, or the whole ring. That refusal
belongs in the plan, which needs the runtimes' group lists and a map from
process rank to ring position to make it.
runtime/common/parallel_groups.py transcribes SGLang v0.5.21 and vLLM 0.19.1
group construction from the parallelism widths, classifies a group against a
rank-to-position map, lists the rank sets that are not one arc, and searches
for a position order under which every group is an arc (exhaustive over the
ring's positions, pruned as groups complete).
The rank lists are read from each runtime's initialize_model_parallel. At four
Sparks, vLLM dp2 x tp2 fits under the order {0:0, 1:1, 2:3, 3:2}; at eight,
vLLM dp2 x tp4 and SGLang tp8 ep4 have no order. Validation: pytest
runtime/common/test_parallel_groups.py (15 tests), ruff check.
A stock SGLang image on libsircl refused every --ep-size above one, although the plan's own shape is the safe one: the plan sets --tp-size to the group's Spark count, and SGLang builds its expert group as the tensor-parallel group itself at that width (parallel_state.py: "if moe_ep_size == tensor_model_parallel_size: _MOE_EP = _TP"). Expert parallelism at that width adds no communicator, and the deployment's one route map carries it. preflight now takes the group's Spark count (stock_install passes the group's row count) and refuses expert parallelism only below that width, where SGLang forms expert groups of every moe_tp-th rank: no order of the ring makes those one arc (runtime/common/parallel_groups.py), so the child communicator would be refused at setup on a rank with no route to its group peer. --enable-ep-moe leaves the refused-flag list; alone it is a no-op, since SGLang's ep_size defaults to 1. --moe-a2a-backend is checked now too: only "none" keeps MoE dispatch on PyNccl's all-gather and reduce-scatter, and every other value dispatches through a library the images do not carry (DeepEP's NVSHMEM, NIXL, Mooncake, MORI or FlashInfer symmetric memory). Validation: pytest runtime/common/test_stock_image.py (84 tests), runtime/common/test_parallel_groups.py (27), runtime/host/test_stock_install.py (9); ruff check clean.
parallel_groups.assignment finds the order of ranks that puts every runtime
communicator on one arc of the cable ring, but that order cannot be applied by
permuting the position list a plan hands to tools/site_routes.py. The tool
numbers each row by its index in the layout ("LIBSIRCL_POSITION": str(rank))
and reads that row's route map from the Spark named at that index, so a
permuted list describes a ring over cables that do not exist rather than a
relabelled rank order. The order is realised by which Spark runs each rank,
leaving the trace in cable order.
The docstring states that, and test_libsircl.py pins the layout invariant: a
cycle listed as 0,1,3,2 keeps positions 0-3 per row and changes what rank 2
reaches, since its row is now the Spark at position 3.
Validation: pytest runtime/common/test_libsircl.py (47 tests),
runtime/common/test_parallel_groups.py (27); ruff check clean.
…ck, and LF endings
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.
Summary
Enables SGLang expert parallelism at full tensor-parallel width (
--ep-size == tp) onlibsirclstock images, refuses non-noneMoE A2A dispatch backends, and addsruntime/common/parallel_groups.pyto model SGLang (v0.5.21) and vLLM (0.19.1) process-group topologies and ring-only reachability.Changes
runtime/common/stock_image.py,runtime/host/stock_install.py,docs/architecture/libsircl.md):--ep-size/--epequal to the group's tensor-parallel width (size // pp): SGLang aliases_MOE_EP = _TP, adding no extra communicator. Still refuses1 < ep < tpandep > tp.--enable-ep-moefromSGLANG_REFUSED_FLAGS.--moe-a2a-backendand--speculative-moe-a2a-backendvalues other thannone(e.g.deepep,nixl,mooncake,mori,flashinfer) so dispatch stays on PyNccl overlibsircl.sizefromstock_install.surveyintostock_image.preflight.runtime/common/parallel_groups.py,runtime/common/test_parallel_groups.py,runtime/common/test_libsircl.py):v0.5.21(including_PPstride-tpgroups and per-replica DP worlds) and vLLM0.19.1communicator construction.SINGLE,PAIR(K == 2cable-adjacent),OPEN_ARC(3 <= K < W, fails underLIBSIRCL_RING_ONLY=1becauseengine.ccloses the child ring moduloKwithout a closing cable),WHOLE, orSTRIDED.assignment()search withO(1)fast-fail when any group has3 <= K < W, plus brute-force verification over4!and6!permutations.tools/site_routes.pylayout invariant intest_libsircl.py.Verification
ruff check .clean;python -m pytest runtime/common/test_parallel_groups.py runtime/common/test_stock_image.py runtime/common/test_libsircl.py runtime/host/test_stock_install.py— 177 passed.8&7,LIBSIRCL_RING_ONLY=1, 2 direct RoCEv2 lanes):lmsysorg/sglang:v0.5.21-cu130-runtimeservingnvidia/Qwen3.6-35B-A3B-NVFP4(256 experts, 8+1 active) with--tp-size 2 --ep-size 2 --moe-a2a-backend none --moe-runner-backend flashinfer_cutlass./health,/v1/models(max_model_len: 262144), and/v1/chat/completions(both thinking andenable_thinking: false->EP2_OK) all succeeded./proc/*/mapsconfirmed only/opt/sparkring/libsircl/lib/libsircl.so.0.6.0mapped (zero NVIDIAlibnccl.so.2).libsirclreceipts on both ranks confirmed exactly 2 communicators (c1PyNccl +c2torch PG, confirming_MOE_EP = _TP),ring_only: true,forwarded: 0,healthy: true,22,185all-reduces (7,428CUDA-graph captured,97.7 GB),0staged/refused ops.