vllm.models.deepseek_v41.nvidia.specialized_decode.moe.step
¶
The MoE of a specialized decode step.
Every MoE layer whose experts can stop after GEMM2 leaves its routed top-k reduction, the shared-expert add and the all-reduce to the next boundary's fused kernel, including the layers before an Engram layer and the last one, whose boundaries take the kernel's residual-only variant:
- up to
LOW_BATCH_MAX_ROWSrows, on the low-batch routed-expert GEMMs (routed_expert_gemm); - above that, on the runner's own
_forward_implwith the deferral raised to the step's rows for the call (deferred_finalize).
Classes:
-
MoEStep–One MoE layer of the decode step.
Functions:
-
deferred_finalize–Within the block, let the experts leave the top-k reduction of calls of
-
defers_finalize–Whether
ffn's experts can leave the top-k reduction to the fused
MoEStep
¶
One MoE layer of the decode step.
Methods:
-
run–The layer's TP-partial output, unfinalized where it can defer.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/moe/step.py
_forward_low_batch(gemm, hidden_states, input_ids)
¶
The runner's _forward_impl with the routed experts on the
low-batch GEMMs; the gate and the shared experts run as the runner runs
them. Returns the unfinalized routed output and the shared output.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/moe/step.py
run(x, input_ids, step)
¶
The layer's TP-partial output, unfinalized where it can defer.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/moe/step.py
deferred_finalize(config, max_num_tokens)
¶
Within the block, let the experts leave the top-k reduction of calls of
up to max_num_tokens tokens to the caller; then restore the layer's own
deferral, which the stock forward reads.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/moe/step.py
defers_finalize(ffn, max_num_tokens)
¶
Whether ffn's experts can leave the top-k reduction to the fused
all-reduce + mHC: the modular TRT-LLM MXFP4 experts without routed scaling,
on a TP-only deployment.