Merged
fix(interface): Prevent dynamic kernel hash collision after reset #5617
高前程Add on Aug 22
fix(interface): Prevent dynamic kernel hash collision after reset #5617
Merged
高前程Add on Aug 22
高前程
高前程Collaborators
Aug 22

将DYNAMIC类型的Function magic与其他function分开管理,并且在复跑时不复用,避免在这一层计算哈希时哈希冲突

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for 高前程's contribution.)
高前程高前程Collaborators
Aug 22 Created pull request, commit 040c99af
atomgit-bot
atomgit-bot
Aug 22 Comments:

变更摘要

本 PR 修复了 framework/src/interface/function/function.cpp 中函数 Magic 哈希生成不完整导致的碰撞问题:a_trans 场景下矩阵 A 的 shape 为 [K, M],K 位于 rawshape[0],而原实现要么跳过 dim0(当作 batch 处理)、要么只在 STATIC 边界操作时哈希 rawshape,使得仅 K 不同的两个 matmul(如 C1 K=6144 与 C2 K=8192)生成相同的哈希,进而共享同一个 dy_kernel_<hash>.o / leafDict。改动将 rawshape 的哈希改为包含 dim0,并扩展到所有函数类型。

主要改动

  • ProducerMagicLookup 哈希范围改为从索引 0 开始:STATIC 函数边界操作的 rawshape 哈希循环由 idx = 1 改为 idx = 0,不再默认跳过 dim0,从而将 K 纳入哈希,避免仅 K 不同的 kernel 哈希碰撞。
  • MagicLookup 对所有函数类型补充 GM rawshape 哈希:当 t->tensor != nullptr 时,将 tensor->rawshape 全维度追加进 ss,覆盖不进入 STATIC 分支的新 IR 路径(DYNAMIC_LOOP_PATH,其 dy_kernel 文件名基于 DYNAMIC 父级哈希),补齐 a_trans 下 rawshape[0] 上 K 的哈希。
  • 保留原有的 shape 信息写入逻辑:MagicLookup 中原有的逻辑 tile/view shape(含 DYNAMIC -1)与 STATIC 类型的 oriShape 哈希保持不变,仅在哈希内容上增加 GM rawshape。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Aug 22 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Aug 22 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Aug 22 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/interface/function ✅ DCGDDD, tsungl4 (2/2) ✅ DCGDDD (1/1)
framework/src/interface/program ✅ DCGDDD, tsungl4 (2/2) ✅ DCGDDD (1/1)
framework/src/interface/tensor ✅ DCGDDD, tsungl4 (2/2) ✅ DCGDDD (1/1)
framework/src/interface/utils ✅ DCGDDD, tsungl4 (2/2) ✅ DCGDDD (1/1)
repo-cann/pypto ✅ DCGDDD, tsungl4 (2/2) ✅ DCGDDD (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
118 messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
Aug 26 Added label: ci-pipeline-passed
lidongsheng
lidongshengCollaborators
Aug 27 Comments:

/lgtm

likedislike
杨旭
杨旭Collaborators
Aug 27 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Aug 27 Added label: lgtmapproved
CANN-robotCANN-robotCollaborators
Aug 27 Merged pull request