perf(server): reduce MoE expert-compute IPC overhead#388
Draft
weicj wants to merge 3 commits into
Draft
Conversation
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
This PR reduces cross-backend MoE expert-compute IPC overhead by batching prefill remote-expert work instead of inheriting the local hot-stack safety slice granularity. In the 4248 prompt / 128 completion checks below, the batched path cuts IPC calls by about
91-92%and payload by about48-97%.Because the best request shape depends on remote backend compute and memory headroom,
autodefaults to the batched path while explicitstreamkeeps the conservative small-request path available.Changes
f32,f16,bf16).DFLASH_MOE_EXPERT_COMPUTE_IPC_MODE=auto|batched|stream;autouses the batched path and explicitstreamkeeps the conservative path available.DFLASH_MOE_EXPERT_COMPUTE_IPC_TRANSPORT=stream|shared|autoas the payload transport selector, separate from execution granularity.Notes
Mode behavior:
auto/batched: batches remote expert compute over the prefill chunk, capped byDFLASH_MOE_EXPERT_COMPUTE_IPC_BATCH_CAPACITY.stream: follows the small hot-stack safety slices, typically up to 4 prefill tokens per remote expert-compute call on this path.Empirical cases, 4248 prompt / 128 completion prefill check:
streamauto/batched290422657-90.9%612.430 MiB317.346 MiB-48.2%290202280-92.1%612.370 MiB17.943 MiB-97.1%On dual Pro VII, batched mode significantly reduced prefill IPC traffic and reduced prefill time from
40.93sto27.74s(-32.2%), while decode throughput stayed effectively flat (18.6 -> 18.5 tok/s). This is still a policy tradeoff rather than a universal win/loss: if the remote backend is too weak, batched mode can expose the remote-compute ceiling and increase prefill time, as shown by the Pro VII + P4 check from41.64sto81.20s(+95.0%). This is why the PR keeps explicitstreammode available instead of removing the conservative path.