已合并
FEAT: A5 CTRL寄存器接口补充 #5135
yiming创建于 12 天前
FEAT: A5 CTRL寄存器接口补充 #5135
已合并
yiming创建于 12 天前
yiming成员
12 天前

描述

CTRL寄存器接口新增

关联的Issue

测试

文档更新

文档更新见pr:https://gitcode.com/cann/asc-devkit/pull/5176

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 yiming 的贡献)
Yyiming成员
12 天前 创建了 pull request,commit 9d41411d
atomgit-bot
atomgit-bot
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_modeasc_get_scalar_load_cache_modeasc_get_scalar_store_cache_mode 声明,并在 cache_ctrl_impl.hasc_set_scalar_cache_mode_impl.hasc_get_scalar_cache_mode_impl.h 中实现,分别操作 CTRL[19:16](load)和 CTRL[23:20](store),支持 NORMAL_FIRST_VICTIMNORMAL_LAST_VICTIMNORMAL_PERSISTENTNOTALLOC_KEEPNOTALLOC_CLEANNOTALLOC_DROP 等模式,并对未知编码回退到默认模式。
  • 新增饱和标志读写接口:在 include/c_api/sys_var/sys_var.h 中新增 asc_set_saturation_flagasc_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_strategyasc_get_saturation_strategy 声明,并在对应 impl 文件中实现,通过 CTRL[60] 位在 USE_API(单指令设置)与 USE_GLOBAL(全局设置)之间切换。
  • 新增枚举定义:在 include/c_api/utils/enum.h 中新增 asc_saturation_modeFLOATFLOAT8INTCAST)和 asc_override_strategyUSE_APIUSE_GLOBAL),并注释说明各自对应的 CTRL 位。
  • 补充测试与接口检查:新增 test_asc_scalar_cache_mode.cpptest_asc_saturation_flag.cpptest_asc_saturation_strategy.cpp 单元测试,覆盖各模式/标志位的读写、往返及保留其他位场景,并在 host 端 checker 中登记新增接口。
likedislike
atomgit-bot
atomgit-bot
12 天前 评论:

代码审查

✅ 未发现问题

likedislike
CANN-robotCANN-robot成员
12 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
此处折叠了80条消息 查看更多
YYANXI_ZHAO成员
4 天前 通过审查
YYANXI_ZHAO成员
4 天前 通过了评审
YANXI_ZHAO成员
4 天前 评论:

/approve
/lgtm

likedislike
CANN-robotCANN-robot成员
4 天前 添加了label:lgtmapproved
CANN-robotCANN-robot成员
4 天前 合入了pull request