已合并
feat: 新增 --clear-l0 选项,初始化 L0A/L0B/L0C #219
guigui_jzh创建于 5 天前
feat: 新增 --clear-l0 选项,初始化 L0A/L0B/L0C #219
已合并
guigui_jzh创建于 5 天前
guigui_jzh
5 天前

当前PR是否有AI参与:

[] 否
[x] 是
__1. AI Agent 平台: opencode
__2. AI 模型: glm5.3
__3. Prompt上下文 :

PR功能描述 / 为什么需要这个合入**:

A5质量加固,模拟复杂网络情况,对L0进行注入

该PR关联的issue

(格式为fixes #<issue号>, 或者resolves #<issue号>): fixes #151

希望检视人员了解:

测试

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 guigui_jzh 的贡献)
Gguigui_jzh
5 天前 创建了 pull request,commit 2444c60f
Gguigui_jzh
5 天前 关联了issue:[Requirement|需求建议]: 需要新增L0注入功能
atomgit-bot
atomgit-bot
5 天前 评论:

变更摘要

本 PR(新特性,关联 issue #151)为 A5 质量加固场景新增 --clear-l0 选项,用于在执行前对 L0A/L0B/L0C 进行确定性数据注入,以模拟复杂网络情况。改动覆盖了从 CLI 参数解析、SWITCHES 开关字段、helper kernel 编译(TIK 与 Ascend950 专用 Ascend C 两套实现)到 RTS/ACL 运行时启动与结果校验的完整链路,并调整了 profiling 循环中的清空执行顺序;同时顺带精简了大量冗余的 else 分支(纯风格重构,无行为变化)。

主要改动

  • 新增 --clear-l0 CLI 选项与开关字段:在 ttk/cli/kernel.py 增加 --clear-l0 参数(说明 L0A/L0B 填充指定值、L0C 为 matmul 结果);ttk/cli/bridge.pyapply_kernel_args 通过 _parse_clean_val("L0", args.clear_l0) 写入 sw.force_clear_l0ttk/utilities/classes.pySWITCHES 新增并初始化 force_clear_l0 字段,测试文件同步覆盖该参数的数值/特殊浮点解析。

  • 新增 clear_l0 helper kernel 编译逻辑ttk/core_modules/operator/helper_kernels.py 新增基于 TIK 的 clear_l0(两步 matmul 填充 L0A/L0B 并写 L0C,Ascend950 用 f16f16f16、Ascend910B 用 f16f16f32);ttk/core_modules/operator/tbe_interface.py 新增 Opc.compile_l0_clear(),对 Ascend950 平台通过 _compile_l0_clear_ascendcccec/ld.lld 编译新增的 ascendc_kernels/clear_l0_950.cpp(tensor_api 实现 GM→L1→L0A/L0B→Mmad→L0C→fixpipe→GM 链路并生成 clear_l0.json),其余平台走 TIK 编译;ttk/core_modules/npu/instance_refactor.py_compile_help_kernels 相应加入 Opc().compile_l0_clear()

  • 打通运行时注入与校验链路ttk/core_modules/aclnn/acl_interface.py 新增 AclInterface.clear_l0 透传;ttk/core_modules/runtime/rts_interface.py 新增 RTSInterface.clear_l0,按 128KB fp16 输入启动 helper kernel(Ascend950 额外携带 fp32 输出 GM 参数并计算期望值 K*v²),并为 _launch_helper_kernel 新增 verify_arg 参数,回读设备输出校验全链路是否真正执行并记录 warning/info 日志。

  • 调整执行前清空顺序ttk/core_modules/npu/op/rts_sequence.pyOnlineRtsProfiling._rts_kernel_sequence_v2ttk/core_modules/npu/op_api/profiling.pyAclOpExecutor 中,将原来的 clear_l1 → clear_ub 顺序改为 clear_l0 → clear_ub → clear_l1,确保每次重复执行前先对 L0A/L0B/L0C 完成注入。

  • 精简冗余 else 分支:在 acl_interface.pyrts_sequence.pytbe_interface.pyrts_interface.pyclasses.py 等多处将 if/elseelse 提前返回后的多余分支删除,属于无行为变化的代码清理,其中 rts_interface.py_process_exception_str 等还伴随 elif 降级为 if 的等价改写。

likedislike
不准确?
CANN-robot
CANN-robot成员
5 天前 评论:

Hi @guigui_jzh, welcome to submitting your first PR to ops-test-kit!

PR Merge Steps

1. CLA Signing

If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.

2. CI Check

Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.

3. Code Review

After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.

likedislike
atomgit-bot
atomgit-bot
5 天前 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
此处折叠了55条消息 查看更多
CANN-robotCANN-robot成员
4 天前 添加了label:approved
chenqi317成员
4 天前 评论:

/lgtm
/appeove

likedislike
CANN-robotCANN-robot成员
4 天前 添加了label:lgtm
CANN-robotCANN-robot成员
4 天前 关闭了关联的issue
CANN-robotCANN-robot成员
4 天前 合入了pull request