昇腾社区首页
中文
注册

支持NPU coredump

客户现场发生硬件异常时,需要反复压测复现问题,定位效率低。为了解决该问题,系统检在测到潜在的硬件异常时,会自动触发一个dump操作,捕获当前的状态信息。msDebug工具通过对coredump文件的解析,即使在没有主动压测的情况下也能收集到足够的数据用于问题分析。通过上述功能,不仅提高了硬件异常问题的定位效率,还减少因反复压测给用户带来的不便。

操作步骤

  1. 准备acl.json配置文件。
  2. 参见AscendCL应用开发指南 (C&C++)“应用开发接口 > AscendCL API参考 > 系统配置 > aclInit章节的配置文件示例(异常算子Dump配置),开启生成coredump文件的功能。
    1. 在acl.json配置文件中,将dump_scene参数设置为aic_err_detail_dump。
    2. 在acl.json配置文件中,配置dump_path参数设置导出dump文件的路径。
  3. 程序崩溃时(如内存溢出、段错误等),触发生成coredump文件。

    默认情况下,该文件名为core或core.pid(其中 pid 为进程ID)。

  4. 使用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]
    
  5. 查看coredump文件信息。
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    (msdebug) ascend info summary
      CoreId  CoreType  DeviceId  ChipType
     *  25       AIV       0        A2/A3
        26       AIV       0        A2/A3
        27       AIV       0        A2/A3
        28       AIV       0        A2/A3
        29       AIV       0        A2/A3
        30       AIV       0        A2/A3
        31       AIV       0        A2/A3
        32       AIV       0        A2/A3
        33       AIV       0        A2/A3
        34       AIV       0        A2/A3
        35       AIV       0        A2/A3
        36       AIV       0        A2/A3
        51       AIV       0        A2/A3
        52       AIV       0        A2/A3
        57       AIV       0        A2/A3
        58       AIV       0        A2/A3
        59       AIV       0        A2/A3
        60       AIV       0        A2/A3
        61       AIV       0        A2/A3
        62       AIV       0        A2/A3
        63       AIV       0        A2/A3
        64       AIV       0        A2/A3
        65       AIV       0        A2/A3
        66       AIV       0        A2/A3
        67       AIV       0        A2/A3
        68       AIV       0        A2/A3
        69       AIV       0        A2/A3
        70       AIV       0        A2/A3
        71       AIV       0        A2/A3
        72       AIV       0        A2/A3
      Id         DataType          MemType         Addr            Size       CoreId            dim
       0    DEVICE_KERNEL_OBJECT   GM              0x12c0c0052000             280344
       1            STACK          GM/DCACHE       0x12c140864000             16384              25
       2            STACK          GM/DCACHE       0x12c140868000             16384              26
       3            STACK          GM/DCACHE       0x12c14086c000             16384              27
       4            STACK          GM/DCACHE       0x12c140870000             16384              28
       5            STACK          GM/DCACHE       0x12c140874000             16384              29
       6            STACK          GM/DCACHE       0x12c140878000             16384              30
       7            STACK          GM/DCACHE       0x12c14087c000             16384              31
       8            STACK          GM/DCACHE       0x12c140880000             16384              32
       9            STACK          GM/DCACHE       0x12c140884000             16384              33
      10            STACK          GM/DCACHE       0x12c140888000             16384              34
      11            STACK          GM/DCACHE       0x12c14088c000             16384              35
      12            STACK          GM/DCACHE       0x12c140890000             16384              36
      13            STACK          GM/DCACHE       0x12c1408cc000             16384              51
      14            STACK          GM/DCACHE       0x12c1408d0000             16384              52
      15            STACK          GM/DCACHE       0x12c1408e4000             16384              57
      16            STACK          GM/DCACHE       0x12c1408e8000             16384              58
      17            STACK          GM/DCACHE       0x12c1408ec000             16384              59
      18            STACK          GM/DCACHE       0x12c1408f0000             16384              60
      19            STACK          GM/DCACHE       0x12c1408f4000             16384              61
      20            STACK          GM/DCACHE       0x12c1408f8000             16384              62
      21            STACK          GM/DCACHE       0x12c1408fc000             16384              63
      22            STACK          GM/DCACHE       0x12c140900000             16384              64
      23            STACK          GM/DCACHE       0x12c140904000             16384              65
      24            STACK          GM/DCACHE       0x12c140908000             16384              66
      25            STACK          GM/DCACHE       0x12c14090c000             16384              67
      26            STACK          GM/DCACHE       0x12c140910000             16384              68
      27            STACK          GM/DCACHE       0x12c140914000             16384              69
      28            STACK          GM/DCACHE       0x12c140918000             16384              70
      29            STACK          GM/DCACHE       0x12c14091c000             16384              71
      30            STACK          GM/DCACHE       0x12c140920000             16384              72
      31        INPUT_TENSOR       GM              0x12c0413e0000             131072             []
      32        INPUT_TENSOR       GM              0x12c080ae1000(invalid)    120000             []
      33        INPUT_TENSOR       GM              0x12c0413c0000             131072             []
      34            ARGS           GM/DCACHE       0x12c100091000             56
    (msdebug) x -m GM -f uint8_t 0x12c0c0052000 -s 8 -c 2
    0x12c0c0052000: {0xa0 0x3f 0x3a 0x07 0x10 0x00 0x7b 0x07}
    0x12c0c0052008: {0x80 0x38 0x9e 0x02 0x81 0xd7 0x3b 0x00}
    (msdebug) x -m DCACHE -f uint8_t 0x12c140864000 -s 8 -c 2
    0x12c140864000: {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
    0x12c140864008: {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
    
  6. 请参考核切换读取寄存器以及内存与变量打印章节的内存打印相关操作定位硬件异常。
  7. 调试完以后,执行q命令并输入Y或y结束调试。
    1
    2
    (msdebug) q
    Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] y