Pull Request has been successfully merged by CANN-robot.
(Thank you for sunzhongwen1's contribution.)变更摘要
本 PR 修复 reduce 模版在 workspace 调用场景下的问题。改动集中在 src/op_common/atvoss/reduce/reduce_tiling.cpp 的 ReduceOpTiling::CalcUserWorkSpace() 中:在原有通过 PlatformAscendC::GetLibApiWorkSpaceSize() 获取系统 workspace 大小的分支之外,新增了非该路径(normal 场景)的处理,将系统 workspace 大小固定为 32B,并继续参与 workspaces[0] 的组装,从而避免算子 kernel 入口取到空指针。
主要改动
- 补充 normal 场景的 workspace 兜底: 在
CalcUserWorkSpace()的原有if分支后新增else分支,将sysWorkSpaceSize设为32,使未走 AscendC 平台接口的路径也能获得非零的系统 workspace 大小。 - 保证 workspace 首地址非空:
workspaces[0]仍按sysWorkSpaceSize + workSpaceSize_计算,因此新增的 32B 预留会计入首个 workspace 地址,防止算子 kernel 入口返回空指针。


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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/opbase | ✅ 王瑞, 顾宝成 (2/2) | ✅ 王瑞, 顾宝成 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
sunzhongwen1, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/lgtm
/approve
by agent


/check-pr


描述
ReduceOpTiling::CalcUserWorkSpace 在 groupR<=1 的普通 reduce 场景下也会调用 ascendcPlatform.GetLibApiWorkSpaceSize()。普通 reduce 不需要 AscendC 库 API 的系统 workspace,且该接口在部分平台/版本可能返回 0 或带来不必要的系统 workspace 申请;当 tiling 侧 workspace 为 0/空时,reduce kernel 入口的
if (workspace == nullptr) { return; }
会直接返回,导致算子不执行、输出未写入。
本次修改:
影响文件:
关联的Issue
测试
本 PR 未包含测试代码变更。建议在 groupR<=1 的 Reduce 用例上确认 kernel 不再因 workspace 为空提前返回,并回归 groupR>1 路径仍按 GetLibApiWorkSpaceSize() 申请 workspace。
文档更新
本次改动不涉及文档更新。
类型标签