已合并
revert: 回退ordinary AICPU常量折叠迁移 #5239
revert: 回退ordinary AICPU常量折叠迁移 #5239
已合并
pantong创建于 7 天前
pantong
7 天前

Pull Request

描述

完整回退GE #5200合入develop的提交5dfaef763,恢复GE旧ordinary AICPU常量折叠源码、target、stub、UT/ST及交付项,并恢复原HostCpuEngine加载顺序。

回退原因:迁移后bottom ordinary路由构造AICPU NodeDef时,input shape/format/dtype改为来自实际常量Tensor;迁移前这些元数据来自节点OpDesc。黄区TransData用例因此出现NHWC [4,4,3,3]推导期望FRACTAL_Z [12,1,16,16],与节点输出描述[16,1,16,16]冲突,AICPU失败后fallback到GE built-in。行为与迁移前不一致。

变更类型

关联的Issue

https://gitcode.com/cann/ge/issues/609

相关迁移PR:GE #5200。

如何测试

  1. 基于最新develop对5dfaef763执行完整反向提交,无冲突。
  2. 回退文件范围与原迁移提交一致,旧实现、target、stub和UT/ST全部恢复。
  3. 保留迁移后其他提交新增的resource_usage_context.h交付项,未误回退后续改动。
  4. pre-commit、clang-format、codespell和OAT通过。
  5. 远端compile流水线重新验证。

核对清单

其他信息

后续重新迁移时,bottom ordinary AICPU路由必须恢复迁移前NodeDef语义:shape/format/dtype来自节点OpDesc,data地址和size来自实际常量Tensor;不能用提前fallback替代。

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 pantong 的贡献)
Ppantong
7 天前 创建了 pull request,commit d0952510
Ppantong
7 天前 关联了issue:[Bug-Report|缺陷反馈]: 回退ordinary AICPU常量折叠迁移
atomgit-bot
atomgit-bot
7 天前 评论:

变更摘要

本 PR 完整回退 [GE #5200] 合入 develop 的提交 5dfaef763,恢复 GE 旧有 ordinary AICPU 常量折叠实现、target、stub、UT/ST 与交付项,并恢复原有 HostCpuEngine 加载顺序。回退原因在于迁移后 bottom ordinary 路由构造 AICPU NodeDef 时改用实际常量 Tensor 提供 input shape/format/dtype,导致与节点输出描述冲突、AICPU 失败后 fallback 到 GE built-in,行为与迁移前不一致。核心动作是删除迁移期引入的 libopconstant_folding.so 装载链路,改回 libaicpu_const_folding.so 及 libops_host_cpu.so 的延迟初始化与兜底逻辑,并重新引入 aicpu_const_folding 目录下的 folding、host_cpu_kernel_wrapper 等实现及配套构建、打包、测试项。

主要改动

  • 恢复 HostCpuEngine 加载顺序与库名: base/host_cpu_engine/host_cpu_engine.cc/.h 将库名改回 kAicpuConstFoldingName = "libaicpu_const_folding.so",删除 LoadOpConstantFoldingLib,改为先 dlopen 但延迟调用 libops_host_cpu.so 的 Initialize,随后加载 libaicpu_const_folding.so 并执行 Initialize,失败时回退调用 InvokeLibInitialize 兜底。
  • 简化 DlopenLib 接口: 去掉 DlopenLib 的 bool global 参数,固定使用 MMPA_RTLD_NOW | MMPA_RTLD_GLOBAL 打开标志,host_cpu_engine.h 同步更新声明。
  • 新增 ordinary AICPU 常量折叠实现: 新增 compiler/engines/cpu_engine/cpu_engine/aicpu_const_folding/folding.cc/folding.h,导出 InitCpuConstantFoldingNew 与 CpuConstantFoldingComputeNew,实现扫描并加载 libopconstant_folding_*.so、V1/V2 算子枚举与 op_type 反向索引构建、NodeDef 输入输出与属性转换及 V1/V2 计算路由。
  • 新增 Host CPU kernel 包装层: 新增 host_cpu_kernel_wrapper.cpp/.h,定义 HostCpuKernelWrapperOpV2 及 Initialize,通过 REGISTER_HOST_CPU_OP_BUILDER("HostCpuKernelWrapperOpV2", ...) 注册,将 Compute 转发到 CpuConstantFoldingComputeNew。
  • 恢复交付项与构建/测试配套: cmake/package.cmake 与 scripts/package/module/ascend/GeCompilerSo.xml 重新纳入 aicpu_const_folding/libaicpu_const_folding.so,并恢复 constant_folding_ops_stub.cpp 及 tests/engines/cpueng 下的 folding_st.cpp、folding_ut.cpp、aicpu_stub.cpp 测试与桩件。
likedislike
不准确?
atomgit-bot
atomgit-bot
7 天前 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
7 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
7 天前 评论:

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
compiler/engines/cpu_engine ✅ yangyongqiang0606, hugo111 (2/2) ✅ yangyongqiang0606 (1/1)
repo-cann/ge ✅ yangyongqiang0606, hugo111 (2/2) ✅ yangyongqiang0606 (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robot
CANN-robot成员
7 天前 评论:

CLA Signature Pass

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

likedislike
CANN-robotCANN-robot成员
7 天前 将yangyongqiang0606,kobemini,ClarkXie,tangqunzhang,xchu42,hugo111,lining23666,tang-haojie,depeng1994,wqtshg_wt,peiyang,shengnan666,liu-wei,zhangfan_hanq,zhanj,zhujingjing,Mexyy,wangxiaotian995,stevenaw0,yuht9设为评审人
CANN-robotCANN-robot成员
7 天前 将yangyongqiang0606,kobemini,ClarkXie,tangqunzhang,xchu42,hugo111,lining23666,tang-haojie,depeng1994,wqtshg_wt,peiyang,shengnan666,liu-wei,zhangfan_hanq,zhanj,zhujingjing,Mexyy,wangxiaotian995,stevenaw0,yuht9设为审查人
pantong
7 天前 评论:

compile

likedislike
Ppantong
7 天前 预合并成功(commit_id: f0ce6982fcf43c86f67ceb8e4fd1d68ac7e9955c)
CANN-robot
CANN-robot成员
7 天前 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-running
Ppantong
7 天前 修改了pull request 的描述
CANN-robotCANN-robot成员
7 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-failed
CANN-robot
CANN-robot成员
7 天前 评论:

流水线分析报告 — ge run#b596cb88

流水线: https://gitcode.com/CANN/ge/actions/runs/b596cb8826564c1f8c33adad4ebb0df8 | PR#5239 | 2026-09-29 14:29:09 ~ 14:37:11 | 失败 Job 1 个

定界结论: 代码问题 / 代码检查错误
  • 失败类型: 代码问题
  • 根因: 门禁代码检查(codecheck)不通过, 检查服务返回 state: no pass
  • 影响范围: 仅 Codecheck_dt 一个 Job 失败; 其余 57 个下游 Job(ut/st/UT_Report/ST_Report/API_Check/PreSmoke_A2)均为 INIT 级联未启动, 无独立失败
  • 处置建议: 通知 PR 提交者修复 —— 具体检查项明细请打开 codecheck 结果页查看(见下方根因证据中的链接), 按明细逐项修复后重新推送触发
  • 排除项: codecheck 服务本身正常(任务创建/轮询/返回均为 200, 服务运行约 4 分钟后正常给出结论), 非工程/环境问题, 重试无效

失败根因分析

根因 #1: 代码问题 / 代码检查错误 — codecheck 服务返回 no pass
  • 判据: codecheck 检查不通过
  • 定位步骤: 3_Codecheck_dt.log
  • 影响 Job: Codecheck_dt(耗时 4m16s)
  • 根因证据(日志原文):
[2026-09-29 14:36:00.103+08:00] 2026-09-29 14:36:00,081 - INFO 响应: {"code":"200","msg":"success","data":"https://www.openlibing.com/apps/entryCheckDashCode/MR_a5667f64c2d242a69a670a772bc80ba7/837d1fa17cce0c3f32b515482be0fa78?projectId=300033&codeHostingPlatformFlag=gitcode","uuid":null,"state":"no pass","failData":null,"taskCount":0,"task_id":null}
[2026-09-29 14:36:00.104+08:00] 2026-09-29 14:36:00,083 - INFO [codecheck 2026-09-29 14:36:00] codecheck result: no pass.
[2026-09-29 14:36:00.105+08:00] ::error::Process exited with code 255
  • 说明: Job 日志仅记录轮询与结论, 具体检查项(违规文件/规则)明细在 codecheck 结果页: 查看检查明细

由门禁失败定界分析自动生成 | repo: ge | run: b596cb8826564c1f8c33adad4ebb0df8 | PR#5239

likedislike
Ppantong
7 天前 预合并成功(commit_id: 1e9b7ce3f4071b333df5a5aacf3638fe252d1f16)
Ppantong
7 天前 强制推送  1 个提交:5a49927f-revert: 回退ordinary AICPU常量折叠迁移
Ppantong
7 天前 预合并成功(commit_id: e6e717a2d9e747ad38d095ecaa4c96be4a0d8b0b)
CANN-robotCANN-robot成员
7 天前 删除了label:cann-cla/yes
CANN-robotCANN-robot成员
7 天前 添加了label:cann-cla/yes
pantong
7 天前 评论:

compile

likedislike
Ppantong
7 天前 预合并成功(commit_id: 99571ef2ae4762d412efde6882286e23b0ed437b)
CANN-robot
CANN-robot成员
7 天前 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
7 天前 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-running
Ppantong
7 天前 预合并成功(commit_id: 2b56e09b8e09ea685e467e50e4f25d56ce01839f)
Ppantong
7 天前 强制推送  1 个提交:710efc60-revert: 回退ordinary AICPU常量折叠迁移
Ppantong
7 天前 预合并成功(commit_id: bf81ea5cbc5d4c159f56fbe46771ce8d46ea32a9)
CANN-robotCANN-robot成员
7 天前 删除了label:cann-cla/yes
pantong
7 天前 评论:

compile

likedislike
CANN-robotCANN-robot成员
7 天前 添加了label:cann-cla/yes
Ppantong
7 天前 预合并成功(commit_id: 097a0bba5e9938a85dd7ebfb097a05ae1b9490dc)
CANN-robotCANN-robot成员
7 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-failed
CANN-robot
CANN-robot成员
7 天前 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
7 天前 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
7 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
7 天前 添加了label:ci-pipeline-passed
hugo111成员
7 天前 评论:

/lgtm

likedislike
yangyongqiang
yangyongqiang成员
7 天前 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
7 天前 添加了label:lgtm
yangyongqiang
yangyongqiang成员
7 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
7 天前 添加了label:approved
CANN-robotCANN-robot成员
7 天前 关闭了关联的issue
CANN-robotCANN-robot成员
7 天前 合入了pull request