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.

Disqualified loop

Other Parts Discussed in Thread: TMS320DM643, CCSTUDIO

Hello to all.

I'm optimizing my software for it run more fast in a TMS320DM643 micro. I have actived chache memory and I have removed all input output function as other post recommend me.

In now I'm trying optimize my code with -o3 compiler options. I look the functions in the .asm file that the compile generate with -k option and I read the "SOFTWARE PIPELINE INFORMATION". I ever try that "ii" grow and the "Loop Carried Dependency Bound(^)" is as near as possible of 0.

I think that it is the best that I can to do for optimize my code because I get reduce the clock cycles, but I have a problem with a function.

The "SOFTWARE PIPELINE INFORMATION" for this function is:

;*----------------------------------------------------------------------------*
;*   SOFTWARE PIPELINE INFORMATION
;*      Disqualified loop: Loop contains a call
;*----------------------------------------------------------------------------*

I have been reading in the manuals and I understand that I should be use -pm -op2 options for this problems, but I don't get nothing.

What can I do for this problems?

Thank you.

PD.Sorry for my bad inglish

 

 

  • The error message the compiler is giving you says it all.  You will not be able to get the software pipeline to work if you have a function call in the middle of your loop.

    Are you making a call to a function in a for() loop?

    A function call is a program discontinuity, and therefore will not allow the compiler to schedule operations and utilize the various functional units efficiently.

  • Brandon is correct, the disqualification sounds like there is a function call in your loop that the optimizer is unable to inline for some reason. For some possible reasons as to why this may be happening please take a look at section 2.11.5 'Inlining Restrictions' of SPRU187. If you could code out the call alltogether instead of having the compiler inline it you may still be able to get software pipelining going in your loop.

  • But in the loop of my function there isn't call to another function. And my function isn´t inline.

    The loop is a simple loop without call another function. I paste here the function for you can see it:

    void Marra (unsigned short int * array, unsigned short int numero, double* resultado1, double* resultado2)
    {
        double suma=0, suma2=0, valor;
        unsigned short int *p = array;
           
        for (short int i=0; i<=numElems-1; i++)
        {
            valor = *(p++);
            suma  += valor;
            suma2 += (valor*valor);
           
        }
        suma  /=numero;
        suma2 /=numero;
       
        *resultado1= suma;
        *resultado2 = (suma2 - suma*suma);
    }

     

    Thank for your answer

  • A divide is commonly a function call, and a divide of a double variable will be a function call for a chip like the dm643 that doesn't have floating point hardware.  You can check for "hidden" functions like this by loading your code and then selecting View mixed source/asm from the view menu.  CCS will insert the assembly language after the C statements, and you may be surprised how many "calls" show up.

  • MattLipsey is correct, performing divisions and working with floating point numbers in general on a fixed point processor means a lot of calls to the run time support library (RTS) even though they are not explicitly obvious in the code. If you could write your loop such that it was only using fixed point operations and multiplies it would likely be able to get into a software pipeline more easily.

  • Well, but in my loop there isn't divide. The divide operations is out of loop.

    Is all the operations with double a function call? Then is better that I don't use a double variable, it is true?

    In my programs there is a lot of double variable.

    Could I optimize my code removing all double variable? Is posible that I get a better optimization of my code.

  • Emilio Rodriguez said:
    Is all the operations with double a function call? Then is better that I don't use a double variable, it is true?

    This is likely the issue, the double is both floating point and particularly wide, so it will require a good bit of additional code in the end executable to manage, meaning hidden function calls (this might actually work on a C67x floating point core). Just as a quick test if you made the loop to use only ints you could see if you still get the disqualification.

    Emilio Rodriguez said:
    Could I optimize my code removing all double variable? Is posible that I get a better optimization of my code.

    In general using double variables will take extra peformance to handle, so if you are looking for the best optimization and you can change to a simpler data type like int it would be a good idea to do so.

  • Ok, I going to try remove all double variables. I think that some doble I can change for float but is posible that I have to use fixed point arithmetics operating with other. Can I use some manuals for its?

  • Type float is still a floating-point data type so don't be surprised if this still doesn't give you the performance you are looking for. The C64x and C64x+ cores are fixed-point processors which cannot execute floating-point instructions in a single cycle. They effectively require a function call to 'emulate' floating-point arithmetic.

  • Then I should be use some functions to 'emulate' floating-poin. 

    I have read in the forms about the library IQmath.

    Can this library help me?, can you send my any example about it?

  • The ability to emulate floating-point arithmetic on a fixed-point device is built into the TI software offering. I can't remember if this is all a part of the compiler or the RTS (Run-Time Support) library, but it is already somewhere. IQMath is an alternative method which is generally a little bit faster for floating-point arithmetic. You can find the IQMath Library for the C64x+ devices here.

  • Hi to all. I was slow to respond, but it is because I have been reading to IQmath manuals and I have been testing the library.

    I have a problem with IQmath librery. I don't get that my software compile. I have added the includes and .lib file but the softeare show the next message:

    <Linking>
    >> TI4044:   error: system error, can't open file
                        'G:\Proyectos\VisioWay\ALPR\DSP\Desarrollo\Prueba\IQmath_c64x.obj' for input: No such file or directory


    >> Compilation failure

     

    Ihave trying to compile the example project dotprod_IQ.pjt but I can´t, Iget this message when I try it:

     

    --------------------------  dotprod_IQ.pjt - Inline  --------------------------
    [dotprod_IQ_c.c] "C:\CCStudio_v3.1\C6000\cgtools\bin\cl6x" -k -o3 -fr"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -fs"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -ft"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -fb"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -i"../../include/" -d"_INLINE_IQMATH" -mt -mw -mh -mi -mv6400+ -@"Inline.lkf" "dotprod_IQ_c.c"
    >> ERROR: cannot run cmp6x - file could not be found

    [dotprod_IQ_d.c] "C:\CCStudio_v3.1\C6000\cgtools\bin\cl6x" -k -o3 -fr"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -fs"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -ft"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -fb"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -i"../../include/" -d"_INLINE_IQMATH" -mt -mw -mh -mi -mv6400+ -@"Inline.lkf" "dotprod_IQ_d.c"
    >> ERROR: cannot run cmp6x - file could not be found

    [tsc_h.asm] "C:\CCStudio_v3.1\C6000\cgtools\bin\cl6x" -k -o3 -fr"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -fs"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -ft"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -fb"C:/CCStudio_v3.3/c64plus/IQmath_v213/example/dotprod/Inline" -i"../../include/" -d"_INLINE_IQMATH" -mt -mw -mh -mi -mv6400+ -@"Inline.lkf" "tsc_h.asm"
    >> ERROR: cannot run cmp6x - file could not be found

    Build Complete,
      3 Errors, 0 Warnings, 0 Remarks.

     

    I don't know what is my error.

     

  • See here: http://community.ti.com/forums/p/4285/15827.aspx#15827 recommendations on when to use IQmath, fastRTS and when to use floating point emulation from RTS

    I tried building the example dotprod project with the IQMath lib release and didn't see any errors. Looking at your error log:

    'C:\CCStudio_v3.1\C6000\cgtools\bin\cl6x' I think you may be using  very very old version of CCS and build tools. Can you please update to later versions from:

    http://tiexpressdsp.com/index.php?title=CCS_3.3

    http://tiexpressdsp.com/index.php?title=Compiler_Releases

    Hopefully that should resolve the build errors.

    Gagan

  • I can not update my version of CCS.
    I have CCS v3.1.30 and the links in your post is for a CCS v3.3.
    Can I update my CCS at version 3.3? Can you sent me the link for update CCS to v3.3?

    Thanks
  • Emilio,

    If you have an active subscription to CCS you can update to v3.3. The easiest way I know of to take care of this is to contact your local support center and inquire as to the status of your license. Note that you could also download the evaluation version here, but it can't be upgraded or anything like that.

  • Is possible downloads IQmath for CCS v3.1? or there is any other way to work with fixed point?

  • Emilio Rodriguez said:

    Is possible downloads IQmath for CCS v3.1? or there is any other way to work with fixed point?

    Look at this thread here. I believe it was tested with CCS v3.3, but it may still work with CCS v3.1.

  • Well, If I understand ok this thread, I should replace IQmath_c64x.lib by IQmath_c64x_v212.lib.

    It is ok?. I try it but don't work.


  • Emilio, What are you trying to accomplish? If you want some fixed point code examples, you can refer the below free SW libraries:

    http://focus.ti.com/docs/toolsw/folders/print/sprc265.html
    http://focus.ti.com/docs/toolsw/folders/print/sprc264.html

    If you are trying to understand how to optimize the code, please look here:

    http://focus.ti.com/lit/ug/spru187o/spru187o.pdf
    http://focus.ti.com/lit/ug/spru198i/spru198i.pdf
    http://focus.ti.com/lit/an/spra666/spra666.pdf
    http://tiexpressdsp.com/index.php?title=Category:CGT

    If you are trying to optimize floating point code on DM643x, please see here:

    http://e2e.ti.com/forums/p/4285/15827.aspx#15827