| 【PR】: refactor: 拆分Runtime生命周期重构基础能力
Co-authored-by: xiangyang0909<huxiangyang1@huawei.com>
# message auto-generated for no-merge-commit merge:
!2559 merge future/lifecycle_pr1a_foundation into master
【PR】: refactor: 拆分Runtime生命周期重构基础能力
Created-by: xiangyang0909
Commit-by: xiangyang0909
Merged-by: cann-robot
Description: # Pull Request
## 描述
本 PR 是 Runtime 生命周期重构拆分后的 基础部分第一批次,聚焦低耦合的生命周期地基和叶子对象整改,不包含 Runtime/Context/Stream/Event/Notify/Model/Pool/SOMA/RawDevice/npu_driver_queue 主链,也不包含 P0 direct-exit 专项。
主要变更:
- 提取 runtime handle guard 初始化/失效 helper,保持 handle 失效语义集中可读。
- 拆分 InitCallbackManager 注册/反注册/通知公共逻辑,补充 OTHER 类型 callback 顺序验证。
- 为 AicpuErrMsg、ArgLoader、UbArgLoader、UmaArgLoader、CtrlResEntry、TaskFactory、DeviceSnapshot、Module 等低耦合对象补充显式 TearDown 或幂等收口。
- 为 KernelTable、Program、Label 等对象补充析构职责拆分 helper 和 handle invalid 验证。
- 补充对应 UT,覆盖 TearDown 幂等、destroy 后 handle invalid、callback 顺序等基础语义。
本 PR 目标是先合入生命周期重构的基础能力,降低后续主链整改的检视范围和合入风险。
## 变更类型
请选择本次引入的变更类型:
<!-- [x] 表示选中 -->
- [ ] 🐛 Bug 修复
- [ ] ✨ 新功能
- [ ] 💄 代码风格更新(格式化,局部变量)
- [x] ♻️ 重构(既不修复错误也不增加功能的代码变动)
- [ ] 📦 构建过程或辅助工具的变动
- [ ] 📝 文档内容更新
## 关联的Issue
无。
## 如何测试
描述测试此变更的步骤和前提条件:
1. git diff --check --ignore-cr-at-eol upstream/master...HEAD
2. cmake --build build -j1 --target runtime_utest
3. cmake --build build -j1 --target runtime_utest_api_910B
4. cmake --build build -j1 --target ascendcl_utest
5. cmake --build build -j1 --target runtime_utest_model runtime_utest_task_normal
6. build/tests/ut/runtime/runtime/runtime_utest --gtest_filter='AicpuErrMsgTest.TearDownIsIdempotent:ArgLoaderTest.uma_arg_loader_teardown_is_idempotent:CtrlTaskPoolEntryTest.TearDownIsIdempotent:KernelTest.kernel_table_destroy_releases_remaining_kernels:ModuleTest.TearDownIsIdempotent:ProgramTest.Program_Destructor_Skip_KernelNameMap_Duplicate'
7. build/tests/ut/runtime/runtime/test/platform/910B/runtime_utest_api_910B --gtest_filter='CloudV2AicpuErrMsgTest.TearDownIsIdempotent:CloudV2ArgLoaderTest.uma_arg_loader_teardown_is_idempotent:SnapshotTest.DeviceSnapshotTearDownIsIdempotent'
8. build/tests/ut/acl/testcase/ascendcl_cpp_utest --gtest_filter='UTEST_ACL_Runtime.InitCallbackManager_NotifyOrderForOtherType:UTEST_ACL_Runtime.InitCallbackManager_FinalizeNotifyOrderForOtherType'
9. build/tests/ut/runtime/runtime/runtime_utest_model --gtest_filter='LabelTest.label_handle_invalid_after_destroy'
10. build/tests/ut/runtime/runtime/runtime_utest_task_normal --gtest_filter='TaskTest.TaskFactory_TearDownIsIdempotent'
补充说明:高并发构建曾出现 cc1plus Killed,判断为本地资源压力;上述目标均已用 -j1 顺序重跑通过。
## 核对清单
<!-- [x] 表示选中 -->
- [x] 我的代码遵循了项目的代码风格
- [x] 我已对代码进行了自测
- [x] 我已更新了相关的文档
- [x] 我在标题中使用了合适的类型标签(如:feat:, fix:)
- [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等
## 其他信息
- 源分支:xiangyang0909:future/lifecycle_pr1a_foundation
- 目标分支:cann/runtime:master
- 提交:ebd59cd3fc9869810a264f3a855e19c92ffc2d9a
- 忽略行尾统计:38 files changed, 507 insertions(+), 71 deletions(-)
See merge request: cann/runtime!2559 | 19 小时前 |