Systems · LLM Inference & RL Infra · MTT S5000

Dissecting MTT S5000

Hardware roofline, multi-stream overlap laws, custom mp_31 MoE/HiCache/Training kernels, PCIe Gen5 KV offloading, MUSA 5.2.0 MT-DeepEP & Mooncake IPC, and native VMM RL sleep-mode on 8× Moore Threads S5000.

Porting NVIDIA inference wisdom verbatim onto non-CUDA silicon fails in predictable ways: you either optimize kernels the vendor already solved, or you import concurrency tricks that run slower than serial execution. Before writing a single line of kernel code on an 8× Moore Threads MTT S5000 (PH100, 4th-gen MUSA mp_31) server, we audited mate 0.2.7, vllm-musa 0.1.24, and sglang-musa from source so we would not re-invent deep_gemm, flash_attn_3, or flash_mla.

What remained was a clear hardware-first engineering gap: no public reproducible roofline for mp_31, no empirical boundary for compute–communication overlap, three silent production killers inside vLLM-MUSA on deep MoE models, and broken or missing building blocks for mp_31 MoE glue kernels, PCIe Gen5 KV offloading, and MUSA 5.2.0 MT-DeepEP. We measured every claim on real silicon, fixed or built each layer from scratch, and open-sourced the full suite at github.com/spyzss/s5000-infra.

8xS5000 Qwen3-30B-A3B-FP8 end-to-end throughput and Graph-Cap reduction

End-to-end 8×S5000 decode throughput on real Qwen3-30B-A3B-FP8 weights (48 layers, 128 experts, Top-8, TP8+EP8, warm-cache back-to-back A/B). Left: fixing MUSA Graph-Cap thrashing recovers 8.0×–29.5× over stock defaults, and hooking our bit-exact custom mp_31 MoE fusion kernels adds another +3.5% to +13.3% across BS=1–64 (peaking at 2,750.2 tok/s at BS=64 and 3,184.5 out / 19,284 total tok/s at BS=128). Right: cold start drops 10.7× (832.8s → 77.6s), graph capture 32.8× (655s → 20s), and graph VRAM >6× (11.7 → <2 GiB/GPU).

TL;DR

  1. Fix the graph cap before touching kernels: Any model with ≥37 layers exceeds MUSA's ~1,900 live graph-exec cap under default vLLM-MUSA piecewise capture (48 × 51 + 51 = 2,499), triggering an 11-minute cold start and a 27× decode collapse. A FULL_DECODE_ONLY geometric budget plus an FX metadata fix for fuse_allreduce_rms—both auto-hooked at runtime via pip install -e . + S5000_OPT_ENABLE=1—restores full speed and frees 64+ GiB VRAM per node.
  2. Overlap on S5000 follows a strict resource boundary: Off-chip PCIe Gen5 DMA overlaps FP8 GEMM/FA3 at +89.4% to ~100%. Intra-node MCCL + mate/deep_gemm suffers -96.6% to -192.9% negative overlap because deep_gemm.set_num_sms is a no-op and floods all 56 MPs and the shared 60 MB L2. Enforcing strict SM disjointness (MT-DeepEP 16 SM + Triton GEMM 40 SM) flips intra-node overlap to +87.4% (1.50×).
  3. Custom mp_31 MoE & DeepGEMM glue kernels move real 8-GPU serving numbers without losing bit-exactness: vllm::silu_and_mul_per_block_quant consumed 6.44% of total GPU time in MUPTI. Five hand-written mp_31 MUSA C++ kernels (eliminating int64 division, exact cancellation-free (g*u)/(1+expf(-g)) FP8 quantization with 0 differing bytes across all finite BF16/FP16 patterns and 0/42.5M live prefill bytes, single-pass Add+RMSNorm+FP8 quant, and mask-safe Ballot-Argmax topk_softmax / grouped_topk) deliver 1.67×–28.1× op speedups (3.70×–3.98× on musa_fused_add_rms_deepgemm_fp8_op at H=2048/7168) and +3.5% to +13.3% (BS=1..64) live 8×S5000 end-to-end throughput via S5000_OPT_ENABLE=1.
  4. Close the two missing ecosystem engines (musa_kvcacheio + MUSA 5.2.0 MT-DeepEP): Staging scattered KV pages (≤512 KiB) through multi-GPU MusaDeviceGuard-safe, stream-synchronized GPU uint4 gather/scatter pools (0/96 concurrent duplex D2H+H2D errors, 0 byte diffs across concurrent 2-GPU transfers) speeds up vLLM's 48-layer per-layer OffloadingHandler by 12.9×–18.3× D2H / 4.3× H2D (and cuts 64K async prefetch TTFT by 23.2× with 24× less VRAM). Rebuilding MT-DeepEP against MUSA 5.2.0 passes 40/40 official tests and beats 8-GPU MCCL by 1.70×–2.67× at decode (T ≤ 128).
  5. Turn one 8×S5000 machine into a complete drop-in AI stack (SGLang, Mooncake IPC, VMM sleep_mode, VeOmni training, and s5000-opt doctor/profile): Beyond 8-GPU vLLM, S5000_OPT_ENABLE=1 unlocks post-grad BF16 FP8 DeepGEMM fusions across all Dense & MoE models (1.77×–2.27× on add_rms_deepgemm, saving 7.3 GiB on single-GPU TP1), repairs SGLang mp_31 HiCache (260.5 ms warm host restore, 100% greedy match), adds offset- & epoch-safe Mooncake MUSA 5.2 MT2 IPC (29.14 GB/s write / 37.56 GB/s read, 6.0×–6.4× batch speedup), implements native MUSA VMM CuMemAllocator for RL sleep_mode (98.62–98.78 GiB freed on TP=2, 1.04s / 370 ms wake, 0 graph recaptures), and ships VeOmni/PyTorch training kernels (1.09×–1.70× SwiGLU, 3.98×–5.82× Vision RoPE beating muDNN up to 1.25×, and 2.08×–2.55× MATE MUBIN MoE Grouped GEMM).

Question Map

# Status Question Answer / Finding
Q1 Answered What does MTT S5000 (mp_31) actually look like under roofline and MTLink microbenchmarks? 56 MPs, 60 MB L2 (3,006 GB/s), 1,335 GB/s HBM, 694.5 TFLOPS FP8, 8.27× eager-vs-graph launch cliff, 35.6 GB/s PyTorch copy_ trap vs. 321 GB/s MCCL A2A, and a 64 MB CAR-vs-MCCL crossover.
Q2 Answered Why does naive multi-stream overlap run slower on S5000, and can we break that curse? deep_gemm.set_num_sms is a no-op and thrashes 60 MB L2 (-96.6%). PCIe DMA gives +89.4%, and SM-disjoint MT-DeepEP (16 SM) + Triton GEMM (40 SM) reaches +87.4% (1.50×).
Q3 Answered What kills production vLLM-MUSA on real 48-layer MoE weights out of the box? Three killers: MUSA cap=1900 graph rotation (832.8s start, 11.1 tok/s BS=8; -7.3 GiB saved on 1-GPU TP1 too), a KeyError: 'val' crash in fuse_allreduce_rms, and silent 18–84s cold prefill JIT spikes.
Q4 Answered After fixing system overhead, can custom mp_31 MoE & post-grad DeepGEMM kernels improve serving? Yes: +5.0% (BS=1), +6.9% (BS=32), and +13.3% (BS=64, -3.10 ms/step) warm A/B on 8×S5000 (0/42.5M FP8 byte diffs), plus 1.77×–2.27× Dense/MoE post-grad add_rms_deepgemm across H ∈ {2048..7168}.
Q5 Answered Can we turn S5000's 1 TiB host RAM and MTLink mesh into production KV offload and EP8 engines? Yes: musa_kvcacheio speeds up ≤512 KiB per-layer vLLM offload up to 18.3× D2H / 4.3× H2D (and 64K TTFT 23.2×); rebuilt MUSA 5.2.0 MT-DeepEP beats 8-GPU MCCL 1.70×–2.67× for T ≤ 128.
Q6 Answered Can one drop-in toolkit unblock SGLang, Mooncake IPC, RL sleep_mode, VeOmni training, & diagnostics? Yes: mp_31 HiCache (260.5 ms warm restore), offset-safe Mooncake MUSA 5.2 IPC (29.1 / 37.6 GB/s), VMM sleep_mode (98.6 GiB freed on TP2, 0 recaptures), VeOmni training ops (1.09×–5.82×), and s5000-opt doctor/profile.
Q7 Planned (Phase 2) How well does this scale across multiple machines? Explore how to improve performance when those machines work together over 8× 400Gbps RoCEv2.

Setup

All single-node measurements ran on one 8× MTT S5000 node (PH100, mp_31, 80 GiB VRAM per GPU = 640 GiB total, 14 MTLink MT2 links up per GPU, 8× 400Gbps ConnectX-7 RoCEv2, dual Intel Xeon Platinum 8558 96C/192T, 1.0 TiB host RAM). Software stack: Driver 5.2.0-server, MUSA Toolkit 5.2.0 (mcc 5.2.0, libmusart.so.5, libmccl 2.11.4, MUPTI 1.3.0), torch 2.11.0.post2, torch_musa 2.11.0.post2, mate 0.2.7, vLLM 0.24.1 (vllm-musa 0.1.24), and mtshmem 3.1.7. Real-weight serving tests used Qwen/Qwen3-30B-A3B-FP8 (48 layers, 128 experts, Top-8, 32 GB FP8 checkpoint).

Code & raw datasets: github.com/spyzss/s5000-infra (Apache-2.0, pip install -e . opt-in autoload + s5000-opt CLI, zero hardcoded paths, 8-stage scripts/verify_phase1.sh).

Full hardware and software baseline record
  • Compute/memory microbench: microbench/01_compute_memory_roofline.py → results/01_roofline.json
  • Interconnect microbench: microbench/02_comm_mtlink_bench.py, 06_car_vs_mccl_crossover.py → results/02_comm_mtlink.json, results/06_car_vs_mccl_crossover.json
  • Overlap suite: microbench/03*.py (03 through 03f) + benchmarks/track3_deepep/bench_overlap_*.py → results/03_overlap_feasibility.json, results/track3_deepep.json
  • Real-weight 8×S5000 serving: microbench/07_real_qwen3_ablation.py, 08_vllm_deepep_smoke.py, 09_vllm_kv_offload_e2e.py, 09b_vllm_offload_handler_microbench.py → results/07_*.json, results/09_*.json
  • Single-GPU serving, post-grad DeepGEMM fusions & CLI (doctor/profile): s5000_opt/{doctor,profiler,cli}.py → results/track_a_single_gpu.json
  • SGLang mp_31 HiCache & Mooncake MUSA 5.2 IPC/RDMA: benchmarks/track4_sglang_mooncake/bench_sglang_hicache_and_mooncake.py → results/track4_sglang_mooncake.json
  • MUSA VMM sleep_mode (TP=1/2) & VeOmni training kernels: benchmarks/track5_vmm_and_train/bench_vmm_sleep_and_train_ops.py → results/track5_vmm_and_train.json

Findings

Q1: What does MTT S5000 (mp_31) actually look like under roofline and interconnect probes?

S5000 has healthy HBM bandwidth (1,334.8 GB/s, 83.4% of spec) and strong FP8 compute (694.5 TFLOPS, ridge at M ≈ 256), but punishes eager kernel launches (8.27× cliff), naive PyTorch P2P copies (35.6 GB/s cap), and uncalibrated AllReduce routing.

Hardware Metric Spec / Topology Measured on 8×S5000 Practical Consequence
Compute & Cache 56 MPs, 60.0 MB L2, 80 GiB VRAM L2 3,006.4 GB/s (≤60 MB); HBM 1,334.8 GB/s Working sets >60 MB drop straight to 1,328 GB/s; L2 is the main contention surface.
GEMM Roofline 1,000 TFLOPS FP8 BF16 379.4 TFLOPS; FP8 DeepGEMM 694.5 TFLOPS FP8 ridge sits at M ≈ 256; M = 1 → 128 takes only 35 → 42 μs.
Launch Overhead MUSA 5.2.0 runtime Eager 16.04 μs/op vs. MUSA Graph 1.94 μs/op 8.27× cliff: any graph break in decode creates immediate CPU-launch bubbles.
MTLink MT2 Mesh 14 links/GPU (7 peers × 2) PyTorch copy_: 35.6 GB/s (even 7 streams); MCCL A2A: 321.1 GB/s bi-dir Never write naive peer copy_ loops; MCCL is 9.0× faster across the mesh.
AllReduce Crossover MusaJitCustomAllreduce vs. MCCL CAR 20.1–21.6 μs (128–512 KB) vs. MCCL 144–201 μs (up to 9.5×) CAR wins cleanly from 4 KB to 32 MB; crossover sits at 64 MB (728 vs. 745 μs).
PCIe Gen5 x16 DMA 2 async copy engines Pinned H2D 56.05 GB/s / D2H 56.79 GB/s Independent of the 56 MPs and L2—ideal for host KV tiering and RDMA.

We also tested vllm_musa's hidden VLLM_MUSA_CUSTOM_AR_VECTOR_LOAD=1 knob on all 8 GPUs: it only helps at 1–2 MB (33.7 μs vs. 66.4 μs) while slowing down decode payloads (4 KB–512 KB) by 1.5×–2.7× (32.5–77.5 μs vs. 20.1–28.6 μs), so leaving the default 0 is strictly better for decode.

Microbenchmark details (01_roofline, 02_comm_mtlink, 06_car_vs_mccl)
  • L2 bandwidth drops from 3,006.4 GB/s (2 × 32 MB) to 1,477 → 1,328 GB/s once buffers exceed the 60.0 MB L2 capacity.
  • Thermal steady-state BF16 GEMM (8192³) settles around 311.5 TFLOPS under the 750W TDP ceiling versus 379.4 TFLOPS burst at M = 512.
  • Raw JSON files: results/01_roofline.json, results/02_comm_mtlink.json, results/06_car_vs_mccl_crossover.json.

Q2: Why does naive compute–communication overlap regress on S5000, and how do we break it?

Blindly overlapping stock mate/deep_gemm or FA3 with intra-node MCCL slows execution down by 32%–49% (-96.6% to -111.0% efficiency). The root cause is twofold: deep_gemm.set_num_sms(N) is a no-op on S5000 (flooding all 56 MPs), and heavy Tensor-Core ops thrash the shared 60 MB L2 against SM-driven MCCL. Enforcing true SM disjointness (MT-DeepEP 16 SM + Triton GEMM 40 SM) flips overlap to +87.4% (1.50×).

MTT S5000 multi-stream compute-communication overlap law

Overlap efficiency η=(Tserial−Tconc)/min⁡(Tcomm,Tcomp)\eta = (T_{\text{serial}} - T_{\text{conc}}) / \min(T_{\text{comm}}, T_{\text{comp}}) across 8 controlled experiments on MTT S5000. Positive bars hide communication behind compute; negative bars run strictly slower than serial execution.

This splits S5000 multi-stream concurrency into three concrete regimes:

  1. Off-chip PCIe Gen5 DMA + heavy compute (+89.4% to ~100%, 1.81×): Independent copy engines bypass both the 56 MPs and L2. This directly powers Track 2 (musa_kvcacheio).
  2. SM-disjoint MT-DeepEP Normal + SM-capped compute (+76.2% to +87.4%, 1.50×): When we verified why deep_gemm.set_num_sms(8) still hung or degraded against MT-DeepEP, we found MoE_Grouped_FP8 ran in 364 μs at 56 SMs and 369 μs at 8 SMs—mate.set_num_mps does not actually cap the launched grid. Switching compute to a persistent Triton GEMM that strictly occupies 56 - ep_sms MPs immediately unlocked +87.4% overlap (1,495.5 → 994.0 μs, 1.50×) vs. MCCL's +45.3% on the exact same GEMM.
  3. Uncapped mate / deep_gemm + intra-node MCCL (-96.6% to -192.9%): Even leaving 36/56 MPs idle in a persistent GEMM still regressed -192.9% against MCCL (0.74×) due to L2 and memory-pipeline contention, and tuning MCCL_ACE_LARGE_SIZE_THRESHOLD=0 or MCCL_MAX_NCHANNELS=4 did not rescue it.
Overlap experiment record (03*.py and track3_deepep.json)
  • FP8 GEMM (4K) + PCIe Pinned H2D (32 MB): serial 1.206 ms → concurrent 0.667 ms (1.81×, +89.4%).
  • MT-DeepEP Normal_CombBF16 (16 SM) + Triton Persistent GEMM (40 SM): serial 1,495.5 μs → concurrent 994.0 μs (1.50×, +87.4%).
  • MT-DeepEP Normal_DispFP8 (8 SM) + Triton Persistent GEMM (48 SM): serial 2,243.7 μs → concurrent 1,872.8 μs (1.20×, +76.2%).
  • MT-DeepEP Low-Latency uses 1,024-thread blocks with intra-GPU grid barriers and cross-GPU spin-wait; 2-stream overlap against uncapped 56-SM GEMM deadlocks on async_finish=True or degrades, whereas DualPipe hook hiding (send → GEMM → recv_hook) yields a clean +14.8% (1.07×).
  • Raw records: results/03_overlap_feasibility.json, results/track3_deepep.json.

Q3: What breaks production vLLM-MUSA on real 48-layer MoE weights out of the box?

Three non-obvious system bugs dominate before any kernel optimization matters: a MUSA live graph cap (~1,900) that thrashes every ≥37-layer model, an FX metadata bug crashing fuse_allreduce_rms=True, and unlogged 18–84s cold prefill shape JIT compilations.

  1. MUSA Graph-Cap (cap=1900) rotation (patches/0002 + s5000_opt/graph_budget.py): Default vLLM-MUSA captures 51 piecewise sizes plus 51 full graphs. On a 48-layer model (Qwen3-30B-A3B), 48×51+51=2,499>1,90048 \times 51 + 51 = 2{,}499 > 1{,}900, triggering torchada graph-exec rotation: 655s capture, 832.8s cold start, 11.72 GiB/GPU graph VRAM, and online decode collapse (BS=1: 6.8 tok/s, BS=8: 11.1 tok/s—slower than BS=32!). Auto-budgeting MUSAPlatformBase.apply_config_platform_defaults to FULL_DECODE_ONLY with geometric capture sizes (strictly enforcing estimate_musa_graphs(...) <= safe_cap) cuts capture to 20s (32.8×), cold start to 76.4s (10.9×), frees 9.7 GiB/GPU (+77 GiB/node), and preserves native MUSA fused_add_rms_norm priority instead of Piecewise mode's forced VLLM_MUSA_CUSTOM_OP_USE_NATIVE=1 fallback.
  2. Upstream fuse_allreduce_rms crash (patches/0001 + runtime guard): MUPTI showed AllReduce + fused_add_rms_norm taking ~18% of decode GPU time, yet enabling fuse_allreduce_rms=True crashed VllmIRLoweringPass with InductorError: KeyError: 'val'. Root cause: _manual_rewrite_residual_musa_jit_car_rmsnorm in vllm_musa/_inductor/musa_allreduce_rms_fusion.py omitted node.meta["val"] on newly inserted FX nodes. Propagating fake-tensor metadata across both rewrite paths (and auto-repairing unpatched vllm-musa at runtime under S5000_OPT_ENABLE=1) fixes compilation cleanly and yields +2.1% to +3.3% steady-state gain.
  3. Silent first-prefill JIT cliff (scripts/warmup_prefill_shapes.py): Even after DeepGEMM warmup: 746/746 and zero Triton jit_monitor warnings, the first unseen prefill length (BS=8, 5,168 tokens) silently compiles for 18–84s before settling to 3.26s warm. Bucketed pre-traffic warmup removes the tail spike completely.
2×2 ablation record on real Qwen3-30B-A3B-FP8 (8×S5000 TP8+EP8)
  • Stock Default (51 sizes, cap=1900 thrashing): init 832.8s (capture 655s), 11.72 GiB VRAM, BS=1: 6.8 tok/s, BS=8: 11.1 tok/s.
  • Opt A (FULL_AND_PIECEWISE 12 sizes, no AR+RMS): init 84.8s, 3.75 GiB, BS=1: 51.3, BS=8: 314.1, BS=32: 1,067.6, BS=64: 2,335.3, BS=128: 3,183.7 tok/s.
  • Opt B (FULL_AND_PIECEWISE 12 sizes + fixed fuse_ar_rms): BS=32: 1,090.2 (+2.1%), BS=64: 2,412.6 (+3.3%), BS=128: 3,231.4 (+1.5%).
  • Opt D (FULL_DECODE_ONLY 12 sizes + fixed fuse_ar_rms, warm control): init 77.5s, <2 GiB, BS=1: 51.6, BS=8: 316.1, BS=32: 1,332.0 (+22% over Piecewise), BS=64: 2,427.4, BS=128: 3,179.6 tok/s.
  • Raw files: results/07_real_*.json, results/vllm_qwen3_tp8_mupti/profiler_out_0.txt.

Q4: After system fixes, can custom mp_31 MoE fusion kernels move real 8-GPU serving numbers?

Yes. MUPTI revealed that vllm::silu_and_mul_per_block_quant alone took 6.44% of total GPU time (8.10% including the colmajor Triton path). Replacing MoE and DeepGEMM glue bottlenecks with five bit-exact, hand-tuned mp_31 MUSA C++ kernels adds another +3.5% to +13.3% end-to-end throughput (BS=1..64) on 8×S5000.

Track 1 custom mp_31 MoE fusion kernels speedup and 48L glue budget

Left: fused_silu_mul_fp8_block_quant speedup over vllm::_C.silu_and_mul_per_block_quant under MUSA Graph replay (1.67× → 28.1×, peaking at 1,007.8 GB/s, 0 differing FP8 bytes / scales). Right: combined 48-layer Qwen3-30B-A3B MoE glue latency per layer (1.89× at BS=8, 2.56× at BS=32, 4.23× at BS=128).

Writing native MUSA C++ (mcc --offload-arch=mp_31 + tvm_ffi) surfaced three architecture-specific mp_31 rules—plus an important numerical-exactness lesson caught during independent audit:

  • Eliminate non-power-of-2 int64 division: Moving from 1D flattened modulo indexing to 2D grid tiling doubled effective memory bandwidth (538 → 1,287 GB/s).
  • Avoid tanhf(0.5f * x) and -ffast-math for FP8 SiLU despite SFU shortcuts: Our initial prototype followed vendor kernels in using 0.5*g*(1 + tanhf(0.5*g)), which had cos = 0.99999994 on standard Gaussian inputs—yet suffered catastrophic cancellation on negative gates (g ∈ [-30, -5], causing 27.6% FP8 byte divergence on extreme activations) and flipped greedy token #2 on Qwen3-30B-A3B-FP8. Compiling without -ffast-math and using cancellation-free (g * u) / (1.0f + expf(-g)) (matching Triton's exp2f(-g * kLog2E) on narrow_silu_mul=True for colmajor ue8m0=False/True, min_scaling_factor = 1/(448*512), and scale_ub clamped on group_scale) achieves 0 differing FP8 bytes & 0 differing FP32 scale bits across all 65,280 finite BF16 patterns, all 63,488 finite FP16 patterns, and 4096×1536 random FP16/BF16 sweeps (0 / 42.5M differing FP8 bytes on live 8-rank × 48-layer prefill; results/07_real_full_arrms1_phase15.json matches 07_real_full_decode_ar_rms_fused.json across the first 52 greedy TP8+EP8 tokens before diverging at token 53, whereas repeated unpatched TP8+EP8 runs themselves diverge across runs—e.g. at token 5 between 07_real_full_arrms1_ctrl_warm.json and 07_real_full_decode_ar_rms_fused.json, and at token 54 across back-to-back single-prompt audit runs) while keeping 28.1× speedup over vllm::_C and full +13.3% BS=64 E2E gain.
  • Mask-safe Ballot-Argmax (__ballot_sync/__ffs) for Top-K & Grouped Top-K routing: Replaces (val, idx) warp butterflies using an available-slot bitmask (compiled without -ffinite-math-only so -inf/NaN masked experts never produce duplicate IDs), generalizes fused_topk_softmax_renorm to E ∈ {8, 16, 32, 64, 128, 256} and K ∈ {1, 2, 4, 6, 8}, adds MUSA-Graph-safe fused_grouped_topk (E ∈ {128, 256}, sigmoid/softmax + correction_bias) for DeepSeek-V3/R1 and Qwen3.5 MoE, and fuses topk + renorm + moe_align_block_size (E=128, K=8) into a single CTA (1.62×–1.86× Graph, 3.41×–5.12× Eager).

Wired into all 8 vLLM-MUSA workers via our zero-touch hook (S5000_OPT_ENABLE=1, s5000_opt/vllm_patch.py), real back-to-back warm A/B serving on Qwen3-30B-A3B-FP8 improves monotonically across all batch sizes:

Batch Size Phase 1 Warm Control Phase 1.5 (+ mp_31 MoE Kernels) Warm A/B Gain Step Latency Saved
BS = 1 51.6 tok/s (19.38 ms) 54.2 tok/s (18.45 ms) +5.0% (8.0× vs. stock) -0.93 ms/step
BS = 8 316.1 tok/s (25.31 ms) 327.3 tok/s (24.44 ms) +3.5% (29.5× vs. stock) -0.87 ms/step
BS = 32 1,332.0 tok/s (24.02 ms) 1,424.1 tok/s (22.47 ms) +6.9% -1.55 ms/step
BS = 64 2,427.4 tok/s (26.37 ms) 2,750.2 tok/s (23.27 ms) +13.3% -3.10 ms/step
BS = 128 3,179.6 tok/s (40.26 ms) 3,184.5 tok/s (40.20 ms) +0.2% (19,284 total tok/s) -0.06 ms/step
Per-kernel verification and benchmark record (track1_moe_fusion.json)
  • fused_moe_weighted_sum: 2.29×–3.71× vs. weighted torch.sum (2.78×–3.07× at decode BS=8..32), 1.14×–1.15× vs. vllm_musa fast sum, up to 1,822.8 GB/s, bit-exact under MUSA Graph.
  • fused_silu_mul_fp8_block_quant: 1.74×–19.53× (N=768) up to 28.10× (N=2048, 1,007.8 GB/s) vs. vllm::_C, 1.09×–1.18× faster on musa_silu_deepgemm_fp8_op, and 1.38×–1.41× lower eager latency than vllm_musa's jit_quant_v2 at M ≤ 256 (automatically delegating M > 256 to jit_quant_v2's multi-row-tiled kernel, which leads inside MUSA Graphs at M ≥ 512); 0 differing FP8 bytes and 0 differing FP32 scale bits across all 65,280 finite BF16, 63,488 finite FP16, scale_ub, and Triton colmajor(ue8m0=False/True) sweeps, plus 0 / 42.5M differing FP8 bytes on live 8-rank × 48-layer Qwen3-30B-A3B-FP8.
  • fused_add_rmsnorm_fp8_group_quant: 1.50×–1.81× vs. vllm_musa JIT norm+quant (1.75×–4.04× vs. _C, 1,401.9 GB/s), supporting simultaneous FP8 + BF16 dual output and accelerating musa_fused_add_rms_deepgemm_fp8_op by 3.70×–3.98× on H=2048/7168 and 1.11×–1.14× on H=4096.
  • fused_topk_softmax_renorm, fused_topk_renorm_align, & fused_grouped_topk: generalized E ∈ {8..256}, K ∈ {1..8} topk_softmax and E ∈ {128, 256} grouped_topk hooked online; single-CTA fused_topk_renorm_align (1.62×–1.86× Graph, 12.80–17.68 μs, 3.41×–5.12× Eager) provided via library API.

Q5: Can we close S5000's two missing engine pieces: PCIe Gen5 KV offloading and MUSA 5.2.0 MT-DeepEP?

Yes—and both uncover concrete architectural boundaries that determine how to route transfers in production.

Track 2: musa_kvcacheio — Turning 1 TiB Host RAM + PCIe Gen5 into a 23× TTFT Accelerator

MUSA 5.2.0 musaMemcpyBatchAsync does not coalesce scattered descriptors (10–11.8 GB/s), and stock vLLM 0.24.1's SingleDirectionOffloadingHandler drops to 1.81 GB/s D2H / 7.95 GB/s H2D on standard 48-layer per-layer KV caches (8 KB/block, TP8 block_size=16). We built musa_kvcacheio (kernels/musa_kvcacheio/), a pure extern "C" ABI MUSA library (immune to PyTorch C++ ABI drift) that gathers/scatters scattered pages on GPU at 1,319 GB/s (uint4) and moves contiguous slabs over bulk 56 GB/s PCIe Gen5 DMA.

Track 2 musa_kvcacheio vLLM 48L handler bandwidth and 48L async prefetch TTFT

Left: live vLLM 0.24.1 SingleDirectionOffloadingHandler on 48-layer per-layer KV (201.3 MB), showing 12.9×–18.2× D2H and 4.3× H2D gains (bit_exact = True). Right: 48-layer real Qwen3-30B-A3B-FP8 (deep_gemm + FA3) double-buffered async prefetch achieving 6.5× / 12.9× / 23.2× TTFT speedup at 16K / 32K / 64K with 24× less KV VRAM.

Honest boundary caught during live 8×S5000 testing (microbench/09_vllm_kv_offload_e2e.py): when vLLM 0.24.1 uses its FA3 cross-layer packed layout (block_size=64), a single block is already 1.5 MB, so stock bulk DMA already reaches 35.7 / 39.5 GB/s (3.0× steady-state TTFT speedup on evicted 15.3K docs: 450 ms → 149–153 ms). Our vllm_patch.py hook therefore auto-routes unpadded page_bytes < 256 KB → musa_kvcacheio Mode B (with RAII per-GPU MusaDeviceGuards, thread-safe HostThreadPool, and stream-synchronized StagingPools so concurrent multi-GPU and bidirectional D2H+H2D streams never race—verified 0 / 96 duplex corruptions across 32/128/512 pages × 48 layers and 0 byte diffs across 24 paired 2-GPU Subcase B2 iterations; per-layer / PagedAttention / SGLang: 12.9×–18.3× D2H, standalone Mode B up to 51.8–52.2 GB/s) while delegating ≥ 256 KB cross-layer blocks and padded hybrid-attention KV groups → native vLLM transfer with zero regression.

Track 3: Rebuilding MT-DeepEP for MUSA 5.2.0 and the 8×S5000 EP8 Crossover Law

The container's preinstalled deep_ep and mtshmem transports linked legacy libmusart.so.4, failing on import under MUSA 5.2.0. Our 5-file patch (patches/0003-mt-deepep-musa52-build.patch) compiles MooreThreads/MT-DeepEP cleanly against libmusart.so.5 + static libnvshmem_{host,device}.a with guarded single-node P2P (NVSHMEM_IB_ENABLE_IBGDA=0 NVSHMEM_REMOTE_TRANSPORT=none, automatically configured alongside third_party/MT-DeepEP under S5000_OPT_ENABLE=1), passing 24/24 test_intranode.py, 16/16 test_low_latency.py, and booting live 8-GPU vLLM-MUSA (all2all_backend="deepep_low_latency").

8xS5000 full-mesh EP8 latency crossover between MT-DeepEP and MCCL

8×S5000 full-mesh EP8 combine latency (E=128, K=8) across T = 1..2048. Low-Latency MT-DeepEP dominates decode (T ≤ 128) by 1.70×–2.67× (H=2048) and 1.43×–2.08× (H=7168), while 8-rank MCCL overtakes 20-SM MT-DeepEP Normal at T ≥ 512.

This yields a crisp hybrid EP8 routing policy for 8×S5000:

  • Decode (T ≤ 128): MT-DeepEP Low-Latency (24.7–64.6 μs combine, 1.70×–2.67× faster than MCCL).
  • Standalone Prefill (T ≥ 512): MCCL All-to-All (341–417 μs vs. 764–777 μs for 20-SM Normal Mode across 7 peers).
  • Overlapped Chunked Prefill: MT-DeepEP Normal (8–16 SM) + SM-disjoint GEMM (40–48 SM) (+76.2% to +87.4% true overlap).
Track 2 & Track 3 reproducibility and verification records
  • Track 2 correctness (kernels/musa_kvcacheio/test_correctness.py): 100% torch.equal=True across Mode A, Mode B (contiguous, host-contig, both-scattered), strided vLLM/SGLang wrappers, and 48-layer 240-handshake async stress test. Raw JSON: results/track2_kvcacheio.json, results/09_handler_48l_ab.json, results/09_kv_offload_*.json.
  • Track 3 8-GPU EP8 benchmark (benchmarks/track3_deepep/bench_ep8_fullnode.py): H=2048, T=1 LL Disp 35.8 μs (2.22×), LL Comb 24.7 μs (2.67×); H=7168, T=1 LL Disp 41.3 μs (1.69×), LL Comb 32.8 μs (2.08×). Raw JSON: results/track3_ep8_fullnode.json, results/track3_deepep.json.

Q6: Can one drop-in toolkit unblock single-GPU serving, SGLang, Mooncake IPC, RL sleep_mode, and VeOmni training?

Yes—and adversarial real-silicon auditing uncovered two severe driver-level silent data corruption traps (MUSA 5.2 IPC sub-slice base handles and dirty recycled VMM pages) that any S5000 infrastructure stack must explicitly guard against.

Mooncake MUSA 5.2 IPC bandwidth and S5000 post-grad & training operator speedups

*Left: rebuilt Mooncake MUSA 5.2 MT2 IPC bandwidth—async per-device stream batching plus muMemGetAddressRange_v2 offset resolution speeds up 64×64 KiB slice batches 6.0×–6.4× (9.78 / 10.32 GB/s) and reaches 29.14 GB/s write / 37.56 GB/s read at 32 MiB (0 byte diffs). Right: custom mp_31 post-grad DeepGEMM and VeOmni/PyTorch training operator speedups (1.31×–5.82×).*

When teams receive a fresh 8×S5000 node, they rarely stop at 8-GPU vLLM serving: they run single-GPU TP=1 workloads, SGLang with host-RAM hierarchical KV caching (HiCache), Mooncake KV transfer, co-located RL rollout/training (sleep_mode), and VeOmni multimodal MoE training—nearly all of which fail out of the box due to unmaintained PTX/DLPack assumptions, libmusart.so.4 ABI drift, or missing VMM allocators. We closed all five gaps under the same S5000_OPT_ENABLE=1 autoload hook:

  1. Single-GPU TP=1, Full BF16 FP8 Post-Grad Fusions & s5000-opt doctor/profile (results/track_a_single_gpu.json):
    • Stock vllm-musa restricted MusaRMSDeepGemmFusionPass and MusaSiluDeepGemmFusionPass behind narrow MoE checks and cloned residuals on out-of-place graphs. Adding an out-of-place residual_out pointer to fused_rmsnorm_fp8_quant.mu (plus strict row_major_scales, !e8m0, 16B alignment, and PassManager.uuid() cache isolation) unlocks post-grad DeepGEMM fusions across all BF16 FP8 mp_31 Dense & MoE models: 1.77×–2.27× vs. unfused on add_rms_deepgemm across H ∈ {2048, 2560, 4096, 5120, 7168} (including 1.02×–1.11× over stock on H=4096) and 1.24×–1.41× on silu_deepgemm. On single-GPU TP=1 Qwen3-30B-A3B-FP8, auto-budgeting saves 7.3 GiB VRAM (71.8 → 64.5 GiB, init 64.1s → 48.6s) while serving 71.8 / 459.5 / 1,127.0 / 1,501.8 out tok/s (BS=1/8/32/64), and musa_kvcacheio extends contiguous-host KV offload up to ≤512 KiB (+29%–72% on 256–512 KiB pages).
    • s5000-opt doctor inspects MUSA 5.2 libraries, PCIe Gen5 link widths, VMM/DMA-BUF/mt_peermem RoCEv2 readiness, and deep_ep/mooncake ABIs in one command; s5000-opt profile attributes PrivateUse1 MUPTI kernel durations across eager launches vs. graph replays.
  2. SGLang mp_31 HiCache, Shared Graph-Cap & Offset-Safe Mooncake MUSA 5.2 IPC (patches/0004..0005, results/track4_sglang_mooncake.json):
    • Upstream SGLang hicache failed on mp_31 with 20 mcc errors from inline CUDA PTX ld.global.L1::no_allocate and kDLCUDA checks, and host::LaunchKernel omitted musaSetDevice (crashing with illegal memory access whenever musa:1 tensors were launched from current_device() == 0). Our native mp_31 HiCache kernel (kernels/sglang_hicache/, patches/0004) adds RAII MusaDeviceGuards + cross-GPU checks, passes 10/10 upstream test_hicache.py tests, clamps shared decode/piecewise/speculative graphs to cap=1750, and restores 752 evicted host-RAM tokens on live Qwen3-30B-A3B-FP8 in 260.5 ms warm (61.4 tok/s, 100% greedy token match; uncached BS=4: 237.9 tok/s).
    • Silent corruption trap #1 (MUSA 5.2 IPC sub-slices): On MUSA 5.2, calling musaIpcGetMemHandle(&handle, base + offset) on a PyTorch Caching Allocator sub-tensor exports a handle to the underlying musaMalloc allocation base + 0. Naive NvlinkTransport relocation dropped offset, returning rc = 0 while silently overwriting Layer 0! Resolving (base_ptr, base_offset) via muMemGetAddressRange_v2 with refcounted handle deduplication, POSIX shm atomic epochs for freed/re-registered buffers, and per-device non-blocking stream batching fixes both corruption classes (0 byte diffs) and lifts 64 × 64 KiB batch IPC 6.0×–6.4× (1.62 → 9.78 GB/s write / 10.32 GB/s read; 32 MiB MT2 IPC hits 29.14 GB/s write / 37.56 GB/s read alongside 400Gbps RoCEv2 RDMA).
  3. Native MUSA VMM sleep_mode for RL & VeOmni Training Operators (kernels/musa_vmm/, kernels/train_ops/, results/track5_vmm_and_train.json):
    • vllm-musa advertises is_sleep_mode_available() -> True, yet vLLM's CuMemAllocator fails immediately on MUSA. Even though S5000 supports full driver VMM (VMM_SUPPORTED=1), multi-GPU TP=2 P2P (MusaJitCustomAllreduce / MCCL) faults unless muMemSetAccess grants PROT_READWRITE across all peer GPUs—and silent corruption trap #2 appeared on live TP=2 wake: muMemCreate returned recycled physical VRAM pages containing 1.58e8–3.17e8 non-zero dirty values per layer into discarded KV caches, which vllm_musa FlashAttention 3 read into attention output and turned greedy English into gibberish! Asynchronously zeroing (musaMemsetAsync) newly mapped unbacked regions on wake and synchronizing only active MUSA primary contexts (muDevicePrimaryCtxGetState) yields rock-solid TP=2 Qwen3-30B-A3B-FP8 sleep/wake: Level-1 frees 98.62 GiB (49.31 GiB/GPU, wake 1.04s) and Level-2 frees 98.78 GiB (sleep 148 ms, wake 370 ms, weight reload 19.74s) with 100% greedy token match and 0 MUSA Graph recaptures.
    • For VeOmni and PyTorch training, three native mp_31 autograd operators close key operator gaps: overflow-safe fused_swiglu (1.09×–1.70× fwd+bwd across aligned 4096×4096 and unaligned 1025×1537), 128-bit vectorized fused_vision_rope_3d supporting non-contiguous Qwen3-VL/Qwen3.5 qkv.unbind() views (3.98×–5.82× vs. eager and up to 1.25× faster than VeOmni muDNN), and MATE MUBIN musa_moe_grouped_gemm with GPU-resident expert counts (2.08×–2.55× fwd+bwd vs. eager, 4.2×–10.7× faster than torch._grouped_mm on raw primitives).

Takeaways & Phase 2 Roadmap

  • Measure hardware invariants before writing kernels: On MTT S5000, the single highest-leverage fix (cap=1900 graph budgeting + fuse_allreduce_rms) was a systems bug worth 10× cold start and 8×–29× latency before touching a line of MUSA C++.
  • Respect the 60 MB L2 and 56-MP boundaries: Never overlap uncapped mate/deep_gemm with intra-node MCCL; reserve overlap for independent PCIe Gen5 DMA (+89.4%–100%) or strictly SM-disjoint MT-DeepEP + GEMM (+87.4%).
  • Verify vendor/driver edge cases adversarially on real multi-GPU silicon: Passing single-GPU unit tests is not enough—MUSA 5.2 IPC sub-slice base handles (muMemGetAddressRange_v2), missing LaunchKernel device guards on musa:1, and dirty recycled muMemCreate VMM pages all fail or silently corrupt multi-GPU workloads unless explicitly tested and guarded.
  • Build drop-in production leverage: Packaging vLLM, SGLang, Mooncake IPC, VMM sleep_mode, VeOmni training kernels, and s5000-opt doctor/profile behind a single opt-in pip install -e . + S5000_OPT_ENABLE=1 autoload hook makes an entire 8×S5000 node productive on day one.

Next, I hope to extend this work to multiple machines and make them work together more efficiently.

Citation

@misc{sheng2026s5000infra,
  author = {Sheng, Pingyue},
  title  = {Dissecting MTT S5000: Hardware Roofline, Overlap Laws, Custom mp\_31 Kernels, and Full-Stack LLM/RL Infrastructure},
  year   = {2026},
  url    = {https://ravenembodied-blog.chengpy23.workers.dev/posts/dissecting-mtt-s5000}
}