Pull Request已成功合入, 合并人@CANN-robot
(感谢 zhanw_coding 的贡献)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 |
|---|---|---|
| */*/op_host/*_def.cpp | ✅ 王永光, 宋恺, wangrui_ (3/2) | ✅ 王永光 (1/1) |
| conversion/broadcast_to | ✅ 宋恺, wangrui_ (2/2) | ✅ 宋恺, wangrui_ (2/1) |
| conversion/im2col | ✅ 宋恺, wangrui_ (2/2) | ✅ 宋恺, wangrui_ (2/1) |
| conversion/strided_slice | ✅ 宋恺, wangrui_ (2/2) | ✅ 宋恺, wangrui_ (2/1) |
| conversion/strided_slice_v3 | ✅ 宋恺, wangrui_ (2/2) | ✅ 宋恺, wangrui_ (2/1) |
| conversion/trans_data | ✅ wangrui_, 宋恺 (2/2) | ✅ wangrui_, 宋恺 (2/1) |
| math/arg_max_with_value | ✅ 宋恺, wangrui_ (2/2) | ✅ wangrui_, 宋恺 (2/1) |
| repo-cann/ops-math | ✅ wangrui_, 宋恺 (2/2) | ✅ 宋恺, wangrui_ (2/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


流水线任务触发成功
任务链接 [2e811ed644fd42ec98f45e075a1f3ac1][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_harmony-infer | ✅ SUCCESS | >>>>> | |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| UT_Test_experimental | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-06-23 22:01:55] CI执行结束


流水线任务触发成功
任务链接 [df425dc14e404607a639cf008a7cf013][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_Pr | ✅ SUCCESS | ||
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_codestyle | ⚠️ WARNING | >>>>> | |
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
[2026-06-23 21:57:59] CI执行结束


变更摘要
本 PR 主要针对 BatchToSpaceND、BroadcastTo、Im2col、MatrixSetDiag、MemSetV2、PadV3、PadV3Grad、StridedSlice、StridedSliceV2、StridedSliceV3、TransData、ArgMaxWithValue、Sinc 和 TruncateDiv 等多个算子的 host tiling 与 kernel 实现进行 codecheck(静态代码检查)问题修复,涉及代码风格、类型安全、常量命名规范化等方面的调整。改动集中在 op_host tiling 逻辑和 op_kernel 核心计算实现文件中,以消除静态分析工具报告的违规项。
主要改动
-
truncate_div_apt.cpp大规模重构:truncate_div算子的 kernel 入口文件进行了显著重构(+133/-57),重新组织了各数据类型的模板分发逻辑(truncate_div_half、truncate_div_bfloat16、truncate_div_float、truncate_div_int8等),新增了int64_t、int16_t等数据类型的处理分支,并引入canUseMul模板参数优化标量取倒数乘法路径。 -
batch_to_space_nd算子 codecheck 修复:batch_to_space_nd_tiling_arch35.cpp的 tiling 类成员和常量定义进行了规范化调整,batch_to_space_nd_large_c.h和batch_to_space_nd_small_c.h中新增了多个constexpr static具名常量(如AXIS_OFFSET_W、AXIS_OFFSET_H、BLOCK_AXIS_OFFSET_H、MIN_SPATIAL_DIMS等)以替代魔法数字,改善代码可读性。 -
broadcast_totiling 常量与头文件规范化:broadcast_to_tiling_base.h和broadcast_to_tiling_base.cpp中的常量定义(如brctoMaxDMADimNum、brctoMaxADimNum、brctoMaxBDimNum)改用constexpr size_t并通过static_cast消除类型窄化警告;同时调整了GetHardwareInfo模板方法的相关实现。 -
trans_datatiling 结构体类型修复:transdata_tiling_arch35.h和transdata_tiling_arch35.cpp中对TransDataCompileInfo结构体成员类型、coreNum_等变量的类型进行了调整(如uint32_t/int64_t之间的统一),并对GetHardwareInfo中的平台参数校验逻辑进行了规范化。 -
matrix_set_diag、strided_slice_v2、strided_slice_v3等算子 tiling 代码调整:这些算子的 host tiling 文件中引入了constexpr常量替代部分字面量,调整了局部变量声明顺序与初始化方式,sinc_def.cpp移除了一行冗余代码,以通过 codecheck 规则。


/lgtm
/approve


/approve


描述
fix: 修复BatchToSpaceND 等算子 codecheck 问题
master分支PR:
关联的Issue
https://gitcode.com/cann/ops-math/issues/1944
测试
文档更新
类型标签