已合并
[feat] 完善 ACLRTC `ResourceRegistry` 的资源发现、动态库加载和文件物化流程 #5167
sjtulxh创建于 11 天前
[feat] 完善 ACLRTC `ResourceRegistry` 的资源发现、动态库加载和文件物化流程 #5167
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 sjtulxh 的贡献)atomgit-bot
11 天前 评论:
11 天前 评论:
变更摘要
本 PR 完善了 ACLRTC ResourceRegistry 的资源发现、动态库加载与文件物化流程:显式加载不再支持目录扫描、只接受普通 SO 文件;在加载 SO、解析 OPP vendor 配置及物化资源前统一规范化路径,拦截非规范化路径与软链接逃逸;单个 SO 加载或 manifest 解析失败时仅告警并跳过该 SO,其暂存资源不会部分提交,其余 SO 继续处理;同时补充 DFX 日志、明确 lambda 捕获范围,并更新 Load 接口注释与相关测试。
主要改动
- 显式加载仅接受普通 SO 文件:
ResolveExplicitDiscoveryPath移除目录分支,目录输入直接返回InvalidResource;DiscoverLibraries显式模式不再做目录内CollectLibraries扫描,改为仅校验并注册单个规范化后的 SO。 - 加载与发现前规范化路径:
LoadLibrary在dlopen前通过ResolveCanonicalPath规范化 SO 路径并全程使用规范化路径记录日志;AutomaticSearchRoots对 OPP root 与vendors/config.ini先规范化再解析 vendor 配置。 - 物化路径规范化与软链接逃逸拦截:
WriteMaterializedFiles对输出 root 与父目录做规范化,并通过IsPathWithin校验父目录位于 root 之内,拒绝软链接重定向写入 root 之外,写入改用规范化路径。 - 单 SO 失败继续加载且暂存不提交:
LoadLibraries改为按 SO 独立暂存(libraryStage),成功后经新增的MergeStagedLibrary合并资源(冲突或超限时跳过),失败仅告警并继续,全部失败时返回首个错误;Commit中的checkCategorylambda 明确[this, &status]捕获,HasCommitConflict改为const成员函数。 - 接口文档与测试更新:
resource_registry.h更新Load注释,明确显式加载不支持目录输入;test_resource_registry.cpp新增/调整用例覆盖目录拒绝、SO 路径规范化、单 SO 失败继续加载、暂存不提交、OPP 路径规范化及物化软链接逃逸拦截。


atomgit-bot
11 天前 评论:
11 天前 评论:
11 天前 添加了label:cann-cla/yes
CANN-robot
11 天前 评论:
11 天前 评论:
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.
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 |
|---|---|---|
| repo-cann/asc-devkit | ✅ 诸葛洵, XuebinYang (2/2) | ✅ 诸葛洵 (1/1) |
| tools/aclrtc | ✅ YANXI_ZHAO, 诸葛洵, XuebinYang (3/2) | ✅ YANXI_ZHAO (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
sjtulxh, thanks for your pull request. All authors of the commits have signed the CLA. 👍


此处折叠了43条消息 查看更多
YANXI_ZHAO
11 天前 评论:
11 天前 评论:
/lgtm
/approve


11 天前 添加了label:approved
XuebinYang
11 天前 评论:
11 天前 评论:
/lgtm


11 天前 添加了label:lgtm
11 天前 合入了pull request
描述
完善 ACLRTC
ResourceRegistry的资源发现、动态库加载和文件物化流程:Load接口注释。关联的Issue
无。
测试
test_resource_registry.cpp,覆盖:ascendc_ut_aclrtc:89/89 用例通过。文档更新
更新
resource_registry.h中Load接口说明,明确显式加载不支持目录输入。类型标签