已合并
refactor: 统一 soc version chipType 获取链路 #1795
refactor: 统一 soc version chipType 获取链路 #1795
已合并
daijinling创建于 4月24日
daijinling成员
4月24日

描述

本次改动统一了 Runtime 中 socVersion -> chipType 的获取链路,将原先依赖各平台 dev_info_reg.cc 静态注册表的方式,迁移为从平台 ini 配置 [version] 段的 Chip_type 字段读取。

主要改动包括:

  1. 新增 GetChipTypeFromPlatform 接口,通过 PlatformManagerV2::GetSocSpec 读取并解析 Chip_type,同时补充空指针、字段缺失、非法值和越界等异常校验。
  2. 改造 rtSetSocVersion,使用平台配置获取 chipType,移除对 SOC_INFO 注册表的依赖,并保留硬件 SoC 版本一致性校验和设备属性更新逻辑。
  3. 改造 Runtime 初始化流程,在 halGetSocVersion 成功返回有效 socVersion 时,直接从平台配置获取 chipType;在旧硬件版本路径中保留 legacy fallback。
  4. 清理 DevInfoManage 中不再使用的 socInfo/devInfo 注册、批量注册、查询接口及相关容器和锁,删除各平台 BATCH_REGISTER_DEV_INFOBATCH_REGISTER_SOC_INFO 相关注册数据。
  5. 为 CANN、CANN-DEV、Kirin 等平台 ini 文件补齐 [version] 段的 Chip_type 字段,使 chipType 映射归一到配置文件。
  6. 更新平台 stub 和相关 LLT 用例,适配新的平台配置读取链路。

关联的Issue

https://gitcode.com/cann/runtime/issues/431

测试

新增/更新了 GetChipTypeFromPlatformrtSetSocVersion、Runtime 初始化及 DevInfoManage 相关 LLT 用例,覆盖 Chip_type 获取成功、字段缺失、非法值、越界、查询失败、空指针输入以及硬件 SoC 版本不一致等场景。

文档更新

新增 docs/runtime_soc_version_chiptype_refactor_design.md,说明 SoC Version / ChipType 重构背景、目标、总体方案、接口改造、初始化流程、配置迁移、测试适配和风险分析。

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 daijinling 的贡献)
Ddaijinling成员
4月24日 创建了 pull request,commit 77f4083a
CANN-robotCANN-robot成员
4月24日 添加了label:stat/needs-squash
CANN-robot
CANN-robot成员
4月24日 评论:

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/platform shikai-1, 卢煜坤, 王涛 (3/2) shikai-1 (1/1)
src/runtime 王涛, 卢煜坤 (2/2) 王涛, 卢煜坤 (2/1)
src/runtime/cmake/runtime.cmake 王涛, 卢煜坤 (2/2) 王涛, 卢煜坤 (2/1)
src/runtime/config 卢煜坤, 王涛 (2/2) 王涛, 卢煜坤 (2/1)
tests/ut/runtime 王涛, 卢煜坤 (2/2) 王涛, 卢煜坤 (2/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

daijinling, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
4月24日 添加了label:cann-cla/yes
CANN-robotCANN-robot成员
4月24日 将zhaozhixuan,wda1991,wangtao43,zhangpengpeng8,changhaixun,yanmingxiang,turing_yhy,Reyn52166,gcw_9B2nSsjo,luoyuzhou2,Turing_JasonWen,shikai-1,Axiaolei,ykl999,sunnana_004434229,houyanbao,wangluyao17,zhou-wuxiao,tingwood设为评审人
此处折叠了209条消息 查看更多
wangtao成员
5月13日 评论:

/lgtm

likedislike
ykl999
ykl999成员
5月13日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
5月13日 添加了label:lgtm
CANN-robot
CANN-robot成员
5月13日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: 卢煜坤, 王涛, shikai-1.
Reviewers who wrote a comment of /lgtm are: 王涛, 卢煜坤, shikai-1.

likedislike
CANN-robotCANN-robot成员
5月13日 合入了pull request