inference moe expert sp padding - #4080
Conversation
| expert_parallel_degree: int = 1 | ||
| """Expert parallelism degree for MoE layers. 1 means disabled.""" | ||
|
|
||
| enable_sequence_parallel: bool = False |
There was a problem hiding this comment.
The moe part of change looks good to me. But why we would ever enable SP for generator in general? (I know that we are always using expert sp)
There was a problem hiding this comment.
i added this flag just in case we want to turn on SP for inference later. For uneven inference when dense SP on, vllm model runner will pad the global input for us to make sure it's evenly divided. Therefore I need to pass enable_sp in Compilation Config into vllm.
There was a problem hiding this comment.
Let's separate it in a different PR if it's needed (with symmetric-memory based AG / RS). Right now it doesn't seem to benefit anyone, so let's split the complexity.
There was a problem hiding this comment.
but it we don't do this, if someone run uneven inference when dense SP on, spmd_types will error out. It's not able to turn R -> S(1) due to unevenness. We need to set enable_sp in Compilation Config for vllm model runner to pad.
There was a problem hiding this comment.
if someone run uneven inference when dense SP on
why would they
There was a problem hiding this comment.
you can't control what users would do? why leaving SP + unevenness buggy when we can fix it?
however I admit at this point no user would try this, so doesn't matter.
Stack from ghstack (oldest at bottom):
Summary
Pad MoE inputs to the expert sequence-parallel degree before routing, then
trim the output to its original length. This ensures equal TP shards for
uneven decode batches and removes virtual-padding bookkeeping from token
dispatchers.
Adds a TP=EP=4 vLLM test covering a three-request decode batch and verifying
bitwise decode/prefill parity.
Test Plan