Pull Request已成功合入, 合并人@CANN-robot
(感谢 zhengjinwei_y 的贡献)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
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| src/base_comm | ✅ Innoecho, hulk1997 (2/2) | ✅ Innoecho (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
zhengjinwei_y, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


流水线任务触发成功
任务链接 [ca75f48b7964410f9e9dc50deaff362f][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| ST_Test | ✅ SUCCESS | ||
| API_Check | ✅ SUCCESS | >>>>> | |
| codecheck | ✅ SUCCESS | >>>>> | |
| codecheck_style | ✅ SUCCESS | >>>>> | |
| UT_Test | ✅ SUCCESS | >>>>> | |
| precommit | ⚠️ WARNING | >>>>> | >>>>> |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| PreSmoke_A3_npupool | ✅ SUCCESS | >>>>> |
[2026-06-26 17:44:06] CI执行结束


变更摘要
本次变更是一个 Bug 修复,针对 CcuKernelMgr 类中 kernelMap_ 的并发访问问题,新增了 std::mutex 成员 kernelMapMutex_,并在所有访问 kernelMap_ 的成员函数中加入 std::unique_lock 保护,以防止多线程竞态条件导致的数据不一致。
主要改动
- 新增互斥锁成员:在
CcuKernelMgr类头文件中新增std::mutex kernelMapMutex_成员变量,用于保护kernelMap_的并发安全。 Init与Deinit加锁:在CcuKernelMgr::Init()和CcuKernelMgr::Deinit()中对kernelMap_的清理操作(clear())加上std::unique_lock保护。Register与UnRegister加锁:在CcuKernelMgr::Register()和CcuKernelMgr::UnRegister()中对kernelMap_的插入、删除操作加上互斥锁保护。Translate与GetKernel加锁:在CcuKernelMgr::Translate()中遍历kernelMap_查找 kernel 指针、在CcuKernelMgr::GetKernel()中查询kernelMap_时均加入锁保护;其中Translate()在提取完 kernel 指针后主动unlock()以缩小临界区。




compile


流水线任务触发成功
任务链接 [732e74aba63d44db84cdd875e954be85][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| ST_Test | ✅ SUCCESS | ||
| API_Check | ✅ SUCCESS | >>>>> | |
| codecheck | ✅ SUCCESS | >>>>> | |
| codecheck_style | ✅ SUCCESS | >>>>> | |
| UT_Test | ✅ SUCCESS | >>>>> | |
| precommit | ⚠️ WARNING | >>>>> | >>>>> |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| PreSmoke_A3_npupool | ✅ SUCCESS | >>>>> |
[2026-06-29 19:29:39] CI执行结束




compile


流水线任务触发成功
任务链接 [8a455660ebb04fc99950673d97c41cb7][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| ST_Test | ✅ SUCCESS | ||
| API_Check | ✅ SUCCESS | >>>>> | |
| codecheck | ✅ SUCCESS | >>>>> | |
| codecheck_style | ✅ SUCCESS | >>>>> | |
| UT_Test | ✅ SUCCESS | >>>>> | |
| precommit | ⚠️ WARNING | >>>>> | >>>>> |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| PreSmoke_A3_npupool | ✅ SUCCESS | >>>>> |
[2026-07-02 10:43:36] CI执行结束




compile


流水线任务触发成功
任务链接 [88eeba9a05fb4e31aa3aef910d3c49a6][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| ST_Test | ✅ SUCCESS | ||
| API_Check | ✅ SUCCESS | >>>>> | |
| codecheck | ✅ SUCCESS | >>>>> | |
| codecheck_style | ✅ SUCCESS | >>>>> | |
| UT_Test | ✅ SUCCESS | >>>>> | |
| precommit | ⚠️ WARNING | >>>>> | >>>>> |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| PreSmoke_A3_npupool | ✅ SUCCESS | >>>>> |
[2026-07-08 10:41:17] CI执行结束




简要描述
CcuKernelMgr 为 kernelMap_ 操作增加独立互斥锁,缩小 Translate 函数锁粒度
问题描述
Translate 函数原使用 translateMutex_ 同时保护 kernelMap_ 查找和后续翻译流程,导致:
解决方案
影响范围
新增用例
变更类型
请选择本次引入的变更类型:
关联的Issue
https://gitcode.com/cann/hcomm/issues/286
测试
已完成的测试用例和场景:
补充的UT用例:
文档更新
合入检查