Merge blocked
变更摘要
本次变更修复了 concat_2d_jagged 前向与反向算子迁移配套的 aclnn 调用示例在样例执行结束退出时崩溃或卡死的问题。按照 aclDestroyTensorList 与 aclDestroyTensor 只能二选一的资源释放规则,两个示例中删除了对已被 TensorList 一并销毁的单个张量的重复销毁调用,仅保留列表级销毁与 aclrtFree 设备内存释放,并在 aclDestroyTensorList 处补充注释说明销毁语义。
主要改动
concat_2d_jagged前向示例移除重复销毁:在test_aclnn_concat_2d_jagged.cpp中删除对valuesA、valuesB的aclDestroyTensor调用,避免与aclDestroyTensorList(valuesList)重复释放同一批张量。split_2d_jagged反向示例移除重复销毁:在test_aclnn_split_2d_jagged.cpp中删除对outA、outB的aclDestroyTensor调用,outList仍由aclDestroyTensorList统一销毁。- 补充销毁语义注释:两处
aclDestroyTensorList调用后分别添加「valuesA和valuesB已经一并销毁」「outA和outB已经一并销毁」的注释,明确列表销毁已覆盖的元素级释放行为。


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.
PR Approval Progress
⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/ops-rec | ❌ huiyangpeng (1/2)(You can also ask: guo2wang, Z_Ling, qq_64242180, yz53665, 蒋皓洋) | ❌ (0/1)(You can also ask: 龙万彬, hjj12345678_, 李雄, 黄诗磊, lihao_huawei) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
tanfeng_cc, thanks for your pull request. All authors of the commits have signed the CLA. 👍


ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | PR-build-SAST-check | ✅ COMPLETED | >>> |
| Build-2.7.1_arm | ✅ COMPLETED | >>> | |
| Build-2.10.0_arm | ✅ COMPLETED | >>> | |
| Build-2.7.1_X86 | ✅ COMPLETED | >>> | |
| Build-2.10.0_X86 | ✅ COMPLETED | >>> | |
| 恶意代码检查 | Antipoison | ✅ COMPLETED | >>> |
| 编码安全与规范检查 | pre-commit | ✅ COMPLETED | >>> |
| clang-tidy | ✅ COMPLETED | >>> | |
| 开源片段检查 | SCA | ✅ COMPLETED | >>> |
| 开发者测试 | presmoke | ✅ COMPLETED | >>> |
| 流水线 | PR-pipeline_ops-rec | ✅ COMPLETED | >>> |
- compile : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


[P2] 本次修复方向正确(aclDestroyTensorList 已级联销毁成员,重复销毁确会 double-free),但错误分支的资源清理与本 PR 主题(泄漏→退出卡死)同族、仍不完整。
问题
main 内所有 CHECK_RET(...) return 失败分支(L183/L185 及两 Case 内 L193/L196/L200/L222/L225/L229 等)不做任何清理:
- L182-183:valuesList 创建成功后,若 offsetsArray 创建失败
return 1→ valuesList(连 members)+ 已 malloc 的 valuesA/valuesB deviceAddr 泄漏; - Case 内 CreateAclTensor/GetWorkspaceSize/Memcpy 各失败点
return ret:out、deviceAddr、valuesList、offsetsArray 全部泄漏。
失败退出后同样走 aclFinalize,会复现本 PR 要修的"退出卡死/崩溃"现象——只是触发条件从"正常运行"变成"任一 API 失败"。
建议
统一出口清理(goto/lambda cleanup 或 RAII 包装),至少保证失败路径与 L245-248 成功路径对称。
顺带两点:
- 建议在注释里补引 CANN 官方约束原文「对于 aclTensorList 内的 aclTensor 不需要重复释放」,防止后人"补回"单独销毁再次引入 double-free;
- 同函数 CreateAclTensor(L77-78)对 aclCreateTensor 返回值未判空即报成功,后续以 null tensor 调 aclnn——属原迁移 PR 存量,若本 PR 顺手修复更佳。


[P2] 修复本身正确,但同一函数内三个失败分支的清理口径与成功路径(L198-199)不一致,泄漏仍会随用例数累加。
问题
- L173 run failed:销毁了 outList(好),但 values 与 3 个 deviceAddr 不清;
- L181/L183 copy outA/outB failed:连 outList 都不销毁 → outA/outB(list 成员)整体泄漏,values 与 deviceAddr 同样不清。
main 会连续调用 RunSplitCase 两次,任一次失败即泄漏一份 list+members+device 内存,退出时仍可能复现卡死/崩溃(与本 PR 主题同族)。
建议
三个失败分支与 L198-201 对称清理;多出口同构建议抽公共 cleanup(lambda/RAII),与 concat 文件的整改方式保持一致。


/lgtm


合入来源
问题/功能描述
concat_2d_jagged前反向算子迁移,aclnn调用示例执行后退出崩溃/卡死问题修复。
修改方案描述
aclDestroyTensorList 和 aclDestroyTensor 只能二选一,注释掉重复的销毁。
是否涉及UT/ST
开发自检