Pull Request已成功合入, 合并人@CANN-robot
(感谢 Sunee 的贡献)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 |
|---|---|---|
| math/dot | ✅ songkai111, wangrui_ (2/2) | ✅ songkai111 (1/1) |
| math/kl_div_v2 | ✅ songkai111, wangrui_ (2/2) | ✅ songkai111 (1/1) |
| math/reduce_all | ✅ songkai111, wangrui_ (2/2) | ✅ songkai111 (1/1) |
| math/reduce_any | ✅ songkai111, wangrui_ (2/2) | ✅ songkai111 (1/1) |
| math/reduce_log_sum_exp | ✅ songkai111, wangrui_ (2/2) | ✅ songkai111 (1/1) |
| math/reduce_max | ✅ songkai111, wangrui_ (2/2) | ✅ songkai111 (1/1) |
| math/reduce_mean | ✅ songkai111, wangrui_ (2/2) | ✅ songkai111 (1/1) |
| math/reduce_min | ✅ songkai111, wangrui_ (2/2) | ✅ songkai111 (1/1) |
| math/reduce_prod | ✅ wangrui_, songkai111 (2/2) | ✅ songkai111 (1/1) |
| math/reduce_std_v2 | ✅ songkai111, wangrui_ (2/2) | ✅ songkai111 (1/1) |
| repo-cann/ops-math | ✅ songkai111, wangrui_ (2/2) | ✅ songkai111 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


🔵 source code change are detected, tasks labels is removed in this pull request!


问题/功能描述
本次PR旨在统一多个算子(包括BiasAddGrad、Dot、KLDivV2、ReduceAll、ReduceAny、ReduceLogSumExp、ReduceMax、ReduceMean、ReduceMin、ReduceProd、ReduceStdV2、ReduceSum、ReduceVar等)中生成Tiling Key的实现方式,解决代码风格不一致和潜在的可维护性问题。原实现中直接调用GET_TPL_TILING_KEY宏或手动计算Key的方式,存在逻辑分散、易出错的风险。本次修改通过重构,将所有相关算子的Tiling Key生成逻辑标准化,提升了代码的统一性、可读性和健壮性。
修改方案描述
修改方案的核心是将所有相关算子中生成Tiling Key的代码,统一重构为先声明uint64_t tilingKey变量,再调用专用的GEN_REDUCE_TILING_KEY宏进行赋值。此方案覆盖了主机端的Tiling代码,对于KLDivV2等特殊算子,该宏还适配了额外的参数。此外,在ReduceLogSumExp的算子内核中,将硬编码的模板参数列表替换为统一的REDUCE_TPL_PARAM宏。所有改动均不改变算子的功能逻辑,属于纯粹的代码重构和规范化,旨在集中管理关键逻辑,减少未来维护成本和潜在错误。


流水线任务触发成功
任务链接 [130718c9edc44dbc8915e5892f440235][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| anti_virus | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| 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 | ❌ FAILED | >>>>> | |
| Compile_Ascend_ARM_A5 | ❌ FAILED | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_A5_ubuntu24 | ❌ FAILED | >>>>> | |
| UT_Test | ⚪ ABORTED | ||
| UT_Test_experimental | ⚪ ABORTED | ||
| UT_Test_kernel | ⚪ ABORTED | ||
| Smoke_A900_npupool | ⚪ ABORTED | ||
| harmony-infer | ⚪ ABORTED |
[2026-03-09 09:18:38] CI执行失败


🔵 source code change are detected, tasks labels is removed in this pull request!


流水线任务触发成功
任务链接 [b13c399e2b954352aa1e31c7222189e0][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| anti_virus | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| 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 | >>>>> | >>>>> |
| API_Check | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ❌ FAILED | >>>>> | |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_A5_ubuntu24 | ✅ SUCCESS | >>>>> | |
| UT_Test | ⚪ ABORTED | ||
| UT_Test_experimental | ⚪ ABORTED | ||
| UT_Test_kernel | ⚪ ABORTED | ||
| Smoke_A900_npupool | ⚪ ABORTED | ||
| harmony-infer | ⚪ ABORTED |
[2026-03-09 11:13:03] CI执行失败


流水线任务触发成功
任务链接 [d27254ee2d704814b29a2f6e5b3f57f9][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| anti_virus | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| 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 | >>>>> | >>>>> |
| API_Check | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_A5_ubuntu24 | ✅ SUCCESS | >>>>> | |
| UT_Test | ✅ SUCCESS | ||
| UT_Test_experimental | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| Smoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| harmony-infer | ✅ SUCCESS |
[2026-03-09 12:03:51] CI执行结束


/approve


Review Guide
This pull-request passes review.
Committers who wrote a comment of /approve are: songkai111.
Reviewers who wrote a comment of /lgtm are: songkai111, wangrui_.


描述
Reduce算子模板tilingKey宏统一修改
关联的Issue
https://gitcode.com/cann/ops-math/issues/899
测试
文档更新
类型标签