Skip to content

[Cherry-Pick] [BugFix] fix all reduce fusion accurate issue (#7923)#7922

Open
BingooYang wants to merge 2 commits into
PaddlePaddle:release/2.6from
BingooYang:allreduce_acc_issue
Open

[Cherry-Pick] [BugFix] fix all reduce fusion accurate issue (#7923)#7922
BingooYang wants to merge 2 commits into
PaddlePaddle:release/2.6from
BingooYang:allreduce_acc_issue

Conversation

@BingooYang
Copy link
Copy Markdown
Contributor

Motivation

修复同时开启 export FD_USE_PHI_RMSNORM=1 和 --enable-flashinfer-allreduce-fusion 引起的精度问题

Modifications

开启 export FD_USE_PHI_RMSNORM=1 环境变量,RMSNorm其中一个分支适配 all reduce fusion

Usage or Command

NA

Accuracy Tests

done

Checklist

  • 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.
  • 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.

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented May 25, 2026

Thanks for your contribution!

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 25, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ BingooYang
❌ root


root seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@BingooYang BingooYang changed the title [BugFix] fix accurate issue [BugFix] fix all reduce fusion accurate issue May 25, 2026
Copy link
Copy Markdown

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Paddle-CI-Agent | pr_review | 2026-05-25 19:56:20

📋 Review 摘要

PR 概述:修复同时启用 FD_USE_PHI_RMSNORM=1--enable-flashinfer-allreduce-fusion 时 proxy_rmsnorm 分支未走 fused allreduce 路径导致的精度问题。
变更范围fastdeploy/model_executor/layers/normalization.pytests/layers/trtllm_allreduce_rms_fusion.py
影响面 Tag[OP]

问题

级别 文件 概述
🟡 建议 normalization.py:288 assert 用于运行时状态校验,Python -O 下会静默失效
📝 PR 规范 目标分支为 release/2.6,标题缺少 [Cherry-Pick] 前缀

📝 PR 规范检查

目标分支为 release/2.6(非 develop),根据规范标题需使用 Cherry-Pick 格式:[Cherry-Pick][Tag] 标题描述(#原PR号),当前标题缺少 [Cherry-Pick] 前缀及原 PR 号。

标题建议(可直接复制,原 PR 号请替换 <原PR号>):

  • [Cherry-Pick][BugFix] fix all reduce fusion accurate issue(#<原PR号>)

PR 描述结构完整,各必填 section(Motivation / Modifications / Usage or Command / Accuracy Tests / Checklist)均已填写,无需修改。

总体评价

修复思路清晰:将 allreduce fusion 的启用条件(tp_size > 1、shape 上限、residual 非空、CUDA 平台)统一收敛到 use_allreduce_fused 变量,并在 proxy_rmsnorm 分支中同步走 fused 路径,消除了精度不一致的根因。测试新增了 TestRMSNormProxyAllreduceFused 覆盖 proxy 分支的三条关键路径(fused / fusion-disabled / token-too-large),质量较高。主要建议是将 hot path 中的 assert 改为显式 raise 以避免 Python 优化模式下的静默失效。

input_tensor=x,
residual=residual_input,
weight=self.weight,
eps=self.eps,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 建议 assert 被用于运行时内部状态校验

Python 在 -O(优化)模式下,所有 assert 语句会被完全移除,导致此处失败时静默吞掉错误、后续代码继续执行。

建议改为显式抛出异常:

if norm_out[0] is None:
    raise RuntimeError("Trtllm-all-reduce fusion failed!")

@BingooYang BingooYang changed the title [BugFix] fix all reduce fusion accurate issue [Cherry-Pick] [BugFix] fix all reduce fusion accurate issue (#7923) May 25, 2026
@PaddlePaddle-bot
Copy link
Copy Markdown

PaddlePaddle-bot commented May 25, 2026

🤖 Paddle-CI-Agent | ci_status_monitor | 2026-05-26 05:11:12

CI报告基于以下代码生成(30分钟更新一次):


1 任务总览

Required 任务当前 9/10 通过,仍有 1 个 required 失败任务(Approval,需要人工审批),无运行中/等待中的 required 任务;审批完成后 CI 才可继续满足合入要求。Optional 失败 2 个,仅供参考,不阻塞 required 结论。

总执行(rerun次数) 总任务 ✅ 通过 ❌ 失败 ⏳ 运行中 ⏸️ 等待中 跳过
36(0) 36 33 3 0 0 0

2 任务状态汇总

2.1 Required任务 : 9/10 通过

必选任务阻塞合并,失败需优先处理。

状态 任务 耗时 根因 修复建议 日志 重跑
Approval 17s 需要 Approval 请通过人工审批 Job -
其余 9 个必选任务通过 - - - - -

2.2 可选任务 — 24/26 通过

可选任务不阻塞合并,失败仅供参考。

状态 任务 耗时 日志 重跑
Run iluvatar Tests / run_iluvatar_cases 15m57s Job -
CI_HPU 1h4m Job -
其余 24 个可选任务通过 - - -

3 失败详情(仅 required)

Approval — 需要人工审批(置信度: 高)

该 Job 需要人工 Approval,完成审批后 CI 才会继续执行。


4 代码与测试上下文核对

  • 本 PR 修改 fastdeploy/model_executor/layers/normalization.pytests/layers/trtllm_allreduce_rms_fusion.py,聚焦 RMSNorm proxy 路径的 allreduce fusion 精度问题。
  • 主测试任务 Run FastDeploy Unit Tests and Coverage / run_tests_with_coverage 已通过(1h14m),未发现与本次代码变更直接关联的 required 测试失败。
  • Optional 的 Run iluvatar Tests / run_iluvatar_cases 快速日志显示 runner pod Pending/自托管 runner 容器启动异常;CI_HPU 为可选失败,按策略不做深度分析。

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/2.6@e7a02e2). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fastdeploy/model_executor/layers/normalization.py 75.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##             release/2.6    #7922   +/-   ##
==============================================
  Coverage               ?   72.45%           
==============================================
  Files                  ?      382           
  Lines                  ?    54464           
  Branches               ?     8523           
==============================================
  Hits                   ?    39460           
  Misses                 ?    12236           
  Partials               ?     2768           
Flag Coverage Δ
GPU 72.45% <75.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants