Pull Request已成功合入, 合并人@CANN-robot
(感谢 zhanw_coding 的贡献)变更摘要
该 PR 主要围绕 matrix_set_diag_v2 算子补充单元测试,并修复 matrix_set_diag 的 codecheck 问题:在 classify_rule.yaml 中新增 matrix_set_diag_v2 的分类规则,在 matrix_set_diag_tiling_arch35.cpp 中调整对角线长度校验逻辑,同时为 matrix_set_diag_v2 的 tiling 与 infershape 实现补充覆盖多种分支的 UT 用例。
主要改动
-
新增
matrix_set_diag_v2分类规则:在classify_rule.yaml中为matrix_set_diag_v2增加op_host、op_kernel、examples、tests以及arch35和matrix_set_diag_v2_def.cpp等路径的归类配置。 -
修复
matrix_set_diagtiling 对角长度校验:在matrix_set_diag_tiling_arch35.cpp中将maxDiagLen先以uint64_t读取再转为uint32_t存入inputInfo_.maxDiagLen,并新增maxDiagLen != inputInfo_.maxDiagLen的截断溢出校验,避免大值截断后通过检查。 -
补充
matrix_set_diag_v2tiling UT:在test_matrix_set_diag_tiling_arch35.cpp中新增 7 个用例,覆盖Tiling4CutTail的 V1 路径、GetOptimizeTiling提前返回、CalUbFactor分支、SIMT 缓存不足失败、GATHER回退CutTail、SCATTERNoCutTail 优化以及 SIMT 直通 NoCutTail 等场景。 -
补充
matrix_set_diag_v2infershape UT:在test_matrix_set_diag_infershape.cpp中新增 8 个用例,覆盖非 constk的维度校验成功与失败、diag/x前导维未知时的填充与跳过、以及x/diag未知 rank 时输出{-2}等分支。


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 |
|---|---|---|
| repo-cann/ops-math | ✅ wangrui_, andong_hw (2/2) | ✅ wangrui_ (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
zhanw_coding, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


流水线任务触发成功
任务链接 [f1104575bc7745d481c728232b251f94][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_harmony-infer | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_9030_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| UT_Test_experimental | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-08-13 11:45:58] CI执行结束


流水线任务触发成功
任务链接 [68b9467d97cb4beabf99ecaebf2df4c6][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_Pr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_precommit | ✅ SUCCESS | >>>>> |
[2026-08-13 11:35:57] CI执行结束


compile


流水线任务触发成功
任务链接 [9cdb6209edbb4a8a85423fd343148b81][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_harmony-infer | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_9030_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| UT_Test_experimental | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-08-13 22:26:31] CI执行结束


流水线任务触发成功
任务链接 [2cbbef9da6d84469a70ce4bd22415027][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_Pr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_precommit | ✅ SUCCESS | >>>>> |
[2026-08-13 22:15:35] CI执行结束


描述
新增 14 个用例(全部通过)
infershape(7 个):
非 const k 三分支(diag 维过小/过大/合法)、diag 未知前导维 continue、x 未知前导维用 diag 填充、x/diag 未知 rank({-2})→ 输出 {-2}。
tiling(7 个):
V1 切尾路径 3 个用例(主循环/提前返回/CalUbFactor if 分支)、SIMT ubSize 过小失败、GATHER ubFactor=0 回退 CutTail、NoCutTail 优化循环 break、SIMT 直达。
关联的Issue
https://gitcode.com/cann/ops-math/issues/2606
测试
UT
文档更新
类型标签