fix_bf16_latent_moe#8006
Conversation
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-06-04 21:30:43
📋 Review 摘要
PR 概述:为 fused_moe_cutlass_backend 的 apply_ep_prefill 和 apply_ep_decode 方法补全 BF16 Latent MoE 所需的 fc1_latent_proj / fc2_latent_proj 支持。
变更范围:fastdeploy/model_executor/layers/moe/fused_moe_cutlass_backend.py
影响面 Tag:[OP]
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | fused_moe_blackwell_backend.py |
Blackwell 后端 apply_ep_prefill / apply_ep_decode 签名缺少 fc1_latent_proj / fc2_latent_proj,与 cutlass / deepgemm / triton 后端不同步 |
多后端同步说明:
经检查,fused_moe_deepgemm_backend.py、fused_moe_triton_backend.py 均已实现 fc1_latent_proj/fc2_latent_proj 支持,本 PR 修复了 cutlass 后端(EP prefill/decode 路径)的缺失。但 fused_moe_blackwell_backend.py 的 apply_ep_prefill(L613)和 apply_ep_decode(L953)方法签名中仍不含这两个参数。若存在使用 Blackwell 后端运行 Latent MoE 的场景,会导致参数传递失效(base class 路由到 blackwell 时签名不匹配)。建议同步补充或明确说明 Blackwell 后端暂不支持该特性。
📝 PR 规范检查
标题 fix_bf16_latent_moe 缺少官方 Tag,且描述中 ## Motivation、## Modifications、## Usage or Command、## Accuracy Tests 各节均未填写内容。
标题建议(可直接复制):
[BugFix] Fix missing fc1/fc2_latent_proj support in cutlass MoE EP prefill/decode for BF16 Latent MoE
PR 描述建议(点击展开,可直接复制)
## Motivation
BF16 Latent MoE 场景下,`fused_moe_cutlass_backend` 的 `apply_ep_prefill` 和 `apply_ep_decode` 方法未处理 `fc1_latent_proj` / `fc2_latent_proj`,导致 Latent MoE 投影层在 cutlass EP 路径下被跳过,输出结果不正确。
## Modifications
- `fastdeploy/model_executor/layers/moe/fused_moe_cutlass_backend.py`:在 `apply_ep_prefill` 的 gate 之后、dispatch 之前插入 `fc1_latent_proj(x)`;在 combine 之后插入 `fc2_latent_proj`。`apply_ep_decode` 做相同处理。
## Usage or Command
N/A
## Accuracy Tests
N/A
## Checklist
- [x] Add at least a tag in the PR title.
- Tag list: [`[FDConfig]`,`[APIServer]`,`[Engine]`, `[Scheduler]`, `[PD Disaggregation]`, `[Executor]`, `[Graph Optimization]`, `[Speculative Decoding]`, `[RL]`, `[Models]`, `[Quantization]`, `[Loader]`, `[OP]`, `[KVCache]`, `[DataProcessor]`, `[BugFix]`, `[Docs]`, `[CI]`, `[Optimization]`, `[Feature]`, `[Benchmark]`, `[Others]`, `[XPU]`, `[HPU]`, `[GCU]`, `[DCU]`, `[Iluvatar]`, `[Metax]`]
- You can add new tags based on the PR content, but the semantics must be clear.
- [x] Format your code, run `pre-commit` before commit.
- [ ] Add unit tests. Please write the reason in this PR if no unit tests.
- [ ] Provide accuracy results.
- [ ] If the current PR is submitting to the `release` branch, make sure the PR has been submitted to the `develop` branch, then cherry-pick it to the `release` branch with the `[Cherry-Pick]` PR tag.总体评价
本 PR 修复逻辑正确,与 deepgemm/triton 后端的处理方式一致。建议补充 Blackwell 后端的同步处理,并完善 PR 标题及描述后合入。
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8006 +/- ##
==========================================
Coverage ? 66.38%
==========================================
Files ? 468
Lines ? 65934
Branches ? 10171
==========================================
Hits ? 43769
Misses ? 19385
Partials ? 2780
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for your contribution! |
Motivation
Modifications
Usage or Command
Accuracy Tests
Checklist
[FDConfig],[APIServer],[Engine],[Scheduler],[PD Disaggregation],[Executor],[Graph Optimization],[Speculative Decoding],[RL],[Models],[Quantization],[Loader],[OP],[KVCache],[DataProcessor],[BugFix],[Docs],[CI],[Optimization],[Feature],[Benchmark],[Others],[XPU],[HPU],[GCU],[DCU],[Iluvatar],[Metax]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.