已合并
[Reduce模板] Reduce算子模板tilingKey宏统一修改 #1536
[Reduce模板] Reduce算子模板tilingKey宏统一修改 #1536
已合并
Sunee创建于 3月7日
Sunee成员
3月7日

描述

Reduce算子模板tilingKey宏统一修改

关联的Issue

https://gitcode.com/cann/ops-math/issues/899

测试

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 Sunee 的贡献)
SSunee成员
3月7日 创建了 pull request,commit 1106228e
CANN-robot
CANN-robot成员
3月7日 评论:

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 /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robotCANN-robot成员
3月7日 添加了label:cann-cla/yes
CANN-robotCANN-robot成员
3月7日 将FelixTang7,zhou-qilong,wangrui_,rxtfeng,loov1,songkai111,zhangyuxiang0119,llimwang,gubaocheng设为评审人
CANN-robotCANN-robot成员
3月7日 将FelixTang7,zhou-qilong,wangrui_,rxtfeng,loov1,songkai111,zhangyuxiang0119,llimwang,gubaocheng设为审查人
CANN-robot
CANN-robot成员
3月7日 评论:

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

likedislike
CANN-robot
CANN-robot成员
3月7日 评论:

问题/功能描述

本次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宏。所有改动均不改变算子的功能逻辑,属于纯粹的代码重构和规范化,旨在集中管理关键逻辑,减少未来维护成本和潜在错误。

likedislike
Sunee成员
3月9日 评论:

compile

likedislike
CANN-robotCANN-robot成员
3月9日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
3月9日 评论:

流水线任务触发成功
任务链接 [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执行失败

likedislike
SSunee成员
3月9日 修改了pull request 的描述
此处折叠了5条事件消息 查看更多
SSunee成员
3月9日 update merge request[project id: 7649531, iid: 1536, commit_id: 753cc5996fb6267e183ad41481195fa8d02a49bc] virtual merging success
CANN-robot
CANN-robot成员
3月9日 评论:

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

likedislike
CANN-robotCANN-robot成员
3月9日 删除了label:ci-pipeline-failed
CANN-robot
CANN-robot成员
3月9日 评论:

CLA Signature Pass

Sunee, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
Sunee成员
3月9日 评论:

compile

likedislike
CANN-robotCANN-robot成员
3月9日 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
3月9日 删除了label:api-check-pass
CANN-robot
CANN-robot成员
3月9日 评论:

流水线任务触发成功
任务链接 [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执行失败

likedislike
CANN-robotCANN-robot成员
3月9日 添加了label:api-check-pass
CANN-robotCANN-robot成员
3月9日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
3月9日 添加了label:ci-pipeline-failed
Sunee成员
3月9日 评论:

compile

likedislike
CANN-robotCANN-robot成员
3月9日 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
3月9日 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
3月9日 删除了label:api-check-pass
CANN-robot
CANN-robot成员
3月9日 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robotCANN-robot成员
3月9日 添加了label:api-check-pass
CANN-robotCANN-robot成员
3月9日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
3月9日 添加了label:ci-pipeline-passed
RuiWang_成员
3月9日 评论:

/lgtm

likedislike
songkai111成员
3月9日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
3月9日 添加了label:lgtmapproved
CANN-robot
CANN-robot成员
3月9日 评论:

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_.

likedislike
CANN-robotCANN-robot成员
3月9日 关闭了关联的issue
CANN-robotCANN-robot成员
3月9日 合入了pull request