已合并
[VFFusion] Avoid moving region-bearing ops that have anchors inside. #1365
[VFFusion] Avoid moving region-bearing ops that have anchors inside. #1365
已合并
hujiajun创建于 7月5日
hujiajun成员
7月5日

描述 Description

revert pr1333,为了避免fusion破坏anchor顺序,如果一个egion-bearing op内部存在anchor,则将其视为barrier,不对其上下的op做融合。

类型 Category

  • Bug修复 Bugfix
  • 新功能 New feature
  • 代码风格更新(格式化,局部变量)Style changes
  • 重构(即不是新增功能,也不是修改bug的代码变动)Refactor
  • 构建过程或辅助工具的变动 Build-related
  • 文档内容更新 Docs

Checklist

  • 我的代码遵循这个项目的代码风格 My code follows the project's code style
  • 我已经自己测试过我的代码 I have self-tested my code
  • 我已经更新了相应的文档 I have updated the relevant documentation
  • 我已经根据需要更新了对应的变更日志 I have updated the changelog as needed
  • 我已经在标题中正确使用了类型标签(例如:feat:, fix:)I have correctly used type labels in the title (e.g., feat:, fix:)
likedislike
Pull Request已成功合入, 合并人@chenwenqiao
(感谢 hujiajun 的贡献)
Hhujiajun成员
7月5日 创建了 pull request,commit a70b36d8
ascend-robot
ascend-robot成员
7月5日 评论:

libing-pipeline创建中,请等待……

likedislike
ascend-robotascend-robot成员
7月5日 添加了label:stat/needs-squash
ascend-robotascend-robot成员
7月5日 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
7月5日 评论:

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


PR Approval Progress

⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)

Module Approval Details

module lgtm status approve status
repo-Ascend/AscendNPU-IR ❌ (0/2)(You can also ask: 杨开昕, solin205, Zackc, yue-xy, bryanpkc) ❌ (0/1)(You can also ask: shijingchang, baberrehman, michael_hliao, YaoqingGao, 周浩)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

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

likedislike
ascend-robotascend-robot成员
7月5日 添加了label:ci-pipeline-running
ascend-robot
ascend-robot成员
7月5日 评论:

✅ The pipeline is running (pipeline number: 113), Task URL link, please wait a moment ...

likedislike
atomgit-bot
atomgit-bot
7月5日 评论:

变更摘要

此 PR 旨在 revert PR #1333,核心目的是防止 VFFusion 过程中因跨 anchor 融合而破坏 anchor 顺序。主要策略是:将 AnchorOp 视为融合屏障(barrier),在融合分析的遍历过程中遇到 AnchorOp 时立即中断遍历;同时调整了 anchor 插入的默认策略,由原来仅对 cube ops 插入 anchor 改为对 cube 和 vector ops 均插入 anchor。

主要改动

  • AutoVectorizeV2.cpp 融合屏障逻辑:在 computeConflictLists 的遍历回调中新增对 hivm::AnchorOp 的判断——当遇到 AnchorOp 时返回 WalkResult::interrupt(),从而阻止融合 pass 跨越 anchor 边界移动 region-bearing ops,保护 anchor 的顺序不被破坏。

  • Passes.td 默认选项调换insertAnchorOnlyBeforeCubeOps 默认值由 true 改为 falseinsertAnchorBeforeCubeAndVectorOps 默认值由 false 改为 true,使得默认行为从"仅对 cube ops 前插入 anchor"切换为"对 cube 和 vector ops 前均插入 anchor"。

  • 测试用例 hivm-insert-anchors-and-backup-2.mlir 删除:该文件(120 行)专门测试 insert-anchor-only-before-cube-ops=true 的旧默认模式,因旧默认已被废弃而整体移除。

  • 测试用例 hivm-insert-anchors-and-backup.mlir RUN 行简化:移除显式指定的三个选项参数,改为直接使用 --hivm-insert-anchors-and-backup,依赖新的默认值(insert-anchor-before-cube-and-vector-ops=true)运行。

likedislike
ascend-robotascend-robot成员
7月5日 添加了label:SC-RUNNING
ascend-robot
ascend-robot成员
7月5日 评论:

ascend docs pipeline is running...

likedislike
ascend-robotascend-robot成员
7月5日 添加了label:docs-ci-pipeline-running
ascend-robotascend-robot成员
7月5日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
7月5日 添加了label:ci-pipeline-failed
ascend-robot
ascend-robot成员
7月5日 评论:
阶段 任务名 状态 详情
恶意代码检查 Antipoison >>>
编码安全与规范检查 CodeCheck >>>
流水线 PR-pipeline_ascendnpu-ir-A5-copy >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员[Jacky_XH, xiechenye]评论有效
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike
ascend-robot
ascend-robot成员
7月5日 评论:

✅ 跳过 docs ci 检查,没有需要检查的文档文件

likedislike
ascend-robotascend-robot成员
7月5日 删除了label:docs-ci-pipeline-running
ascend-robotascend-robot成员
7月5日 添加了label:docs-ci-pipeline-success
atomgit-bot
atomgit-bot
7月5日 评论:

代码审查

经过对所有四个变更文件(含一个被删除文件)的逐一审查,本 diff 未发现正确性、安全性、可靠性或回归问题。变更分析如下:

  1. Passes.td:将 insertAnchorOnlyBeforeCubeOps 默认值从 true 改为 falseinsertAnchorBeforeCubeAndVectorOpsfalse 改为 true。这是对 PR #1333 的有意回退,恢复"cube+vector"为默认 anchor 插入模式。InsertAnchorsAndBackup.cpp 中的选项处理逻辑(级联 if 检查)与新默认值兼容。

  2. AutoVectorizeV2.cpp:在 computeConflictLists 的 walker lambda 中新增 AnchorOp 检查(第 533-534 行)。当 region-bearing op 内部包含 anchor 时,walker 返回 interrupt(),触发全屏障——将所有前驱和后继可融合 op 标记为冲突。这与 MergeVecScope.cpp 中已有的 containsAnchor 模式一致,正确实现了"内部有 anchor 则视为 barrier"的语义。

  3. hivm-insert-anchors-and-backup-2.mlir(已删除):该测试文件覆盖 insert-anchor-only-before-cube-ops=true 模式。作为 PR #1333 回退的一部分被删除。"cube only"模式仍为有效选项但不再是默认值。

  4. hivm-insert-anchors-and-backup.mlir:RUN 行从显式 pipeline flag 简化为 --hivm-insert-anchors-and-backup,依赖新默认值。新旧配置等价,测试预期输出不变。

总结:0 个 finding,整体风险低。变更意图明确(回退 + 屏障修复),实现与现有代码模式一致。

⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。

likedislike
ascend-robotascend-robot成员
7月5日 删除了label:SC-RUNNING
ascend-robotascend-robot成员
7月5日 添加了label:SC-SUCC
Hhujiajun成员
7月5日 update merge request[project id: 7494336, iid: 1365, commit_id: 5898cf60392ac7f90e6b866976e06502c7391ced] virtual merging success
Hhujiajun成员
7月5日 强制推送  5 个提交:e2c0cbf0-Revert "[VFFusion] Skip fusing vsstb ops into groups with rank-reducing indexing_map",5e02c859-Revert "[HFusion] Check sync ops by walking op body instead of checking op type",a86497e9-Revert "[AscendNPU-IR] fix: correct InsertAnchorsAndBackup pass option defaults",0a86e016-[HFusion] Check sync ops by walking op body instead of checking op type,57bfec69-[VFFusion] Skip fusing vsstb ops into groups with rank-reducing indexing_map
Hhujiajun成员
7月5日 update merge request[project id: 7494336, iid: 1365, commit_id: 274fbc8ead2d418514bd1c68b5c86d4f2a24084f] virtual merging success
ascend-robotascend-robot成员
7月5日 删除了label:SC-SUCC
ascend-robot
ascend-robot成员
7月5日 评论:

libing-pipeline创建中,请等待……

likedislike
ascend-robotascend-robot成员
7月5日 添加了label:SC-RUNNING
ascend-robotascend-robot成员
7月5日 删除了label:ci-pipeline-failed
ascend-robotascend-robot成员
7月5日 添加了label:ci-pipeline-running
ascend-robot
ascend-robot成员
7月5日 评论:

✅ The pipeline is running (pipeline number: 115), Task URL link, please wait a moment ...

likedislike
ascend-robot
ascend-robot成员
7月5日 评论:

ascend docs pipeline is running...

likedislike
ascend-robotascend-robot成员
7月5日 删除了label:docs-ci-pipeline-success
ascend-robotascend-robot成员
7月5日 添加了label:docs-ci-pipeline-running
ascend-robotascend-robot成员
7月5日 删除了label:SC-RUNNING
ascend-robotascend-robot成员
7月5日 添加了label:SC-RUNNING
ascend-robotascend-robot成员
7月5日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
7月5日 添加了label:ci-pipeline-failed
ascend-robot
ascend-robot成员
7月5日 评论:
阶段 任务名 状态 详情
恶意代码检查 Antipoison >>>
编码安全与规范检查 CodeCheck >>>
流水线 PR-pipeline_ascendnpu-ir-A5-copy >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员[Jacky_XH, xiechenye]评论有效
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike
ascend-robot
ascend-robot成员
7月5日 评论:

✅ 跳过 docs ci 检查,没有需要检查的文档文件

likedislike
ascend-robotascend-robot成员
7月5日 删除了label:docs-ci-pipeline-running
ascend-robotascend-robot成员
7月5日 添加了label:docs-ci-pipeline-success
ascend-robotascend-robot成员
7月5日 删除了label:SC-RUNNING
ascend-robotascend-robot成员
7月5日 添加了label:SC-SUCC
Hhujiajun成员
7月5日 update merge request[project id: 7494336, iid: 1365, commit_id: 4cbd923999acb20615e2748fafddd521e7bca3b1] virtual merging success
Cchenwenqiao成员
7月5日 合入了pull request,合并节点 SHA:3e9f48bcf16b9a014a5a48a9b9fb215bdc6e95c3