已合并
FEAT: A5 CTRL寄存器接口补充 #5135
yiming创建于 12 天前
FEAT: A5 CTRL寄存器接口补充 #5135
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 yiming 的贡献)atomgit-bot
12 天前 评论:
12 天前 评论:
变更摘要
本 PR 主要面向 A5(__NPU_ARCH__ == 3510)补齐 CTRL 寄存器相关接口:一方面新增标量 L2 cache 模式的读写接口,用于配置和查询 load/store 的缓存模式;另一方面新增饱和标志与饱和策略的读写接口,通过操作 CTRL 寄存器对应位来实现单指令饱和设置或全局饱和策略切换。同时补充了相关枚举定义、公开头文件声明以及配套的 host 端接口检查与 npu_arch_3510 单元测试。
主要改动
- 新增标量 cache 模式读写接口:在
include/c_api/cache_ctrl/cache_ctrl.h中新增asc_set_scalar_cache_mode、asc_get_scalar_load_cache_mode、asc_get_scalar_store_cache_mode声明,并在cache_ctrl_impl.h及asc_set_scalar_cache_mode_impl.h、asc_get_scalar_cache_mode_impl.h中实现,分别操作 CTRL[19:16](load)和 CTRL[23:20](store),支持NORMAL_FIRST_VICTIM、NORMAL_LAST_VICTIM、NORMAL_PERSISTENT、NOTALLOC_KEEP、NOTALLOC_CLEAN、NOTALLOC_DROP等模式,并对未知编码回退到默认模式。 - 新增饱和标志读写接口:在
include/c_api/sys_var/sys_var.h中新增asc_set_saturation_flag、asc_get_saturation_flag声明,并在sys_var_impl.h及对应 impl 文件中实现,按asc_saturation_mode映射到 CTRL[48](FLOAT)、CTRL[50](FLOAT8)、CTRL[53](INT)、CTRL[59](CAST)对应位,INT 模式与非 INT 模式的位含义采用相反语义。 - 新增饱和策略读写接口:在
include/c_api/sys_var/sys_var.h中新增asc_set_saturation_strategy、asc_get_saturation_strategy声明,并在对应 impl 文件中实现,通过 CTRL[60] 位在USE_API(单指令设置)与USE_GLOBAL(全局设置)之间切换。 - 新增枚举定义:在
include/c_api/utils/enum.h中新增asc_saturation_mode(FLOAT、FLOAT8、INT、CAST)和asc_override_strategy(USE_API、USE_GLOBAL),并注释说明各自对应的 CTRL 位。 - 补充测试与接口检查:新增
test_asc_scalar_cache_mode.cpp、test_asc_saturation_flag.cpp、test_asc_saturation_strategy.cpp单元测试,覆盖各模式/标志位的读写、往返及保留其他位场景,并在 host 端 checker 中登记新增接口。


atomgit-bot
12 天前 评论:
12 天前 评论:
12 天前 添加了label:cann-cla/yes
CANN-robot
12 天前 评论:
12 天前 评论:
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.
You can self-configure the PR merge rules for this repository. For more details, please refer to 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 |
|---|---|---|
| impl/c_api | ✅ pangfd, 苏建加, YANXI_ZHAO (3/2) | ✅ pangfd (1/1) |
| include/c_api | ✅ YANXI_ZHAO, wuzhaolin, 苏建加 (3/2) | ✅ wuzhaolin (1/1) |
| repo-cann/asc-devkit | ✅ YANXI_ZHAO, 苏建加 (2/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
yiming0671, thanks for your pull request. All authors of the commits have signed the CLA. 👍


此处折叠了80条消息 查看更多
4 天前 通过审查
4 天前 通过了评审
YANXI_ZHAO
4 天前 评论:
4 天前 评论:
/approve
/lgtm


4 天前 添加了label:lgtmapproved
4 天前 合入了pull request
描述
CTRL寄存器接口新增
关联的Issue
测试
文档更新
文档更新见pr:https://gitcode.com/cann/asc-devkit/pull/5176
类型标签