已合并
feat: add binary dump of args as a debugging measure on AICPU exception #3815
feat: add binary dump of args as a debugging measure on AICPU exception #3815
已合并
rui创建于 7月24日
rui成员
7月24日

Pull Request

描述

PrintAicpuErrorInfo 中 soName/kernelName/funcName 均为空串,异常时无法定位算子。

新增 DumpAicpuArgsForDfx 函数,参照 AICORE GetArgsInfo 方式,将 Device 侧 args buffer D2H 拷贝并按 uint64_t 分组打印,同时输出 soNameAddr/kernelNameAddr,支持离线通过偏移还原算子名。

变更类型

如何测试

  1. 通过 rtAicpuKernelLaunchExWithArgs 下发 KERNEL_TYPE_AICPU 任务,使用不存在的 kernelName 触发 Device 侧加载失败
  2. 同步等待返回错误码 507018(AICPU 异常)
  3. 查看 plog 中 [AICPU_INFO] 日志,通过 soNameAddr - paramAddr 计算偏移,从 args 二进制中还原 soName/kernelName

核对清单

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 rui 的贡献)
Rrui成员
7月24日 创建了 pull request,commit 5752918d
atomgit-bot
atomgit-bot
7月24日 评论:

变更摘要

此 PR 针对 AICPU 异常场景新增维测手段。由于 rtAicpuKernelLaunchExWithArgs 接口固定传入 kernel=nullptr,导致 PrintAicpuErrorInfo 输出的 soName/kernelName/funcName 均为空串,无法定位出问题的算子。为此新增 DumpAicpuArgsForDfx 函数,将 Device 侧的 args buffer 通过 D2H 拷贝到 Host 端,按 uint64_t 分组打印二进制内容,同时输出 soNameAddrkernelNameAddr,支持离线通过偏移还原算子名称。

主要改动

  • 新增 DumpAicpuArgsForDfx 静态函数:该函数负责从 Device 侧将 AICPU 任务的 args buffer(aicpuTaskInfo->comm.args)通过 MemCopySync 执行 D2H 拷贝,按 ARGS_PER_STRING_MAX_LEN 分组并以 [AICPU_INFO] 标签打印 uint64_t 格式的二进制数据,同时输出 soNamefuncName 的地址指针,便于离线通过偏移量还原算子名称。
  • PrintAicpuErrorInfo 中集成调用:在 PrintAicpuErrorInfo 函数中新增对 DumpAicpuArgsForDfx(taskInfo, devId) 的调用,确保在 AICPU 异常输出错误报告之前先 dump args 二进制内容。
  • 引入 <sstream> 头文件:为 DumpAicpuArgsForDfx 中使用 std::stringstream 拼接日志字符串提供支持。
likedislike
不准确?
atomgit-bot
atomgit-bot
7月24日 评论:

代码审查

经过对两个变更文件的全面审查,未发现需要报告的问题

审查总结

  • docs/zh/design/features/aicpu_dfx_analysis.md:新增的设计文档,包含问题分析、修复说明、定位步骤和测试结果。文档内容安全,不包含敏感信息、危险命令或不安全的配置指导。
  • src/runtime/core/src/task/task_info/davinci/davinci_kernel_task.cc:新增 DumpAicpuArgsForDfx 静态函数,在 PrintAicpuErrorInfo 中调用,用于将 Device 侧 args buffer 拷贝回 Host 并按 uint64_t 分组打印。该函数完全参照了已有的 GetArgsInfo 实现模式,内存管理正确(分配/释放配对、错误路径释放)、边界检查充分(通过 CheckArgsSize 校验最小尺寸)、错误处理完整(检查 HostMemAlloc / MemCopySync 返回值)。函数签名中的类型与调用方及 CheckArgsSize 参数完全匹配。

P0–P2 问题数: 0
P3 建议数: 0
整体风险评估: 低风险。纯增量维测代码,不修改任何现有逻辑,不影响正常执行路径。

类型 数量
🔴 阻塞 0
🟡 建议 1

💬 仅评论

likedislike
不准确?
CANN-robotCANN-robot成员
7月24日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
7月24日 评论:

CLA Signature Pass

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

likedislike
此处折叠了134条消息 查看更多
王璐瑶成员
7月28日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
7月28日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
7月28日 合入了pull request
Rrui成员
8月6日 修改标题为 “feat: add binary dump of args as a debugging measure on AICPU exception”,原标题为“feat: AICPU 异常时新增 args 二进制 dump 维测手段”
CANN-robotCANN-robot成员
8月6日 删除了label:ci-pipeline-passed