Merged
refactor(exp_segsum_grad): 将 arch22 tiling 与 host UT 隔离到 arch22 子目录 #4380
daiwei18Add on Aug 1
refactor(exp_segsum_grad): 将 arch22 tiling 与 host UT 隔离到 arch22 子目录 #4380
Merged
Merged fromdaiwei18/ops-math930-expintocann/ops-mathmaster
Pull Request has been successfully merged by CANN-robot.
(Thank you for daiwei18's contribution.)Aug 1 Pre merge succeeded (commit_id: 8a1288995aee188fadfc060c8aaffd44b9ace0db)
Aug 1 Pre merge succeeded (commit_id: 52ba12df6ece6d25fd8b1ec39f0accb46867126f)
Aug 1 Added label: cann-cla/no
Aug 1 Added label: stat/needs-squash
CANN-robot
Aug 1 Comments:
Aug 1 Comments:
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_, 宋恺 (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
daiwei18, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Aug 1 Set zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,zhanw_coding as approver
Aug 1 Set zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,zhanw_coding as approver
Aug 1 Set zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,zhanw_coding as approver
Aug 1 Set zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,zhanw_coding as approver
daiwei18
Aug 1 Comments:
Aug 1 Comments:
compile


Aug 1 Pre merge succeeded (commit_id: fe4eb5e2981f4f68f93a51620f0503477e1c58fd)
8 event messages are collapsed here。 See more
Aug 1 Added label: stat/needs-squash
CANN-robot
Aug 1 Comments:
Aug 1 Comments:
Aug 1 Added label: ci-pipeline-running
CANN-robot
Aug 1 Comments:
Aug 1 Comments:
流水线任务触发成功
任务链接 [f4a850aa4f4141488407f7f3d3cf308b][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | ⚠️ WARNING | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> | |
| UT_Test_harmony-infer-chs-math | ✅ SUCCESS | ||
| UT_Test_harmony-infer-cpro-math | ✅ SUCCESS |
[2026-08-01 17:12:51] CI执行结束


Aug 1 Pre merge succeeded (commit_id: 0b92d8c715cfa6976c7a6c2170b5c63ed56d6d94)
Aug 1 Pre merge succeeded (commit_id: 2e53b9ddcfd9ce8c56966b5d07f0bee478b04362)
Aug 1 Removed label: cann-cla/no
Aug 1 Removed label: stat/needs-squash
CANN-robot
Aug 1 Comments:
Aug 1 Comments:
Aug 1 Added label: cann-cla/yes
CANN-robot
Aug 1 Comments:
Aug 1 Comments:
流水线任务触发成功
任务链接 [35002c2cc33b43219801be4a65ebb0ea][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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-01 16:58:43] CI执行结束


Aug 1 Added label: api-check-failed
Aug 1 Removed label: ci-pipeline-running
Aug 1 Added label: ci-pipeline-passed
songkai111
Aug 1 Comments:
Aug 1 Comments:
/approve


Aug 1 Added label: approved
Aug 1 Added label: lgtm
Aug 1 Closed associated issue
Aug 1 Merged pull request
描述
改动原因
ExpSegsumGrad同时支持两代架构(op_host/exp_segsum_grad_def.cpp:39-50):AddConfig("ascend910b")、AddConfig("ascend910_93")AddConfig("ascend950", aicoreConfig)改动前,arch35 的 tiling 已经放在
op_host/arch35/,而 arch22 的 tiling 仍散在op_host/顶层。这导致op_host/CMakeLists.txt必须用「先让顶层文件被 glob 进来、再在 ascend950 分支里list(REMOVE_ITEM)把它剔除」的方式绕开冲突——两代实现靠"删除"而不是靠"目录"区分。op_kernel/侧已经是「顶层 arch22 +arch35/子目录」的布局,host 侧未对齐。本 PR 把 arch22 的 host 侧文件收进独立的
arch22/子目录,使 host 侧的架构划分与op_kernel/一致,也为后续切换到仓库通用的add_all_modules_sources(... COMPUTE_UNIT ... TILING_DIR ...)机制(cmake/func.cmake中的find_value_by_key+add_tiling_sources,math/abs/CMakeLists.txt即此用法)做准备。改动方法
op_host/exp_segsum_grad_tiling.cppop_host/arch22/exp_segsum_grad_tiling.cppop_host/exp_segsum_grad_tiling.hop_host/arch22/exp_segsum_grad_tiling.htests/ut/op_host/test_exp_segsum_grad_tiling.cpptests/ut/op_host/arch22/test_exp_segsum_grad_tiling.cpptests/ut/op_kernel/CMakeLists.txt../../../op_host/arch22/exp_segsum_grad_tiling.cpp随迁移一并做的非功能性整理(不改变任何计算逻辑):
Copyright置顶,长行按 120 列折行),与math/abs等算子一致;AscendC::GetReduceSumMaxMinTmpSize(...)、tilingData.SaveToBuffer(...)、两处OP_CHECK_IF(...)的实参换行位置;explicit ExpSegsumGradTiling(...) : tilingContext(context){};→... {};(大括号前补空格);.cpp/.h均缺 newline at end of file);exp_segsum_grad_tiling.h的}补注为} // namespace optiling;\brief由空补为arch22 / Ascend910B tiling implementation for ExpSegsumGrad.与... tiling data for ExpSegsumGrad.;../../../op_host/exp_segsum_grad_tiling.h→../../../../op_host/arch22/exp_segsum_grad_tiling.h。本 PR 未包含的内容
host 侧 tiling 的构建规则与 UT 收集规则尚未随目录调整,目前仍按旧路径匹配:
cmake/func.cmake中add_modules_sources的file(GLOB OPTILING_SRCS ${SOURCE_DIR}/*_tiling*.cpp)为非递归匹配,该宏无TILING_DIR参数;math/exp_segsum_grad/op_host/CMakeLists.txt仅在ASCEND_COMPUTE_UNIT STREQUAL "ascend950"分支显式添加arch35/源,其中的list(REMOVE_ITEM ... "${CMAKE_CURRENT_SOURCE_DIR}/exp_segsum_grad_tiling.cpp")指向的已是迁移前的旧路径;cmake/ut.cmake中add_modules_ut_sources的 glob 为${DIR}/test_*_tiling.cpp与${DIR}/${TILING_DIR}/test_*_tiling*.cpp,而tests/ut/op_host/CMakeLists.txt的调用点未传TILING_DIR。这部分收敛方案见关联 Issue。
关联的Issue
关联Issue #2463
https://gitcode.com/cann/ops-math/issues/2463
测试
tests/ut/op_host/arch22/test_exp_segsum_grad_tiling.cpp与原文件在测试语义上完全一致——输入/输出均为{1, 1, 12, 12}的DT_FLOAT/FORMAT_ND,compileInfo = {1, 10},expectTilingKey = 1,expectTilingData字符串逐字符相同(仅因行宽被拆成两段字面量拼接),expectWorkspaces = {33554432},断言ge::GRAPH_SUCCESS。差异仅为 include 路径与 clang-format 折行。tests/ut/op_kernel/CMakeLists.txt中exp_segsum_grad_tiling_files已指向op_host/arch22/exp_segsum_grad_tiling.cpp,该目标显式列出源文件路径,不依赖目录 glob。文档更新
本 PR 不涉及文档变更。
math/exp_segsum_grad/README.md与docs/aclnnExpSegsumBackward.md描述的是算子功能与 aclnn 接口,不含 host 侧源码目录结构,故无需同步修改。类型标签