Merged
fix(codegen): Bind local buffers before skipping VIEW/RESHAPE ops #6279
anyangleAdd on Sep 14
fix(codegen): Bind local buffers before skipping VIEW/RESHAPE ops #6279
Merged
anyangleAdd on Sep 14
anyangle
anyangleCollaborators
Sep 14

问题背景:

codegen对SKIP_OPCODE_FOR_CODEGEN中的op会直接continue,连GenAllocForLocalBuffer一并跳过。Mix拆leaf子图后,C,V共用同一memId的UB时,needAlloc被打在被skip的RESHAPE/VIEW输出上,codegen未bind;后续COPY_OUT读的是VIEW后的新tensor(未带needAlloc),导致codegen报SYMBOL_NOT_FOUND。

解决方案:

在 CodeGenCloudNPU::GenFuncBody / CodeGenLiteNPU::GenFuncBody 中,将 GenAllocForLocalBuffer(op, symbolMgr) 移到 SKIP_OPCODE_FOR_CODEGEN 判断之前:

  • skip op:仍不 GenOpCode,但会消费 in/out 上的 needAlloc 完成 bind(同一 AllocKey 二次调用 reuse,安全)
  • 非 skip op:行为与原来一致
likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for anyangle's contribution.)
anyangleanyangleCollaborators
Sep 14 Created pull request, commit f09d80cb
atomgit-bot
atomgit-bot
Sep 14 Comments:

🤖 AI Code Review

⚠️ 审查未能完成

本次代码审查未能完成,可能是临时性故障。

你可以在评论区输入 /ai summary 重新发起审查。若多次失败,请联系管理员并附上下方追踪 ID。

追踪 ID: task-283729

likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 14 Comments:

🤖 AI Code Review

⚠️ 审查未能完成

本次代码审查未能完成,可能是临时性故障。

你可以在评论区输入 /ai review 重新发起审查。若多次失败,请联系管理员并附上下方追踪 ID。

追踪 ID: task-283730

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 14 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Sep 14 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
framework/src/codegen ✅ make_pto, lululu40888 (2/2) ✅ make_pto (1/1)
framework/src/codegen/npu/litenpu ✅ make_pto, lululu40888 (2/2) ✅ make_pto (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
Sep 14 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 14 Set lululu40888,yinjie27_,make_pto,linjiashu as approver
anyangleanyangleCollaborators
Sep 14 Associated issue: [Bug-Report|缺陷反馈]: Codegen skip RESHAPE/VIEW 时未消费 needAlloc 导致 SYMBOL_NOT_FOUND
anyangle
anyangleCollaborators
Sep 14 Comments:

compile

likedislike
anyangleanyangleCollaborators
Sep 14 Pre merge succeeded (commit_id: be6ec27bf143e8956e36aecb878ca280076815b8)
CANN-robot
CANN-robotCollaborators
Sep 14 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 14 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 14 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 14 Added label: ci-pipeline-passed
anyangleanyangleCollaborators
Sep 15 Modify description of pull request
make_pto
make_ptoCollaborators
Sep 15 Comments:

/approve

likedislike
make_ptomake_ptoCollaborators
Sep 15 Approval passed
make_ptomake_ptoCollaborators
Sep 15 Approval passed
CANN-robotCANN-robotCollaborators
Sep 15 Added label: approved
huanglu
huangluCollaborators
Sep 15 Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Sep 15 Added label: lgtm
CANN-robotCANN-robotCollaborators
Sep 15 Merged pull request