Merged
fix(ir): Machine depends incast/outcast not share same slot #5474
lidongshengAdd on Aug 17
fix(ir): Machine depends incast/outcast not share same slot #5474
Merged
lidongshengAdd on Aug 17
lidongsheng
lidongshengCollaborators
Aug 17

Related Issue: #2559

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for lidongsheng's contribution.)
lidongshenglidongshengCollaborators
Aug 17 Created pull request, commit e7952b8f
lidongshenglidongshengCollaborators
Aug 17 Associated issue: [Task|任务跟踪]: 新IR适配
atomgit-bot
atomgit-bot
Aug 17 Comments:

变更摘要

该 PR 修复了 Machine 依赖场景下 incast 与 outcast 不应共享同一 slot 的问题(关联 Issue #2559)。核心改动位于 RootFunctionBuilder::BuildPathFuncSlotScope:当 incast 与 outcast 的底层张量 memoryId 相同时,不再通过 slotManager->SetSameSlot(incast, outcast) 强制二者共享槽位,而是将二者的关联关系记录到 pathFunc->outIncastLinkMap 中,从而改变 incast/outcast 依赖关系的表达方式。

主要改动

  • 移除共享槽位逻辑: 在 BuildPathFuncSlotScope 中删除了 slotManager->SetSameSlot(incast, outcast) 调用,不再强制使 incast 与 outcast 复用同一 slot。
  • 新增 incast/outcast 关联映射: 改为通过 pathFunc->outIncastLinkMap[incast->tensor] = outcast->tensor 记录二者的依赖关联,以 incast->tensor 为键、outcast->tensor 为值保存到 outIncastLinkMap 字段中。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Aug 17 Comments:

代码审查

审查结论

已审查变更文件 framework/src/interface/tensor/ir_func_builder.cpp,共发现 1 个问题。

各文件审查结果

  • framework/src/interface/tensor/ir_func_builder.cpp:发现 1 个 P1 问题(BuildPathFuncSlotScope 中 outIncastLinkMap 键值写反)。

问题统计

  • P0:0
  • P1:1
  • P2:0
  • P3:0

总体风险判断

该变更意图正确(不再让 incast/outcast 共享 slot,改为记录 inplace 关联),但新增行的键值方向与全库 outIncastLinkMap 约定(键=outcast、值=incast)相反,导致机器端按 outcast 键查找时关联信息丢失、本 PR 想修复的功能实际不生效,存在功能性回归风险。建议交换键值后合入。

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

⛔ 需要修改

likedislike
Incorrect?
lidongsheng
lidongshengCollaborators
Aug 17 Comments:

compile

likedislike
152 messages are collapsed here。 See more
Jie Yin
Jie YinCollaborators
Aug 19 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Aug 19 Added label: approved
杨旭
杨旭Collaborators
Aug 19 Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Aug 19 Added label: lgtm
CANN-robotCANN-robotCollaborators
Aug 19 Merged pull request