Open
[fix]concat_2d_jagged算子用例退出卡死问题修复 #254
tanfeng_ccAdd on 1 day ago
[fix]concat_2d_jagged算子用例退出卡死问题修复 #254
Open
tanfeng_ccAdd on 1 day ago
tanfeng_cc
tanfeng_ccCollaborators
1 day ago

合入来源

问题/功能描述

concat_2d_jagged前反向算子迁移,aclnn调用示例执行后退出崩溃/卡死问题修复。

修改方案描述

aclDestroyTensorList 和 aclDestroyTensor 只能二选一,注释掉重复的销毁。

是否涉及UT/ST

开发自检

likedislike
Merge blocked
tanfeng_cctanfeng_ccCollaborators
1 day ago Created pull request, commit ca19f885
tanfeng_cctanfeng_ccCollaborators
1 day ago Associated milestone: ops-rec 26.3.0
tanfeng_cctanfeng_ccCollaborators
1 day ago Associated issue: [Bug]: concat_2d_jagged算子迁移aclnn样例执行成功,但退出异常
atomgit-bot
atomgit-bot
1 day ago Comments:

变更摘要

本次变更修复了 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 已经一并销毁」的注释,明确列表销毁已覆盖的元素级释放行为。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
1 day ago Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
tanfeng_cctanfeng_ccCollaborators
1 day ago Modify description of pull request
ascend-robotascend-robotCollaborators
1 day ago Added label: ascend-cla/yes
AtlasAccountAtlasAccountCollaborators
1 day ago Added label: ci-pipeline-running
ascend-robot
ascend-robotCollaborators
1 day ago 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.
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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
tanfeng_cctanfeng_ccCollaborators
1 day ago Modify description of pull request
8 event messages are collapsed here。 See more
tanfeng_cctanfeng_ccCollaborators
1 day ago Modify description of pull request
ascend-robot
ascend-robotCollaborators
1 day ago Comments:

ascend docs pipeline is running...

likedislike
ascend-robotascend-robotCollaborators
1 day ago Added label: docs-ci-pipeline-running
ascend-robot
ascend-robotCollaborators
1 day ago Comments:

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

likedislike
ascend-robotascend-robotCollaborators
1 day ago Removed label: docs-ci-pipeline-running
ascend-robotascend-robotCollaborators
1 day ago Added label: docs-ci-pipeline-success
AtlasAccountAtlasAccountCollaborators
1 day ago Removed label: ci-pipeline-running
AtlasAccountAtlasAccountCollaborators
1 day ago Added label: ci-pipeline-passed
AtlasAccount
AtlasAccountCollaborators
1 day ago Comments:
流水线 PR-pipeline_ops-rec#1168 [ commitID:50d1db65 ] 已完成
>>>代码风格自动修复执行成功(无修复内容)
阶段 任务名 状态 详情
编译构建 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 >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员评论有效
  • compile : 运行流水线
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike
zengxiongCollaborators1 day agoStart code review2
ascendc/sequence/concat_jagged_tensor/concat_2d_jagged/examples/aclnn/test_aclnn_concat_2d_jagged.cpp
@@ -243,3 +243,3 @@
243243 }
244244 
245- aclDestroyTensorList(valuesList);
245+ aclDestroyTensorList(valuesList); // valuesA和valuesB已经一并销毁
zengxiong1 day agoComments:

[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 成功路径对称。

顺带两点:

  1. 建议在注释里补引 CANN 官方约束原文「对于 aclTensorList 内的 aclTensor 不需要重复释放」,防止后人"补回"单独销毁再次引入 double-free;
  2. 同函数 CreateAclTensor(L77-78)对 aclCreateTensor 返回值未判空即报成功,后续以 null tensor 调 aclnn——属原迁移 PR 存量,若本 PR 顺手修复更佳。
likedislike
tanfeng_cc
tanfeng_ccCollaborators
1 day ago Comments:

测试用例的写法结构按统一风格生成,其他问题检查暂不在此PR上优化。

zengxiongCollaborators1 day agoStart code review2
ascendc/sequence/concat_jagged_tensor/split_2d_jagged/examples/aclnn/test_aclnn_split_2d_jagged.cpp
@@ -196,3 +196,3 @@
196196 }
197197 
198- aclDestroyTensorList(outList);
198+ aclDestroyTensorList(outList); // outA和outB已经一并销毁
zengxiong1 day agoComments:

[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 文件的整改方式保持一致。

likedislike
tanfeng_cc
tanfeng_ccCollaborators
1 day ago Comments:

测试用例的写法结构按统一风格生成,其他问题检查暂不在此PR上优化。

penghuiyangCollaborators
1 day ago Comments:

/lgtm

likedislike
tanfeng_cctanfeng_ccCollaborators
1 day ago Resolved final issue