Merged
fix(ir): Delte new_ir flag #6455
LiuChangAdd on Sep 17
fix(ir): Delte new_ir flag #6455
Merged
LiuChangAdd on Sep 17
LiuChang
LiuChangCollaborators
Sep 17

默认new-ir , 删除配置项

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for LiuChang's contribution.)
LiuChangLiuChangCollaborators
Sep 17 Created pull request, commit 09cdf0c7
atomgit-bot
atomgit-bot
Sep 17 Comments:

变更摘要

本 PR 将新 IR 编译管线设为默认行为,彻底移除 new_ir 配置项。此前 pypto.frontend.jit 装饰器与 JitCallableWrapper 通过 new_ir 开关在旧解析路径与 compile_new 之间切换,本次改动删除了该开关及其相关属性,使编译入口统一走 compile_new 管线,并同步清理了仅适用于旧 IR 的测试与相关导入。

主要改动

  • 移除 jit 装饰器的 new_ir 参数: pypto.frontend.jit 不再接受 new_ir 参数,同时删除其文档说明及向 JitCallableWrapper 的传参,外部调用方无法再通过该配置项选择编译管线。
  • 简化 JitCallableWrapper 编译流程: 删除 __init__ 中的 new_ir 形参与 _use_new_ir 属性,并将原方法内的新旧分支合并为直接调用 self.compile_new(tensors, tensor_defs),旧的解析、setup_verify_data 绑定与 golden data 重置等分支代码被移除。
  • 清理旧 IR 相关导入: entry.py 中移除了 setup_verify_data 的导入,仅保留 _pto_verify_datas。
  • 更新存量测试的装饰器用法: 多个 python/tests/st 下的用例去掉 new_ir=True/False 参数,统一使用默认编译行为;其中部分分布式测试(如 test_allgather_matmul、test_matmul_allreduce_add_rmsnorm、test_moe_distributed_combine、test_allreduce_cascading 等)新增 @pytest.mark.skip()。
  • 删除依赖旧 IR 的测试: 删除 python/tests/ut/interface/test_control_flow_error.py,并从 python/tests/ut/interface/test_error.py 中移除多个基于 new_ir=False 的错误场景用例及相应导入。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 17 Comments:

代码审查

审查结论

发现的问题(共 3 项)

# 优先级 文件:行 标题
1 P1 python/pypto/frontend/parser/entry.py:40 删除 setup_verify_data 导入会打断 interpreter UT 的 monkeypatch
2 P3 python/pypto/frontend/parser/entry.py:493 compile 固定走 compile_new 后 _create_parser/_parser 成为死代码(可选清理)
3 P3 python/tests/ut/interface/test_error.py:20-22 依赖 new_ir 的用例被整体删除而非按任务要求 skip(可选改进)

逐文件审查确认

  • python/pypto/frontend/parser/entry.py — 有 2 项问题(P1:setup_verify_data 导入单边删除导致 tests/ut/interpreter/conftest.py:94 的 monkeypatch.setattr(entry, "setup_verify_data", ...) 抛 AttributeError,该 fixture 为 autouse=True,会让整个 interpreter UT 目录集体 error;P3:compile() 旧分支删除后 _create_parser 与 self._parser 不可达)。其余改动(new_ir 形参/属性移除、jit 签名与 create_new_logical_tensor 保留)经 find_references/grep 全仓核验,无遗留 new_ir= 调用方,未发现破坏性变更。
  • python/tests/st/frontend/test_kernel_reuse.py — no issues(仅去掉 new_ir=True;文件内 test_new_ir_inplace_reshape_cache_reuse 等命名/日志中的 "new_ir" 为描述性文字,非残留 API 用法)。
  • python/tests/st/interface/test_helper_move_loop_carry_new_front.py — no issues(仅去掉装饰器中的 new_ir=True)。
  • python/tests/st/operator/distributed/test_allgather_matmul.py — no issues(new_ir=False → (),并按要求对 test_allgather_matmul 加 @pytest.mark.skip())。
  • python/tests/st/operator/distributed/test_matmul_allreduce_add_rmsnorm.py — no issues(两个 kernel 装饰器同步更新,test_matmul_allreduce_add_rmsnorm 已 skip)。
  • python/tests/st/operator/distributed/test_moe_distributed_dispatch_combine.py — no issues(两处 new_ir=False 去除,test_moe_distributed_combine / test_moe_distributed_dispatch_combine 均已 skip)。
  • python/tests/st/operator/distributed/test_multi_comm_groups.py — no issues(new_ir=False → (),test_allreduce_cascading 已 skip)。
  • python/tests/ut/interface/test_error.py — 有 1 项 P3(删除 7 个错误路径用例,与 Issue 要求的 "skip" 不一致,且其中 contiguous 校验、错误码格式等契约在新 IR 下仍生效,覆盖出现空洞)。
  • (附带)python/tests/ut/interface/test_control_flow_error.py 整文件删除 — 同属上述 P3 的删除而非 skip 策略问题。

整体风险判断

改动主体是“删除 new_ir 开关、默认走新 IR”的收敛型重构,方向与 Issue #3370 一致,未发现新 IR 路径上的逻辑或安全问题。主要风险集中在 entry.py 第 40 行的单边导入删除:它与未同步修改的 interpreter UT conftest 形成跨文件契约不一致,很可能造成单测套件大面积 error,建议合入前确认。其余为可选的死代码清理与测试保留策略建议,不阻塞合入。

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

⛔ 需要修改

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 17 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Sep 17 Comments:

CLA Signature Pass

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

likedislike
CANN-robot
CANN-robotCollaborators
Sep 17 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
python/pypto/frontend ✅ tsungl4, DCGDDD (2/2) ✅ tsungl4, DCGDDD (2/1)
repo-cann/pypto ✅ tsungl4, DCGDDD (2/2) ✅ DCGDDD, tsungl4 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
Sep 17 Set xinweiliu,cam_bxh,dai-zhentao,lululu40888,shi-dingkun,gguuaanngg,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,WenboCodes as approver
CANN-robotCANN-robotCollaborators
Sep 17 Set xinweiliu,cam_bxh,dai-zhentao,lululu40888,shi-dingkun,gguuaanngg,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,WenboCodes as approver
LiuChangLiuChangCollaborators
Sep 17 Associated issue: [Task|任务跟踪]:商分 9.2.0 不体现 jit 的 new_ir / create_new_logical_tensor 开关
LiuChang
LiuChangCollaborators
Sep 17 Comments:

compile

likedislike
LiuChangLiuChangCollaborators
Sep 17 Pre merge succeeded (commit_id: e1188de227b33460d5ce133fed81b92d17cd3157)
CANN-robot
CANN-robotCollaborators
Sep 17 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 17 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 17 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 17 Added label: ci-pipeline-failed
atomgit-bot
atomgit-botSep 17Start code review2
python/pypto/frontend/parser/entry.py
Outdated
@@ -38,3 +38,3 @@
3838from pypto.logging import log_debug
3939from pypto.pil.compile_pipeline import compile_new_ir
40-from pypto.runtime import _pto_verify_datas, setup_verify_data
40+from pypto.runtime import _pto_verify_datas
atomgit-bot
atomgit-botSep 17Comments:

🟠 High Priority

变更点:entry.py 第 40 行由 from pypto.runtime import _pto_verify_datas, setup_verify_data 改为只导入 _pto_verify_datas,模块级符号 setup_verify_data 在 pypto.frontend.parser.entry 中不再存在。

影响契约:python/tests/ut/interpreter/conftest.py:94(未在本 diff 中修改)显式执行
monkeypatch.setattr(entry, "setup_verify_data", setup_verify_data_host),
其中 entry 即 import pypto.frontend.parser.entry as entry(conftest.py:77)。pytest 的 monkeypatch.setattr 默认 raising=True,当目标属性不存在时会抛出 AttributeError。

失败模式:该 fixture 为 autouse=True,属性缺失导致 fixture setup 阶段直接报 AttributeError: <module 'pypto.frontend.parser.entry'> has no attribute 'setup_verify_data',python/tests/ut/interpreter/ 下所有用例集体 error,CI 单测大面积失败(而非仅个别用例失败)。

建议:恢复 from pypto.runtime import _pto_verify_datas, setup_verify_data,或同步修改 python/tests/ut/interpreter/conftest.py:94 使 monkeypatch 目标与 entry 模块实际导出的符号一致。

likedislike
Incorrect?
System
System MessageSystem
Sep 18 Comments:

changed this line on fc98f136 view diff detail

likedislike
LiuChangLiuChangCollaborators
Sep 18 Pre merge succeeded (commit_id: 5bc5fede1c2654e62009fff38b824196ffd28bfc)
LiuChangLiuChangCollaborators
Sep 18 Force-pushed 1 commits:fc98f136-fix(ir): Delte new_ir flag
LiuChangLiuChangCollaborators
Sep 18 Pre merge succeeded (commit_id: e62dfb7be3b00dd4fc4db25f3cc61ee496d18a54)
CANN-robotCANN-robotCollaborators
Sep 18 Removed label: cann-cla/yes
CANN-robotCANN-robotCollaborators
Sep 18 Added label: cann-cla/yes
LiuChang
LiuChangCollaborators
Sep 18 Comments:

compile

likedislike
LiuChangLiuChangCollaborators
Sep 18 Pre merge succeeded (commit_id: d7aeed0c0f3544c15f38521b6635405697e7002e)
CANN-robot
CANN-robotCollaborators
Sep 18 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 18 Removed label: ci-pipeline-failed
7 event messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
Sep 18 Added label: cann-cla/yes
LiuChang
LiuChangCollaborators
Sep 18 Comments:

compile

likedislike
LiuChangLiuChangCollaborators
Sep 18 Pre merge succeeded (commit_id: 7af5cdc3148129b467f2de4726cf4493240329d2)
CANN-robot
CANN-robotCollaborators
Sep 18 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 18 Removed label: ci-pipeline-failed
CANN-robotCANN-robotCollaborators
Sep 18 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 18 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 18 Added label: ci-pipeline-passed
lidongsheng
lidongshengCollaborators
Sep 18 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 18 Added label: approved
杨旭
杨旭Collaborators
Sep 20 Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 20 Added label: lgtm
CANN-robot
CANN-robotCollaborators
Sep 20 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
LiuChangLiuChangCollaborators
Sep 20 Resolved final issue
LiuChang
LiuChangCollaborators
Sep 20 Comments:

check-pr

likedislike
CANN-robotCANN-robotCollaborators
Sep 20 Merged pull request