已关闭
CCU kernel cache reuses handles across instances #48
KaranocaVe创建于 28 天前关闭于 5 天前
28 天前 关联了pull request:[Bugfix] Scope cached CCU kernel handles by instance and die
28 天前 修改了issue 的描述
KaranocaVe
27 天前 评论:
27 天前 评论:
/assign


27 天前 将 KaranocaVe 设为负责人
cellur_z
9 天前 评论:
9 天前 评论:
Thanks for the detailed report. Your analysis is correct: the current cache key only contains binary_cache_tag, so a handle can be incorrectly reused across CCU instances and dies.
We will review MR !234 as soon as possible.


9 天前 将 zhao_lulu 设为负责人
cellur_z
5 天前 评论:
5 天前 评论:
您的代码已合入,感谢您对本社区的贡献,目前将关闭本issue,如果有后续问题,欢迎您再来提问讨论~


5 天前 issue状态由 进行中 改变为 已完成
5 天前 关闭了 issue
5 天前 添加了label:resolved
KaranocaVe
3 天前 评论:
3 天前 评论:
@zhao_lulu 您好,这个 Issue 对应的修复已经合入:https://gitcode.com/cann/asc-comm/merge_requests/234
开发者计划反馈,Issue 需要有 Accepted 标签才能计入积分,仅关闭或标记 resolved 还不够。目前这条 Issue 尚未标记 Accepted,麻烦您结合问题和已合入的修复复核一下;确认符合受理条件后,帮忙补上 Accepted 标签。
感谢您的支持!


CCU kernel cache reuses handles across instances
At source commit
79de7e489db8db78f8fe3b616682099a888a204d, the process-wideKernelHandleCacheuses onlybinary_cache_tagas its key. A cachedCcuKernelHandleis created byHcommCcuKernelRegisterfor a particularccu_insand die, so the same tag on another instance or die incorrectlyreuses a handle from the first registration and skips registration for the new
configuration.
The regression test confirms the mismatch: with one shared tag, the second
instance launch keeps the first instance's handle, and a different die also
reuses that handle. Repeated launches for the same instance and die should
continue to reuse their registration.
The fix keys cached handles by binary tag, CCU instance identity, and physical
die mask. The change is limited to the host launch cache and its unit test.
Validation
Validation
Fixed source and scope
cann/asc-comm79de7e489db8db78f8fe3b616682099a888a204dsrc/ccu/ccu_host_launch.cppandtests/ut/ccu/test_ccu_host_launch.cppBaseline regression
Added
TestCcuHostLaunch.BinaryCacheTagIsScopedToCcuInstanceto the fixedsource without changing the implementation, then built and ran
asccomm_ut_ccu_host_launch. The baseline result was 11/12 passed. The newtest failed because the second instance did not cause another registration:
the observed registration instance remained
0x11instead of0x22, and thelaunch reused the first handle. The different-die check likewise reused the
first die's handle.
Fixed result
After applying
fix.patch, the same build target and test executable passedall 12 tests:
The summary was
[ PASSED ] 12 tests.CTest did not register this target, sothe test executable was run directly. No NPU or device operation was used.
Patch and checklist review
git apply --check --whitespace=error-all fix.patchpassed against a cleancheckout of the fixed source commit;
git apply --statlists only the twofiles above.
clang-format --dry-run --Werrorpassed for both changed C++ files usingclang-format 18.1.8, matching the target repository's configured version.
git diff --checkpassed for the source diff.The result establishes the host-side cache-key bug and its regression fix. It
does not claim runtime verification on CCU hardware.
Additional checks
including clang-format 18.1.8, OAT, codespell, and file-integrity checks.
The fixed-source validation above records all 12
host unit tests passing.
关联 PR: https://gitcode.com/cann/asc-comm/merge_requests/234