Athread编程常见错误指南



  • 错误一

    代码:

    void fd_compute(float  *a) {
    
       volatile int get_reply, put_reply;
       float a_slave[10];
       short b_slave[10];
    
       get_reply = 0;                                                                                                                                 
       athread_get(PE_MODE, a, a_slave,  6,  &get_reply, 0, 0, 0); 
       while (get_reply != 1); 
    
       get_reply = 0;
       athread_get(PE_MODE, a, a_slave,  0,  &get_reply, 0, 0, 0); 
       while (get_reply != 1); 
    
       get_reply = 0;
       athread_get(PE_MODE, a, b_slave + 1,  4,  &get_reply, 0, 0, 0); 
       while (get_reply != 1); 
    
    
    }
    
    

    错误现场:

    CG  vn000157 exception !
    DMA descriptor examination warning
    ERROR, NO SPE EXCEPTION!
    

    本例错误原因:

    • 传输量没有4B对界(不是4的倍数)
    • 传输量小于0
    • LDM地址没有4B对界,主存地址没对界也会出现该错误

    错误二

    代码:

    void fd_compute(float  *a) {
    
        volatile int get_reply, put_reply;
        float a_slave[16*1024]; // 16 * 1024 * sizeof(float) = 64KB
    
       get_reply = 0;
       athread_get(PE_MODE, a, a_slave,  sizeof(float), &get_reply, 0, 0, 0); 
       while (get_reply != 1); 
    
    }
    
    

    错误现场:

    The exact shot pc is : 4ff0410178
    Slave ldm stack underflow, the stack pointer is now -192. 5B K+�V[+�V["[?1�xTxTThe exact shot pc is : 4ff0410178
    Slave ldm stack underflow, the stack pointer is now -192. ��Preserved stack is 0B, You should either:
       1. specify a preserved size more than it.
       Or
       2. get rid of -b 1 option, that will lay slave stack in memory.
    TxTPreserved stack is 0B, You should either:
    
    

    本例错误原因

    • 定义的数组超出从核 64KB LDM 容量

    错误三

    代码:

    void fd_compute(short  *a) {
    
        int get_reply, put_reply;                                                                                                                     
        float a_slave[10];
    
        get_reply = 0;
        athread_get(PE_MODE, a, a_slave,  sizeof(float), &get_reply, 0, 0, 0); 
        while (get_reply != 1); 
    
    }
    
    

    错误现场:

    Job <43054411> has been submitted to queue <q_sw_share>
    waiting for dispatch ...
    dispatching ...
    
    

    本例错误原因:

    • 回答字get_reply没有用volatile修饰,可能被编译器优化掉了,然后就卡在while (get_reply != 1)

    错误四

    代码:

    void fd_compute(short  *a) {
    
        volatile int get_reply, put_reply;
        float a_slave[10];
    
        get_reply = 0;
        athread_get(PE_MODE, a, a_slave,  10 * sizeof(float), &get_reply, 0, 0, 0); 
        while (get_reply != 1); 
    
        printf("%f\n",a_slave[100]);
                                                                                                                                                      
    }
    
    

    错误现场:

    The exact shot pc is : 4ff0410194
    SPE 0 exception !
    LDM access exception
    The exact shot pc is : 4ff0410194
    The exact shot pc is : 4ff0410194
    SPE 1 exception !
    LDM access exception
    The exact shot pc is : 4ff0410194
    The exact shot pc is : 4ff0410194
    SPE 2 exception !
    
    

    本例错误原因:

    • 访存越界


  • 大家可以先用OpenACC熟悉一下编程环境,但如果想取得非常理想的优化效果,建议大家用Athread

    Athread编程出现的错误,一般来源于athread_get/athread_put两个接口,因此在调试过程中可以把程序中其他部分都注释掉,然后耐心研究这两个接口中的参数



  • 0_1538795623115_8245db8a-7908-414d-8a62-97940102de37-image.png
    请问这个错误的原因是什么呢?怎么解决呢?



  • @桑薇 请问一下错误一中,主存和LDM地址怎么对界?



  • @小学生 从核代码里主存地址越界了,检查从核代码里用的主核地址。



  • @kun 一般情况下,浮点数组或整型数组都是四字节对齐的,但是字符数组是一字节对齐的,这种的话,你可能要注意athread的地址参数是不是四字节对齐的。另外数组地址对齐,编译器是可以保证栈申请的数组首地址是32字节对齐的。



  • 此回复已被删除!


  • @popo 好的,谢谢!



  • 您好,请问出现这个错误可能是因为什么。。。。。。

    slave.c:16: warning: passing argument 5 of 'athread_get' discards qualifiers from pointer target type
    slave.c:17: warning: passing argument 5 of 'athread_get' discards qualifiers from pointer target type
    slave.c:18: warning: passing argument 5 of 'athread_get' discards qualifiers from pointer target type
    slave.c:19: warning: passing argument 5 of 'athread_get' discards qualifiers from pointer target type
    slave.c:33: warning: passing argument 5 of 'athread_put' discards qualifiers from pointer target type
    slave.c:11: warning: unused variable 'y'
    slave.c:11: warning: unused variable 'x'
    /tmp/ccspin#.qvgvx5.s: Assembler messages:
    /tmp/ccspin#.qvgvx5.s:21: Warning: make sure the slave code is in .text1 section, not .text section
    /tmp/ccspin#.qvgvx5.s:26: Warning: make sure the slave code is in .text1 section, not .text section
    /tmp/ccspin#.qvgvx5.s:77: Error: unknown opcode setfpec0' /tmp/ccspin#.qvgvx5.s:78: Error: unknown opcodesetfpec0'
    /tmp/ccspin#.qvgvx5.s:82: Error: unknown opcode setfpec3' /tmp/ccspin#.qvgvx5.s:90: Error: unknown opcodesetfpec0'
    /tmp/ccspin#.qvgvx5.s:144: Error: unknown opcode setfpec3' /tmp/ccspin#.qvgvx5.s:151: Error: unknown opcodesetfpec0'
    /tmp/ccspin#.qvgvx5.s:181: Error: unknown opcode setfpec3' /tmp/ccspin#.qvgvx5.s:187: Error: unknown opcodesetfpec0'
    /tmp/ccspin#.qvgvx5.s:218: Error: unknown opcode setfpec3' /tmp/ccspin#.qvgvx5.s:224: Error: unknown opcodesetfpec0'
    /tmp/ccspin#.qvgvx5.s:234: Error: unknown opcode setfpec3' /tmp/ccspin#.qvgvx5.s:240: Error: unknown opcodesetfpec0'
    /tmp/ccspin#.qvgvx5.s:367: Error: inappropriate arguments for opcode ldl' /tmp/ccspin#.qvgvx5.s:372: Error: inappropriate arguments for opcodeldl'
    /tmp/ccspin#.qvgvx5.s:376: Error: inappropriate arguments for opcode ldl' /tmp/ccspin#.qvgvx5.s:380: Error: inappropriate arguments for opcodeldl'
    /tmp/ccspin#.qvgvx5.s:385: Error: inappropriate arguments for opcode ldl' /tmp/ccspin#.qvgvx5.s:389: Error: inappropriate arguments for opcodeldl'
    /tmp/ccspin#.qvgvx5.s:393: Error: inappropriate arguments for opcode ldl' /tmp/ccspin#.qvgvx5.s:403: Error: inappropriate arguments for opcodestl'
    /tmp/ccspin#.qvgvx5.s:459: Error: unknown opcode setfpec3' /tmp/ccspin#.qvgvx5.s:466: Error: unknown opcodesetfpec0'
    /tmp/ccspin#.qvgvx5.s:496: Error: unknown opcode `setfpec3'
    /tmp/ccspin#.qvgvx5.s:536: Warning: make sure the slave code is in .text1 section, not .text section



  • 此回复已被删除!

登录后回复