Merged
图融合引用文档 #6701
yuwang-Add on 17 days ago
图融合引用文档 #6701
Merged
yuwang-Add on 17 days ago
yuwang-
17 days ago

描述

图融合引用文档:
PermuteFusionPass_en.md
GlobalavgpoolFusionPass_en.md
ReduceMeanWithCastFusionPass_en.md

关联的Issue

https://gitcode.com/cann/ops-math/issues/4095

测试

文档更新

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for yuwang-'s contribution.)
Yyuwang-
17 days ago Created pull request, commit 9d68bda4
atomgit-bot
atomgit-bot
17 days ago Comments:

变更摘要

本 PR 为图融合能力补充英文文档,新增 PermuteFusionPass、GlobalavgpoolFusionPass、ReduceMeanWithCastFusionPass 三份融合规则说明,覆盖融合模式、约束条件与适用产品等章节,用于说明相关算子在图编译阶段被替换或分解为等价算子的行为。

主要改动

  • PermuteFusionPass 融合文档: 说明 Permute 按平台替换为 TransposeD(A3、910b、910、310p、310b)或 Transpose(950,perm 以 Const 节点输入),置换顺序优先读 perm 属性、缺失时读 order,并要求 GE 编译器版本不低于 9.1.0。
  • GlobalavgpoolFusionPass 融合文档: 说明 GlobalAveragePool 被替换为沿空间维度求均值的 ReduceMean,替换后设置 keep_dims=true 与 noop_with_empty_axes=true,且输入 x 仅支持 3D/4D/5D。
  • ReduceMeanWithCastFusionPass 融合文档: 说明 ReduceMeanWithCast 分解为 Cast + ReduceMean,dtype 非 DT_UNDEFINED 时插入 Cast 并以其作为 dst_type,为 DT_UNDEFINED 时直接替换为 ReduceMean。
  • 属性继承与默认值约定: 记录 keep_dims、noop_with_empty_axes、dtype 等属性的默认值与继承关系,并明确输入形状与数据类型沿用底层算子约束。
  • 平台相关标注: 通过 npu 条件标注区分不同产品型号的支持范围,并引用 docs/en/figures 下的融合前后结构示意图。

🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
CANN-robot
CANN-robotCollaborators
17 days ago Comments:

Hi @yuwang-, welcome to submitting your first PR to CANN!

PR Merge Steps

1. CLA Signing

If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.

2. CI Check

Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.

3. Code Review

After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.

likedislike
atomgit-bot
atomgit-bot
17 days ago Comments:

代码审查

检视结论

逐文件确认

  • conversion/transpose/docs/PermuteFusionPass_en.md:no issues(平台标签、用例与约束、版本约束、图路径均自洽;无危险命令/不安全配置/密钥泄露)。
  • math/reduce_mean/docs/GlobalavgpoolFusionPass_en.md:2 个问题(归约维度描述、标题与 pass 名不一致)。
  • math/reduce_mean/docs/ReduceMeanWithCastFusionPass_en.md:1 个问题(Cast dst_type 描述未区分 DT_UNDEFINED 分支)。

问题统计:P0 × 0,P1 × 0,P2 × 1,P3 × 2。

整体风险判断:低。本次为纯文档新增(3 个英文页、无代码/配置/依赖变更),不涉及安全或运行时行为;主要风险是文档与实际 pass 语义描述不一致导致读者误用(P2 的 GlobalAveragePool 归约维度一项需对照实现核实),其余为可检索性与描述准确性层面的轻量问题。

类型 数量
🔴 阻塞 0
🟡 建议 1

💬 仅评论


🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
17 days ago Added label: cann-cla/yes
yuwang-
17 days ago Comments:

/compile

likedislike
CANN-robot
CANN-robotCollaborators
17 days ago Comments:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
conversion/transpose ✅ 顾宝成, 陈兴宇 (2/2) ✅ 顾宝成 (1/1)
math/reduce_mean ✅ 顾宝成, 陈兴宇 (2/2) ✅ 顾宝成 (1/1)
repo-cann/ops-math ✅ 顾宝成, 陈兴宇 (2/2) ✅ 顾宝成 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robot
CANN-robotCollaborators
17 days ago Comments:

CLA Signature Pass

yuwang-, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
Yyuwang-
17 days ago Pre merge succeeded (commit_id: 84d35356d891ffbf9c0a5ac9c8d366e1702a58bc)
CANN-robotCANN-robotCollaborators
17 days ago Set FelixTang7,yue-ma,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,chenxingyu18,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,onanfield,zhanw_coding,clinglai0517 as approver
CANN-robotCANN-robotCollaborators
17 days ago Set FelixTang7,yue-ma,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,chenxingyu18,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,onanfield,zhanw_coding,clinglai0517 as approver
CANN-robot
CANN-robotCollaborators
17 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
17 days ago Added label: ci-pipeline-running
atomgit-bot
atomgit-bot17 days agoStart code review1
math/reduce_mean/docs/GlobalavgpoolFusionPass_en.md
@@ -0,0 +4,4 @@
4+ 
5+## Fusion Pattern
6+ 
7+This fusion replaces the `GlobalAveragePool` operator in the graph with the `ReduceMean` operator, which computes the mean along the spatial dimensions (all dimensions from the second one onward), as shown in the following figure.
atomgit-bot
atomgit-bot17 days agoComments:

🟡 Medium Priority

变更行:math/reduce_mean/docs/GlobalavgpoolFusionPass_en.md:7 新增「computes the mean along the spatial dimensions (all dimensions from the second one onward)」。

问题链路:GlobalAveragePool 的语义是沿空间维度(NCHW 下的 H、W)求均值,输出仍保留 batch(N) 与 channel(C) 维,即归约轴为 {2,…,n-1};而该句把归约范围写成「从第 2 维起的所有维度」= {1,…,n-1},等于把 channel 维也一起平均掉,描述出的计算与 GlobalAveragePool 标准语义(输出 N×C×1×1)不一致。

失败模式:读者按此文档理解融合后 ReduceMean 的 axes,会认为 C 维被压平;若下游按此理解做 shape 推导、对齐适配层或编写校验用例,就会出现 shape/数值预期错误(例如期望输出为 N×1×1 而实际为 N×C×1×1)。触发条件:任何 4D NCHW 输入阅读该文档并据此推导输出形状。由于本环境无法读取 pass 实现核对实际 axes,置信度已下调,但即便是实现侧真的传 axes={1..n-1},该实现同样与 GlobalAveragePool 语义不符,仍需修正。

建议:核对 pass 实际传入的 axes 后修正该句:GlobalAveragePool 只沿空间维(NCHW 的 H、W,即从第三维起)求均值并保留 batch/channel 维;建议直接写出 axes 取值,避免「from the second one onward」这种会吞掉 channel 维的表述。

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
17 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
17 days ago Added label: ci-pipeline-passed
gubaochengCollaborators
16 days ago Comments:

/lgtm
/approve
by agent

likedislike
CANN-robotCANN-robotCollaborators
16 days ago Added label: approved
Yyuwang-
16 days ago Associated issue: [Documentation|文档反馈]: 图融合引用的文档无译本可用,需补充翻译
chenyifengCollaborators
16 days ago Comments:

您好,PR已满足合入指标,请尽快联系Committer进行合入。如暂时不需要合入,请在PR标题前加[WIP]

likedislike
lwx1255555Collaborators
16 days ago Comments:

/lgtm

likedislike
Yyuwang-
16 days ago Modify description of pull request
chenxingyu18Collaborators
16 days ago Comments:

/lgtm

likedislike
CANN-robot
CANN-robotCollaborators
16 days ago Comments:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
/lgtm: lwx1255555

likedislike
CANN-robotCANN-robotCollaborators
16 days ago Added label: lgtm
CANN-robot
CANN-robotCollaborators
16 days ago Comments:

The MR can not be merged, because of CodeReview discussion not resolved

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
CcaiwenwenCollaborators
16 days ago Resolved final issue
CANN-robotCANN-robotCollaborators
16 days ago Closed associated issue
CANN-robotCANN-robotCollaborators
16 days ago Merged pull request