Skip to content

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

Merged
qingqing01 merged 5 commits into
PaddlePaddle:release/2.6from
BingooYang:allreduce_acc_issue
May 28, 2026
Merged

[Cherry-Pick] [BugFix] fix all reduce fusion accurate issue (#7923)#7922
qingqing01 merged 5 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
PaddlePaddle-bot

This comment was marked as outdated.

@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-28 17:27:10

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


1 任务总览

所有 required 任务已通过,建议通过;当前仍有 2 个 optional 任务失败,不阻塞合并,仅供参考。

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

2 任务状态汇总

2.1 Required任务 : 10/10 通过

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

状态 任务 耗时 根因 修复建议 日志 重跑
其余 10 个必选任务通过 - - - - -

2.2 可选任务 — 24/26 通过

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

状态 任务 耗时 日志 重跑
Run iluvatar Tests / run_iluvatar_cases 16m49s Job -
CI_HPU 2h5m Job -
其余 24 个可选任务通过 - - -

3 失败详情(仅 required)

无 required 失败任务。

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 25, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/2.6@2b0fd53). 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 ⚠️
fastdeploy/model_executor/models/glm4_moe.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##             release/2.6    #7922   +/-   ##
==============================================
  Coverage               ?   71.95%           
==============================================
  Files                  ?      385           
  Lines                  ?    54732           
  Branches               ?     8568           
==============================================
  Hits                   ?    39381           
  Misses                 ?    12573           
  Partials               ?     2778           
Flag Coverage Δ
GPU 71.95% <66.66%> (?)

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.

K11OntheBoat
K11OntheBoat previously approved these changes May 26, 2026
Copy link
Copy Markdown
Collaborator

@K11OntheBoat K11OntheBoat left a comment

Choose a reason for hiding this comment

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

LGTM

PaddlePaddle-bot

This comment was marked as outdated.

PaddlePaddle-bot

This comment was marked as outdated.

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-28 10:53:35

📋 Review 摘要

PR 概述:修复同时启用 FD_USE_PHI_RMSNORM=1--enable-flashinfer-allreduce-fusion 时 RMSNorm proxy_rmsnorm 路径缺少 allreduce fusion 导致的精度问题,并修复 GLM4-MoE shared expert 的 enable_all_reduce_fusion 逻辑错误。

变更范围model_executor/layers/normalization.pymodel_executor/models/glm4_moe.pytests/layers/

影响面 Tag[OP] [Models]

问题

级别 文件 概述
⚠️ 仍存在(F1) normalization.py:289 proxy_rmsnorm 新路径继续使用 assert 做运行时校验
🟡 建议 tests/layers/trtllm_allreduce_rms_fusion.py:588 TestRMSNormProxyAllreduceFused 全部 3 个测试方法均 skipTest(tp_size<2),单卡 CI 下完全跳过

历史 Findings 修复情况

Finding 问题 状态
F1 assert 用于运行时内核状态校验 ⚠️ 仍存在(且新增 proxy_rmsnorm 分支又引入了一处同类 assert

📝 PR 规范检查

标题格式与 Cherry-Pick 规范存在偏差:[Cherry-Pick][BugFix] 之间多了空格,且 "accurate" 拼写应为 "accuracy",PR 号前多了空格。

标题建议(可直接复制):

  • [Cherry-Pick][BugFix] fix all reduce fusion accuracy issue (#7923)

描述结构完整,所有必填段落均已填写,Checklist 勾选符合实际,无需修改。

总体评价

本次修复逻辑清晰,核心 bug(proxy_rmsnorm 路径漏做 allreduce fusion 及 GLM4-MoE shared expert 的 reduce_results 条件判断错误)定位准确,精度测试也随之更新为更贴近真实场景的 bf16。历史遗留 assert 问题仍未解决,且新增的 proxy 路径又引入一处同类用法;新测试类在单卡 CI 下全部被 skip,建议补充不依赖多卡的轻量级覆盖。

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.

⚠️ 仍存在(F1) assert 用于运行时内核状态校验

assert 在 Python 以 -O 优化模式运行时会被完全跳过,用于校验内核执行状态不可靠。

建议修复方式:

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

mock_manager.cleanup.assert_called_once()


class TestRMSNormProxyAllreduceFused(unittest.TestCase):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 建议 TestRMSNormProxyAllreduceFused 全部 3 个测试均要求 tp_size >= 2,单卡 CI 下完全跳过

所有测试方法开头均有 self.skipTest("Requires tp_size >= 2"),在常见单卡 CI 环境中这 3 个测试永远不会执行,等同于无守护覆盖。

建议:

  • 将不需要真正 all-reduce 通信的逻辑拆成 tp_size=1 可运行的 mock 单测(例如对 use_allreduce_fused 布尔推导条件的验证)
  • 或在 CI 配置中增加多卡分布式 job 保证这些测试能运行

@qingqing01 qingqing01 merged commit fefbcff into PaddlePaddle:release/2.6 May 28, 2026
34 of 37 checks passed
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.

6 participants