Merged
fix(simulation): Register ERF pipe type and fallback unknown opcodes #6556
fix(simulation): Register ERF pipe type and fallback unknown opcodes #6556
Merged
zhiweiyuanAdd on Sep 21
zhiweiyuan
zhiweiyuanCollaborators
Sep 21

fix(simulation): Register ERF pipe type and fallback unknown opcodes

Cherry-pick of #6521 (master) into 9.2.0.

Task-level simulation (--run_mode sim) aborts with F16766 INVALID_PIPE_TYPE
when executing kernels containing the ERF opcode (e.g. GELU/GeGLU in
activation.py). Root cause: SCHED_CORE_PIPE_TYPE lacks the ERF mapping, and
TileOp::GetPipeType() hard-asserts on unknown opcodes with no fallback path.

Changes:

  • Register {"ERF", CorePipeType::PIPE_VECTOR_ALU} in SCHED_CORE_PIPE_TYPE
  • Refactor TileOp::GetPipeType(): unknown opcodes now fall back to
    PIPE_VECTOR_ALU with a SIMULATION_LOGW warning instead of aborting;
    this also fixes the pre-existing UB where the LOOP exemption path
    dereferenced end() when LOOP was absent from the table

Related Issues: #3392

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for zhiweiyuan's contribution.)
zhiweiyuanzhiweiyuanCollaborators
Sep 21 Created pull request, commit 8efc9f6b
zhiweiyuanzhiweiyuanCollaborators
Sep 21 Associated issue: [Bug-Report|缺陷反馈]: 仿真模式执行含ERF算子的kernel报F16766 INVALID_PIPE_TYPE
atomgit-bot
atomgit-bot
Sep 21 Comments:

变更摘要

本 PR 是 #6521 向 9.2.0 分支的 cherry-pick,用于修复任务级仿真(--run_mode sim)在执行包含 ERF 指令的内核(如 activation.py 中的 GELU/GeGLU)时因 F16766 INVALID_PIPE_TYPE 而中断的问题。核心改动是在 SCHED_CORE_PIPE_TYPE 中补充 ERF 到 CorePipeType::PIPE_VECTOR_ALU 的映射,并重构 TileOp::GetPipeType(),使未知 opcode 不再触发断言中止,而是回退到 PIPE_VECTOR_ALU 并输出 SIMULATION_LOGW 告警。

主要改动

  • 新增 ERF 管道类型映射:在 ISA.h 的 SCHED_CORE_PIPE_TYPE 中注册 {"ERF", CorePipeType::PIPE_VECTOR_ALU},使仿真能识别 ERF 指令对应的向量 ALU 管道类型。
  • 未知 opcode 回退处理:TileOp::GetPipeType() 移除对未知 opcode 的 ASSERT 中止逻辑,改为在查表失败时回退到 CorePipeType::PIPE_VECTOR_ALU,并输出 SIMULATION_LOGW 告警,避免仿真直接中断。
  • 调整管道类型判定分支:将原先的 IsCall() / else 二分逻辑改为 IsCall()、查表命中、查表未命中三分支,查表结果仅在命中时赋值,消除对 end() 迭代器的错误解引用风险。
  • 行为变更:LOOP 等不在映射表中的 opcode 不再走特殊豁免路径,统一由回退分支处理,行为与未知 opcode 保持一致。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 21 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 21 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Sep 21 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
9.2.0 ✅ gcw_kUomxQ2l, caodongdong (2/2) ✅ gcw_kUomxQ2l (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
Sep 21 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,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,WenboCodes as approver
CANN-robotCANN-robotCollaborators
Sep 21 Set yinjie27_,caodongdong,make_pto,linjiashu as approver
zhiweiyuan
zhiweiyuanCollaborators
Sep 21 Comments:

compile

likedislike
zhiweiyuanzhiweiyuanCollaborators
Sep 21 Pre merge succeeded (commit_id: af441ba0316588de1695a0057fd7adbe233a70b7)
CANN-robot
CANN-robotCollaborators
Sep 21 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 21 Added label: ci-pipeline-running
zhiweiyuanzhiweiyuanCollaborators
Sep 21 Change title to "fix(simulation): Register ERF pipe type and fallback unknown opcodes", originally titled "fix(simulation): Register ERF pipe type and fallback unknown opcodes [9.2.0]".
CANN-robotCANN-robotCollaborators
Sep 21 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 21 Added label: ci-pipeline-passed
曹慧林
曹慧林Collaborators
Sep 21 Comments:

/lgtm

likedislike
曹慧林曹慧林Collaborators
Sep 21 Approval passed
曹慧林曹慧林Collaborators
Sep 21 Approval passed
liulun0308
liulun0308Collaborators
Sep 21 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 21 Added label: lgtmapproved
CANN-robotCANN-robotCollaborators
Sep 21 Merged pull request