错误码0x10

定位思路

***********************2. AICERROR code***********************
#AI Core error错误码及解释。
code  : 0x10

该错误码含义是指令非法,一般因为UB地址不对齐或者一些scalar指令不合法导致,既然是指令非法,只要找到对应的算子指令进行分析即可。

定位步骤

  1. 查看日志1. Basic Information模块中的device id、core id、task id、stream id、node name、kernel name、算子地址等信息找到对应的出错算子。

    ***********************1. Basic information********************
    #AI Core error发生时设备的基本信息。
    #kernel name:算子名称。
    #op address: 算子代码在ddr内存的地址
    #args address:算子参数在ddr内存的地址。
    error time   : 2020-08-26-11:24:07
    device id    : 0
    core id      : 0
    task id      : 60
    stream id    : 517
    node name    : trans_TransData_167
    kernel name  : te_transdata_16b6e15e2a5cc7f70_33e5fb7ae8478ddb
    op address   : 0x101000120000
    args address : 0X101000053000

  2. 查看日志3. Instructions模块中出错算子的python代码行号到对应文件中定位问题,如果问题定位失败请执行后续步骤。

    ***********************3. Instructions************************
    #异常指令。
    start   pc   : 0x101000120000
    current pc   : 0x1010001201e0
    
    Error occured most likely at line: 1d0
                    
    /{当前IDE路径}/aicerror_xxxx/te_transdata_16b6e15e2a5cc7f70_33e5fb7ae8478ddb.o.txt:1d0
    /{当前IDE路径}/collection/compile/kernel_meta/te_transdata_16b6e15e2a5cc7f70_33e5fb7ae8478ddb.cce:32    //出错算子的cce代码行号
    /{python脚本文件路径}/nz_2_nd.py:4486     //出错算子的python代码行号
    
    related instructions (error occured before the mark *):
    
         1bc: <not available>
         1c0: <not available>
         1c4: <not available>
         1c8: <not available>
         1cc: <not available>
         1d0: <not available>
         1d4: <not available>
         1d8: <not available>
         1dc: <not available>
    *    1e0: <not available>  
    
    For complete instructions, please view /{当前IDE路径}/aicerror_xxxx/te_transdata_16b6e15e2a5cc7f70_33e5fb7ae8478ddb.o.txt

  3. 查看日志3. Instructions中给出的start pc与current pc,两者做差得到异常终止运行的指令节点,进入反编译文件.o.txt文件中找到对应指令,查看对应指令进行了什么数据存储操作。
  4. 检索其他含有相同地址操作的指令,排查每个指令中的值是否存在UB越界。例如,在mini环境上,没有单独的scalar buffer,是在UB上划了一块空间作为scalar buffer,所以编译出来的.o必定是在UB的256范围内;但是在cloud中,scalar buffer是单独的buffer,可以超过256K,所以怀疑是不是这个算子编译的.o是cloud版本。
  5. 无论是TBE算子还是TIK算子,都是通过ccec.py来编译生成.o、.json以及.cce文件。修改ccec.py,打印编译信息,重新执行后查看打印内容中的--cce-aicore-arch字段发现之前的算子编译都是mini版本,但到了某个算子之后变成了cloud版本。
  6. 查看引起版本转换的算子,发现该算子是TIK实现的,只支持cloud版本,不支持mini版本。执行完该算子之后将变一版本修改为了cloud版本,导致后续编译算子均为cloud版本,引起了mini环境UB越界造成的非法指令。