支持NPU coredump
客户现场发生硬件异常时,需要反复压测复现问题,定位效率低。为了解决该问题,系统检在测到潜在的硬件异常时,会自动触发一个dump操作,捕获当前的状态信息。msDebug工具通过对coredump文件的解析,即使在没有主动压测的情况下也能收集到足够的数据用于问题分析。通过上述功能,不仅提高了硬件异常问题的定位效率,还减少因反复压测给用户带来的不便。
操作步骤
- 准备acl.json配置文件。
- 工程化算子开发:单算子API调用场景:参考《AscendCL应用开发指南 (C&C++)》的“ AscendCL初始化与去初始化”节点,自行创建acl.json文件,然后通过aclinit接口进行加载。
- AI框架算子适配:PyTorch框架场景:在用户torch_npu的安装目录中搜索acl.json文件。
配置acl.json文件后将不能使用msDebug的其他功能。
- 参见《AscendCL应用开发指南 (C&C++)》的“应用开发接口 > AscendCL API参考 > 系统配置 > aclInit”章节,开启生成coredump文件的功能。
- 在acl.json配置文件中,将dump_scene参数设置为aic_err_detail_dump。
- 在acl.json配置文件中,配置dump_path参数设置导出dump文件的路径。
- 程序崩溃时(如内存溢出、段错误等),触发生成coredump文件。
默认情况下,该文件名为core或core.pid(其中 pid 为进程ID)。
- 使用msDebug工具执行以下命令,加载coredump文件。
1 2 3 4 5 6 7
(py38) root@ubuntu:~/CLionProjects/untitled/build$ msdebug --core corefile //corefile 为用户coredump文件的路径 msdebug(MindStudio Debugger) is part of MindStudio Operator-dev Tools. The tool provides developers with a mechanism for debugging Ascend kernels running on actual hardware. This enables developers to debug Ascend kernels without being affected by potential changes brought by simulation and emulation environments. (msdebug) target create --core "/home/xx/coredump_file/GatherV3_9e31943a1a48bf81ddff1fc6379e0be3_high_performance_10330.2.1.20250217233735574.core" Core file '/home/xx/coredump_file/GatherV3_9e31943a1a48bf81ddff1fc6379e0be3_high_performance_10330.2.1.20250217233735574.core' (hiipu64) was loaded. [Switching to focus on CoreId 30, Type aiv]
- 查看coredump文件信息。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
(msdebug) ascend info summary CoreId CoreType DeviceId ChipType 30 AIV 0 A2/A3 Id DataType MemType Addr Size dim 0 DEVICE_KERNEL_OBJECT GM 0x12c0c0014000 402984 1 STACK GM/DCACHE 0x12c1400f0000 32768 2 WORKSPACE_TENSOR GM 0x12c048e04400 76832 3 TILING_DATA GM/DCACHE 0x12c180000438 200 4 OUTPUT_TENSOR GM 0x12c048e00200 16384 [2, 2048] 5 INPUT_TENSOR GM 0x12c041200000 83886080 [10240, 2048] 6 INPUT_TENSOR GM 0x12c048e00000 32 [2] 7 INPUT_TENSOR GM 0x12c180000518 32 [1] 8 ARGS GM/DCACHE 0x12c180000400 312 (msdebug) re r PC PC = 0x000012c0c00157c4 (msdebug) x -m GM -f uint8_t 0x12c0c0014000 -s 32 -c 1 0x12c0c0014000: {0x80 0x7f 0x3a 0x07 0x10 0x00 0x7b 0x07 0x80 0x38 0x9e 0x02 0x81 0xd7 0x3b 0x00 0x80 0x08 0x1f 0x02 0xff 0x7f 0x20 0x07 0x01 0x00 0x00 0x07 0x0a 0xf8 0xde 0x00} (msdebug) x -m GM -f uint8_t 0x12c1400f0000 -s 32 -c 1 0x12c1400f0000: {0x00 0x70 0xe1 0x48 0xc0 0x12 0x00 0x00 0x00 0x70 0xe1 0x48 0xc0 0x12 0x00 0x00 0xc8 0x7a 0x1f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00} (msdebug) x -m DCACHE -f uint8_t 0x12c1400f0000 -s 32 -c 1 0x12c1400f0000: {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
- 请参考核切换、读取寄存器以及内存与变量打印章节的内存打印相关操作定位硬件异常。
- 调试完以后,执行q命令并输入Y或y结束调试。
1 2
(msdebug) q Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] y
父主题: 算子调试(msDebug)