已合并
修改GetArchVersion接口 #4888
Chen Ning创建于 8月5日
修改GetArchVersion接口 #4888
已合并
Chen Ning创建于 8月5日
Chen Ning
Chen Ning成员
8月5日

描述

修改GetArchVersionasc_get_arch_ver接口实现,直接返回架构号

由于以上两个接口调用的底层指令get_arch_ver固定返回芯片寄存器内的版本信息,该信息与AscendC对外呈现的架构版本号不一致,容易引起用户困惑。

调整上述接口实现,直接返回对应的架构版本号,确保接口行为与对外定义保持一致

关联的Issue

测试

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 Chen Ning 的贡献)
Chen NingChen Ning成员
8月5日 创建了 pull request,commit cd1683d3
atomgit-bot
atomgit-bot
8月5日 评论:

变更摘要

此 PR 修改了 GetArchVersion 相关接口的实现方式:将原先通过调用 get_arch_ver() 硬件指令读取寄存器并从中提取架构版本号的做法,改为在各架构特定的实现文件中直接返回编译期硬编码的架构号常量。同时移除了不再需要的位操作逻辑、asc_capi_arch_version 联合体定义以及测试中对 mockcpp/get_arch_ver 的 mock 依赖,并新增了 3510 架构的测试用例。

主要改动

  • GetArchVersionImpl 实现简化:在 dav_3510dav_c220dav_m200 三个架构的实现中,将原本读取 get_arch_ver() 并进行位偏移/掩码提取的逻辑替换为直接返回对应架构号常量(3510U2201U2002U)。
  • asc_get_arch_ver_impl 实现简化:在 npu_arch_2201npu_arch_3510 的 C API 实现中,将原本通过 asc_capi_arch_version 联合体解析 get_arch_ver() 返回值的方式替换为直接返回对应架构号(2201U3510U)。
  • 移除 asc_capi_arch_version 联合体:在 npu_arch_2201/utils_impl/utils_impl.h 中删除了用于解析架构版本的 asc_capi_arch_version 联合体定义,因其已不再需要。
  • GetArchVer 实现简化:在 dav_c220/kernel_operator_reg_others_impl.h 中,将 GetArchVer() 从调用 get_arch_ver() 改为直接返回 2201
  • 测试用例更新与新增:现有测试用例移除了 mockcppget_arch_ver 的 mock 和位运算验证逻辑,改为直接断言返回值为预期架构号;同时新增 ascendc_case_ascend950pr_9599 测试文件,验证 GetArchVersion 返回 3510U
likedislike
不准确?
atomgit-bot
atomgit-bot
8月5日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
Chen Ning
Chen Ning成员
8月5日 评论:

compile

likedislike
CANN-robotCANN-robot成员
8月5日 添加了label:cann-cla/yes
此处折叠了131条消息 查看更多
Chen NingChen Ning成员
8月12日 解决了最后一个问题
chenyiyuan成员
8月12日 评论:

/lgtm
/approve

likedislike
CANN-robot
CANN-robot成员
8月12日 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
wuzhaolin

likedislike
CANN-robotCANN-robot成员
8月12日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
8月12日 合入了pull request