Skip to content

[Perf] scheduler: broadcast TP requests via the shared-memory MessageQueue instead of gloo - #44202

Open
rahulvijayaraghavan wants to merge 1 commit into
sgl-project:mainfrom
rahulvijayaraghavan:req-broadcast-shm-mq
Open

rahulvijayaraghavan wants to merge 1 commit into
sgl-project:mainfrom
rahulvijayaraghavan:req-broadcast-shm-mq

Conversation

@rahulvijayaraghavan

@rahulvijayaraghavan rahulvijayaraghavan commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Once per decode step, TP rank 0 broadcasts the newly received requests to the other ranks over gloo, even when the
list is empty. gloo uses a binomial tree, so the last ranks wait for relays through other ranks, and each hop pays a
thread hand-off plus a socket round trip on cores that have meanwhile dropped into deep idle. The TP group already owns
a shared-memory MessageQueue broadcaster that nothing uses at runtime; this PR sends the request broadcast through it.

flowchart TB
    subgraph gloo["gloo (current): binomial tree, 3 rounds at TP=8"]
        direction LR
        g0((r0)) -->|round 1| g1((r1))
        g0 -->|round 2| g2((r2))
        g1 -->|round 2| g3((r3))
        g0 -->|round 3| g4((r4))
        g1 -->|round 3| g5((r5))
        g2 -->|round 3| g6((r6))
        g3 -->|round 3| g7((r7))
    end
    subgraph shm["shared memory (this PR): one write, every rank polls"]
        direction LR
        s0((r0)) -->|write| ring[/shared-memory ring/]
        ring -.-> s1((r1))
        ring -.-> s2((r2))
        ring -.-> s3((r3))
        ring -.-> s4((r4))
        ring -.-> s5((r5))
        ring -.-> s6((r6))
        ring -.-> s7((r7))
    end
    gloo ~~~ shm
Loading

This matters where the host is on the critical path: in eager mode every rank issues all of the step's kernels, so a
rank that starts late behind the tree delays the whole step, while with CUDA graphs the hosts run ahead of the GPU and
the delay is hidden. vLLM made the same switch by default in vllm-project/vllm#5399 (June 2024, +3.5% on Llama-2-7B
TP=8 / 8xH100) and has kept shared memory as its only path since; as there, no flag is added. gloo is kept only under
--sleep-on-idle, where shared-memory readers would busy-poll while rank 0 sleeps.

Accuracy Tests

No change to model execution; greedy output is identical on the shared-memory path, the gloo fallback and
--sleep-on-idle (Qwen3-8B TP=8, 8x L40S).

Speed Tests and Profiling

8x NVIDIA L40S (PCIe), Qwen3-8B TP=8, bench_serving random 256/256, eager (--cuda-graph-backend-decode disabled),
radix cache off. base = main 2c1e859 vs base + this commit, four alternating pairs, one fresh server per run.

c base tok/s (4 servers) PR tok/s (4 servers) d tok/s base TPOT PR TPOT p99 ITL base -> PR
1 42.8 / 42.9 / 42.1 / 43.0 43.6 / 43.5 / 43.3 / 43.9 +1.9% 23.28 ms 22.84 ms 29.2 -> 27.6 ms
4 159.4 / 160.6 / 159.0 / 160.9 162.4 / 163.6 / 162.3 / 163.9 +1.9% 24.63 24.19 30.3 -> 28.4
16 610.9 / 614.6 / 606.2 / 615.8 623.6 / 624.9 / 622.6 / 629.1 +2.2% 25.04 24.48 31.0 -> 29.1
64 2,121 / 2,110 / 2,099 / 2,144 2,141 / 2,164 / 2,145 / 2,168 +1.7% 26.99 26.51 35.0 -> 32.8

Every PR server is above every base server at every concurrency (run-to-run spread 1-2% on both sides); TPOT -1.8 to
-2.2%, p99 inter-token latency 5-6% lower.

Checklist


CI States

Latest PR Test (Base): ❌ Run #39562741553
Latest PR Test (Extra): ❌ Run #39562741723
Latest PR Test (AMD ROCm 10): ❌ Run #39562741448

@rahulvijayaraghavan rahulvijayaraghavan changed the title [Perf] scheduler: broadcast TP requests via the shared-memory Message Queue instead of gloo Scheduler: broadcast TP requests via the shared-memory Message Queue instead of gloo Oct 15, 2026
detain added a commit to detain/sglang that referenced this pull request Oct 20, 2026
…/deferred/avoid map

- 3A [24-35]: NVFP4 MoE boot sgl-project#39807/sgl-project#40173, block-FP8 TP refine sgl-project#42566, k-pool indexer split sgl-project#43619,
  SM120 skinny GEMM sgl-project#42865/sgl-project#42867, DeepGEMM warmup guards sgl-project#32686/sgl-project#43712, autotune sgl-project#43363/sgl-project#40420,
  mHC overlap sgl-project#42985, FP8-einsum precompile sgl-project#42821.
- 3B [36-43]: PCIe CustomAllreduce VMM sgl-project#44448, EP local expert ids sgl-project#44480, shm TP broadcast sgl-project#44202,
  PCIe-IPC all-gather sgl-project#42863 + multicast guard sgl-project#41888, TP-sampling consistency sgl-project#41916/sgl-project#38565,
  draft embed/lm_head VRAM sgl-project#37155.
- sgl-project#39807 toolchain commit verified safe against our CUDA_HOME=12.9 pin (cu13 fallback needs CUDA_HOME unset AND glibc>=2.41; we are 2.39).
- stack_want.txt: execution-status banner. Branch tip 5dd6ec7.
@rahulvijayaraghavan

Copy link
Copy Markdown
Contributor Author

@hnyls2002 @merrymercy could you take a look? This routes the per-step TP request broadcast through the existing shared-memory MessageQueue instead of gloo (same change vLLM made in vllm#5399). Eager-mode numbers in the description; CI needs the run-ci label

@github-actions

This comment has been minimized.

@rahulvijayaraghavan rahulvijayaraghavan changed the title Scheduler: broadcast TP requests via the shared-memory Message Queue instead of gloo [Perf] scheduler: broadcast TP requests via the shared-memory MessageQueue instead of gloo Oct 21, 2026
…Queue instead of gloo

Keep gloo with --sleep-on-idle, where MessageQueue readers would busy-poll.
@rahulvijayaraghavan

Copy link
Copy Markdown
Contributor Author

@hnyls2002 @ShangmingCai could you please review? Routes the per-step TP request broadcast through the shared-memory MessageQueue instead of gloo; falls back to gloo under sleep-on-idle

@polisettyvarma

Copy link
Copy Markdown
Contributor

/tag-run-ci-label

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants