This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C64x+ IQmath Library,为什么没有提供相应的批量计算的函数???单个的效率很低,如果不提供批量的,那又何必提供这个库呢!

Other Parts Discussed in Thread: MATHLIB

C64x+ IQmath Library,为什么没有提供相应的批量计算的函数???单个的效率很低,如果不提供批量的,那又何必提供这个库呢!

之前看到有定点数学计算库,看到性能还是不错的,但是最后使用时,发现,调用时都是使用的函数,执行效率只有dange独立执行的效率,查看汇编程序是,发现没法PIPELINE,导致效率非常低,这样根本没任何意义,使用这个库就是希望能达到高效率。如IQNsinPU,单个执行时45clock,pipelined只需要3.5这样效率就差了10多倍。现在使用这个库,只能调用单个的IQNsinPU函数,却没有批量计算的函数,这样的定点库有和意义,还是说要付费购买完整版的定点库?

  • 定点dsp上实现浮点运算效率是不高的。这个就是完整版的库了。如果用多核芯片的话,建议可以用浮点库。
    http://www.ti.com/tool/mathlib

  • ;----------------------------------------------------------------------
    ; 1052 | for(s32 i=0;i<TOTAL_CHNUM;i++)                                         
    ;----------------------------------------------------------------------

               ADD     .L1     A0,A11,A12
    ||         LDW     .D1T1   *A14++,A4         ; |1053|
    ||         ADD     .S1     A0,A11,A13
    ||         MV      .L2     B0,B10
    ||         MVK     .S2     0x1e,B4           ; |1053|

    ;*----------------------------------------------------------------------------*
    ;*   SOFTWARE PIPELINE INFORMATION
    ;*      Disqualified loop: Loop contains a call
    ;*          Loop at line 1052 cannot be scheduled efficiently, as it contains a function call ("_IQNsinPU"). Try to inline call or consider rewriting loop.
    ;*      Disqualified loop: Loop contains non-pipelinable instructions
    ;*----------------------------------------------------------------------------*
    $C$L218:    
        .dwpsn    file "../Experiment/UiExp.cpp",line 1052,column 16,is_stmt,isa 0
    $C$DW$L$_ZN6CUiExp8newtimerEv$337$B:
        .dwpsn    file "../Experiment/UiExp.cpp",line 1053,column 0,is_stmt,isa 0
    ;----------------------------------------------------------------------
    ; 1053 | sin_value[i]=_IQsinPU(sin_rad[i]);                                     
    ;----------------------------------------------------------------------
    ;----------------------------------------------------------------------
    ; 1055 | s32 *rad=       sin_rad;                                               
    ;----------------------------------------------------------------------
    ;**    -----------------------g330:
    ;* 1053    -----------------------    *U$2981++ = _IQNsinPU(*U$2977++, 30u);
    ;* 1052    -----------------------    if ( L$1 = L$1-1 ) goto g330;
    ;* 1055    -----------------------    rad = K$2646;
    $C$DW$484    .dwtag  DW_TAG_TI_branch
        .dwattr $C$DW$484, DW_AT_low_pc(0x00)
        .dwattr $C$DW$484, DW_AT_name("_IQNsinPU")
        .dwattr $C$DW$484, DW_AT_TI_call
               CALLP   .S2     _IQNsinPU,B3
        .dwpsn    file "../Experiment/UiExp.cpp",line 1053,column 5,is_stmt,isa 0
    $C$RL67:   ; CALL OCCURS {_IQNsinPU} {0}     ; |1053|
    $C$DW$L$_ZN6CUiExp8newtimerEv$337$E:
    ;** --------------------------------------------------------------------------*
    $C$DW$L$_ZN6CUiExp8newtimerEv$338$B:

               SUB     .L1X    B10,1,A0          ; |1052|
    ||         STW     .D1T1   A4,*A13++         ; |1053|
    ||         SUB     .L2     B10,1,B10         ; |1052|

       [ A0]   BNOP    .S1     $C$L218,2         ; |1052|
    || [!A0]   MVK     .S2     0x20,B0           ; |1057|
    || [!A0]   MV      .L1     A10,A13           ; |1055|
    || [ A0]   LDW     .D1T1   *A14++,A4         ; |1053|

       [ A0]   MVK     .S2     0x1e,B4           ; |1053|

  • 看他的benchmark是可以达到4clock的,但是程序却pipelined不了,如果提供批量运算的pipeline函数也可以。我看新的浮点的都提供了源码的,但是浮点其他地方有额外开销(比如加、减、乘、比较等,整形1clock可以完成并且出结果,float一般要4clock才出结果)