Parallelism runtime notes
These implementation constraints and fallback rules apply to parallel serving, communication buffers, and model-specific optimized paths.
Pinned staging buffer lifetimes
Overlap scheduling can prepare the next forward on the CPU while the previous forward's non-blocking host-to-device copies are still in flight. Any pinned CPU staging buffer used for per-step model inputs must therefore have per-step lifetime, or use an explicit synchronization before reuse. This applies to MTP/GDN mamba state indices as well as token, length, and request-pool inputs.
MoE backend padding details
With --moe-backend flashinfer_trtllm, the NVFP4 padding zero-fills the packed weights and block scales in the tail, so the extra dimensions do not change the MoE result. For example, TokenSpeed pads a 640-wide expert under MoE TP4 from 160 to 192 values per rank. For BF16 SiLU/SwiGLU expert shards, Qwen3-30B-A3B's 768-wide experts need no padding under MoE TP4 (192 per rank), while TokenSpeed pads a 96-wide shard to 128.
MoE transport and quantization internals
With --moe-backend mega_moe, MegaMoE replaces routed dispatch, SiTU expert computation, and combine. It keeps routing weights after FC2. MXFP4 experts run FlashInfer's Kimi K3 MegaMoE, which quantizes the BF16 routed rows to MXFP8.
The AG/RS and FlashInfer transports quantize NVFP4 activations before dispatch and transfer their block scales alongside the routing IDs and weights. Combine outputs remain BF16.
Kimi-K3 subgroup communication and fusion layouts
Each sharded computation restores complete outputs to the original token owner:
- QKV: AllGather → column-parallel projection → All-to-All.
- Output projection: All-to-All → row-parallel projection → ReduceScatter.
- Shared expert: AllGather → gate/up → activation → down → ReduceScatter.
The runtime prepares communication buffers before CUDA-graph capture and reuses them across layers. Shared experts use separate buffers. Shared AllGather finishes before routed dispatch, shared GEMMs finish before routed BMM, and shared ReduceScatter runs after dispatch and before combine. With MegaMoE, shared ReduceScatter instead follows its fused dispatch/BMM/combine kernel and overlaps the routed norm and local up-projection.
The BF16 TP4 sparse-MLA QKV-A layout pads 14400 logical outputs to 14592 stored channels and preserves the original order and width of the checkpoint and returned logical outputs. With multicast memory, the 512-row bucket can use 192-channel GEMM tiles on both SM100 and SM103.
BF16 fusion uses BF16 operands directly. Row GEMM partials round to BF16, then sum in FP32 rank order before final BF16 rounding.
DeepEP communication buffer lifecycle
All DeepEP MoE plans reserve their persistent communication buffer during the common moe_process_weights call, after backend weight preprocessing and before KV cache memory profiling. This applies to Marlin, DeepGEMM, and FlashInfer. Non-DeepEP plans do not initialize DeepEP. The input hidden width and global expert count come from the MoE module's declared geometry, never inferred from packed weights. Dispatchers retain their backend-specific execution settings and reuse the prepared buffer. Compatible layers share the process-wide buffer. Incompatible geometry, mode, or capacity fails through the same reuse checks as runtime acquisition.
DeepEP kernel and scale layouts
For block-scale FP8 decode on NVIDIA, the low-latency path keeps routing metadata in DeepEP's required contiguous int64/float32 formats across both collective legs. Ordinary softmax routing selects experts and normalizes their weights in one Triton launch before dispatch, instead of materializing the full softmax and launching separate ATen top-k, reduction, and division kernels. Its fused SwiGLU quantizer writes packed UE8M0 scales directly in DeepGEMM's MN-major TMA layout, so padded rows need no zero-fill and the second expert GEMM needs no separate activation-scale transpose/pack pass. For sparse decode it launches a bounded number of row splits per expert and walks only rows below the device-side expert count. Full-capacity workloads retain one-CTA-per-row parallelism. The host-side expected-row estimate selects between these mappings without synchronizing the expert counts to the CPU. The runtime expands and packs expert weight scales once at weight load, instead of ahead of both expert GEMMs in every layer forward. The runtime queues shared-expert work between the dispatch send and receive legs to overlap the collective whenever the model has a shared expert. Low-latency dispatch asks DeepEP to produce packed UE8M0 scales directly in its column-major TMA layout. Normal-mode dispatch still transports FP32 power-of-two scales, but the existing expert scatter packs them while permuting tokens, so neither mode needs a separate sequence of elementwise shifts, fills, copies, and a transpose before GEMM1.
Dense (128, 128) FP8 projections have two scale contracts against FlashInfer's FP8 block-scale GEMM, and both are copy-free for the layout they own. The canonical K-major contract takes the quant kernel's [M, K/128] activation scales and the checkpoint's [N/128, K/128] weight scales with no layout conversion (the runtime normalizes strided scale views to contiguous first). The prepared MN-major contract, selected at load time on every Blackwell datacenter part, transposes the weight scales once and then consumes the TRT-LLM quantizer's native [K/128, M] activation scales directly, which is what the canonical path would otherwise have to transpose on every call. Both produce bitwise identical output.
MN-major requires M to be a multiple of four, so a prepared layer falls back to the canonical contract once padding would cost more than the transpose it saves — the fused padding quantizer grows with M while the transpose does not. Decode row counts stay on the prepared path.
Collective transport selection
CUDA IPC collectives are node-local. The mnnvl fabric workspace spans nodes. AutoBackend serves single-tensor SUM all-reduces (16-bit, or fp32 where a single-node workspace was armed for it; mnnvl serves 16-bit only) on groups whose fan-in is 2, 4, 8, or 16 through the armed workspace—one-shot inside its traffic window, two-shot up to the workspace token capacity. Where FlashInfer's BT presets cover the group (8 ranks, width 7168, SM103), payloads of at least 1 MiB per rank instead take its owner reduction, which sums the ranks in order in fp32 where the Lamport kernels sum in BF16. For the measurements, see Communication kernels. Cross-node groups arm the full two-shot capacity at startup. Single-node groups start at the one-shot window and serve larger shapes once model-level preparation widens the shared workspace. Other fan-ins and dtypes, and any shape the workspace rejects, fall back to NCCL (inside the trtllm backend for armed groups; the Iris all-reduce tier serves AMD only, where no trtllm workspace exists). Single-node token all-gather/reduce-scatter runs on the Triton RSAG backend and uses NCCL across nodes. Logits all-gather and distributed argmax use the same cross-node fallback. Layouts such as attention DP with dense TP or MoE EP spanning nodes need this fallback.
On the tiered route, Inkling 2's output convolutions sum their producer's partial themselves (all_reduce_sconv) for target-verify decode batches the one-shot mnnvl lane serves: the all-reduce releases the convolution once it has waited for its input rather than at its end, so the convolution's cold reads of its taps, ring and routing run under the reduction. Other batches reduce in the producer with the release at the end.
When the attention TP group is also the MoE EP group and the node has multicast memory, decode batches of up to 8 rows skip both all-reduces: the attention's output projection (publish_projection) and the MoE route fold store each rank's partial straight into slot rank of every rank's Lamport mailbox (ops.communication.mailbox), and the output convolutions read the sum from there (inkling_ring_sconv_mailbox, FP32 in rank order, rounded once). The model builds the mailbox in prepare_communication_runtime; each layer uses both chains or neither, so the two uses alternate the mailbox's parities.
Past 1024 rows, a Kimi-K3 attention layer's BF16 o-projection writes its partial straight into the multimem staging buffer of the MoE tail's up-projection (K3AttnComm.prepare_staged_projection). The sum then runs as the same in-switch all-reduce instead of NCCL. The MoE's shared experts then write their partial straight into the same buffer (K3MoeTailComm.acquire_shared_output), where the tail reduces it. On a layer with an AttnRes prefix the attention's reduced rows are a delta, which AttnRes adds into the residual in place before the MoE starts. Only a block-write layer copies them out, because its residual is the sum itself and outlives the shared partial. Under --batch-invariant-collectives or --force-deterministic-rsag the attention keeps its ordinary all-reduce.
Deterministic collective numerics
Under --numerics rl-bitwise (--batch-invariant-collectives) every reduction takes NCCL data movement plus a rank-ordered fp32 fold, and the gathers stay on the multicast kernels; the in-switch reduction's order moves with a row's offset in the buffer, so it serves only the performance routes. The distributed argmax and the fused all-reduce kernels are off. --force-deterministic-rsag keeps every collective on NCCL (reductions on the fold). AutoBackend.route is the one place that decides. For the measured basis, see Numerics envelopes.
Large GPU DSA sparse prefill sharding
Under plain attention TP with replicated MLA latent KV (no KVP, no query context parallelism), a GPU DSA sparse prefill of at least 4096 rows runs its core attention on a row shard instead of a head shard. An all-to-all hands each rank 1 / W of the rows with every rank's heads (padded to the trtllm-gen core's head count), the core attends them, and a second all-to-all returns each rank's heads of every row. The core then reads each selected KV row once for all heads instead of once per rank. The bitwise numerics envelopes keep the head shard.
Use a fixed NCCL runtime on ARM
On ARM systems, NCCL 2.29.3 fixes a weak compare-and-swap failure that can hang NCCL when it was compiled with GCC older than 10. Affected NCCL builds older than 2.29.3 can exhaust proxy operations during repeated multi-node CUDA graph replay. Use NCCL 2.29.3 or newer for this configuration. Disabling CUDA graphs avoids the affected path, but you do not need it with the fixed NCCL runtime.