vLLM 中朴素 DP/EP 的 MoE 分发与合并实现
该文档介绍 vLLM 融合 MoE 层在数据并行与专家并行场景下的朴素 prepare/finalize 实现,分为模块化与单体两类,均借助 Torch 的 all-reduce 或 reduce-scatter 完成分发与合并。
## `vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep` [¶](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep>) 类 : - **`[MoEPrepareAndFinalizeNaiveDPEPModular](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep.MoEPrepareAndFinalizeNaiveDPEPModular>)`** – Dp/Ep 模块内核的直觉准备/完成 。 - **`[MoEPrepareAndFinalizeNaiveDPEPMonolithic](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep.MoEPrepareAndFinalizeNaiveDPEPMonolithic>)`** – Dp/Ep 模块内核的直觉准备/完成 。 ## `MoEPrepareAndFinalizeNaiveDPEPModular` [¶](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep.MoEPrepareAndFinalizeNaiveDPEPModular>) 基础 : `[FusedMoEPrepareAndFinalizeModular](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/modular_kernel/#vllm.model_executor.layers.fused_moe.modular_kernel.FusedMoEPrepareAndFinalizeModular>)` Dp/Ep 模块内核的直觉准备/完成 。 用于调度/通信操作的火炬AR / RS或AR,适用于顶重和ID. 方法: - **`[prepare](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep.MoEPrepareAndFinalizeNaiveDPEPModular.prepare>)`** – 量身定做和调度Topk重量和Topk Ids. ### `_comm_region()` [¶](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep.MoEPrepareAndFinalizeNaiveDPEPModular._comm_region>) 范围 调度/通信 集体运行 。 如果没有 DBO , 集体运行在调用流上。 在 DBO 下, 它运行在 Comm 流上, 因此在飞行时对等的 ubatch 可以进行计算, 使用 DeepEP- HT 相同的计算/comm 交接 。 Graph 捕获将每个集体保留在捕获流上, 因此重叠仅限于急切的步骤( 预补) 。 ### `prepare(a1, topk_weights, topk_ids, num_experts, expert_map, apply_router_weight_on_input, quant_config, defer_input_quant=False)` [¶](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep.MoEPrepareAndFinalizeNaiveDPEPModular.prepare>) 量身定做和调度Topk重量和Topk Ids. ## `MoEPrepareAndFinalizeNaiveDPEPMonolithic` [¶](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep.MoEPrepareAndFinalizeNaiveDPEPMonolithic>) 基础 : `[FusedMoEPrepareAndFinalizeMonolithic](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/modular_kernel/#vllm.model_executor.layers.fused_moe.modular_kernel.FusedMoEPrepareAndFinalizeMonolithic>)` Dp/Ep 模块内核的直觉准备/完成 。 使用火炬AR / RS或AR进行调度/通信操作,应用于路由器日志(MoE内核内部运行路由器). 方法: - **`[prepare](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep.MoEPrepareAndFinalizeNaiveDPEPMonolithic.prepare>)`** – 量化和发送路由器日志。 - **`[prepare_routed](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep.MoEPrepareAndFinalizeNaiveDPEPMonolithic.prepare_routed>)`** – 量化并发送顶重和ID,而不是对数. ### `prepare(a1, router_logits, quant_config, defer_input_quant=False, a1_scale=None)` [¶](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep.MoEPrepareAndFinalizeNaiveDPEPMonolithic.prepare>) 量化和发送路由器日志。 ### `prepare_routed(a1, topk_weights, topk_ids, quant_config, defer_input_quant=False)` [¶](<https://docs.vllm.ai/en/latest/api/vllm/model_executor/layers/fused_moe/prepare_finalize/naive_dp_ep/#vllm.model_executor.layers.fused_moe.prepare_finalize.naive_dp_ep.MoEPrepareAndFinalizeNaiveDPEPMonolithic.prepare_routed>) 量化并发送顶重和ID,而不是对数. 11月 30, 2026 (英语).
查看原始来源