合并受阻
变更摘要
本 PR 修复主机侧启动缓存仅以 binary_cache_tag 作为键导致跨 CCU 实例、跨物理 die 复用错误 kernel handle 的问题。核心改动集中在 src/ccu/ccu_host_launch.cpp 的 KernelHandleCache:在缓存键中引入 CCU 实例身份与物理 die 掩码,使 kernel 注册仅在二进制标签、CCU 实例、物理 die 三者一致时才复用;tests/ut/ccu/test_ccu_host_launch.cpp 增加了对应的宿主单元测试。
主要改动
- 缓存键结构重构:新增
KernelCacheKey结构,包含binaryCacheTag、CcuInstanceCacheIdentity instance、phyDieMask三个字段,并定义operator==用于精确匹配缓存条目。 - 实例身份提取机制:新增
CcuInstanceCacheIdentity及CcuInstanceCacheIdentityTraits模板,通过 SFINAE 从CcuInsHandle中提取ccuInsKey与ccuInsPtr,缺省情况下回退为 handle 与 0,从而把 CCU 实例身份纳入缓存键。 - 缓存容器类型变更:
KernelHandleCache内部缓存由std::unordered_map<uint64_t, CcuKernelHandle>改为std::unordered_map<KernelCacheKey, CcuKernelHandle, KernelCacheKeyHash>,并新增KernelCacheKeyHash哈希实现。 - 匹配流程调整:
KernelHandleCache::Match中改为根据cacheTag、cfg->ccu_ins实例身份和cfg->ccu_schd.phy_die_mask构造cacheKey进行查找与写入,取代原先仅以cacheTag索引。 - 单测覆盖扩展:测试桩
HcommCcuKernelRegister增加记录insHandle与dieId的g_observedRegisterIns、g_observedRegisterDie及调用计数g_registerKernelCallCount,并新增BinaryCacheTagIsScopedToCcuInstance用例验证同实例复用与跨实例/跨 die 隔离。


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
⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| src | ❌ (0/2)(You can also ask: YeZZzzz1, 李东锋, chenma, bianque, bluesky901) | ❌ (0/1)(You can also ask: changxianyu, 肖婷, YeZZzzz1, 闫庆尚, 石楠翔) |
| tests | ❌ (0/2)(You can also ask: bianque, YeZZzzz1, hyolee, kong0808, dengjing_aoe) | ❌ (0/1)(You can also ask: 苏建加, 肖婷, 闫庆尚, YeZZzzz1, qin437231) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
KaranocaVe, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


[Bugfix] Scope cached CCU kernel handles by instance and die
Problem
The host launch cache is keyed only by
binary_cache_tag. When two CCUinstances use the same tag, the second launch reuses the kernel handle
registered for the first instance. The same issue occurs across physical dies.
Reproduction
Launch the same kernel with the same
binary_cache_tagfirst on one CCUinstance and then on a different instance, or use a different physical die.
The second launch reuses the first registration instead of registering the
kernel for its own instance and die.
Expected and actual behavior
and physical die are the same.
different instance or die is reused.
Impact
Kernel launches can use a handle registered for the wrong CCU instance or
physical die when identical binary cache tags are used.
Fix
Include the CCU instance identity and physical die mask in the cache key, and
cover same-instance reuse and cross-instance/die isolation in the host unit
test.
Verification
The regression fails on the original implementation and passes with the fix.
The
asccomm_ut_ccu_host_launchsuite passes all 12 tests.关联 Issue: https://gitcode.com/cann/asc-comm/issues/48