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.

evmc6472 + CCSv4.2 + compiler optimisation "optimize for speed(--opt_for_speed,-mf) "



Hello,

I'm working on the implementation of H264/AVC video encoder on  EVMC6472 plateform using CCSv4.2.

the execution of my code on this plateform gives me  12 frames/s as encoding speed value using only  one core knowing that C6472 DSP contins 6 C64+ cores.

I'm trying to optimize my code using the compiler optimisation of CCSv4.2:

there is an option which called optimize for speed(--opt_for_speed,-mf): and it contains 5 levels of optimisation:

At the first step, I used the level 1: the encoding speed is increased from 12f/s to 15.5 frames/s. it very good.

After that I passed to level 2: when I used this level, the encoding speed is increase to 20f/s but I obtained a video sequence different to the level 0 or 1: it's wrong

I want know where is the problem and how can I resolve this problem.

I will be very thankfull

Cordially

David

  • David,

    Since this is a compiler question and not a device hardware question, the best people to discuss this with are at the Compiler Forum; this thread will be moved there for best support. That forum would also be a good place to search for similar issues people may have had with code optimization. There may also be some good tips & tricks in the TI Wiki Pages, search for optimization to see what might be available.

    If a variable is tested as a flag to enable processing and that variable is modified outside the scope of the function testing it, then that variable must be declared as volatile. This can change the sequence of code operation in some cases.

    The compiler may think that some code sequences can be rearranged because of no apparent relationship of the order of operations. This could happen because of pointer aliasing, or because of incorrect use of the restrict keyword or of the --no_bad_aliases compiler switch.

    You can change the compiler switches on a file-by-file basis. Right-click on a file in your Project Window and select Build Properties. You can change settings for that one file without affecting the settings for the other files. Use this methodology to narrow down the file that is causing the data corruption.

    These are some first-pass ideas for looking at your code. You will also want to review the information on optimization in the Compiler User's Guide.

    Regards,
    RandyP

  • Like Randy says, there is not enough here for us to say anything concrete.

    I suggest you look at the presentation on this wiki page, especially slide 46.

    Thanks and regards,

    -George

  • Thank you RandyP ...I found the problem when I follow your advice "You can change the compiler switches on a file-by-file basis. Right-click on a file in your Project Window and select Build Properties. You can change settings for that one file without affecting the settings for the other files. Use this methodology to narrow down the file that is causing the data corruption". I'm very thankfull for you.

    The problem was : I have a function that computes the abs( ) ...When I used abs( ) and I applied the level 2 of the optimisation of speed I find my problem but when I changed abs by the intrinsic function _abs( ), the problem was resolved...I donc understund why abs makes this problem knowing that I wrote in my code #Include<stdlib.h> where the abs( ) function was declared . If you have an explication, I'll be very thankfull.

    cordially

    david

     

     

  • David,

    Glad you were able to get it solved.

    My guess is that the compiler's optimizer threw out some code that it thought was not needed, but it was not allowed to do that when the intrinsic function was used.

    No promises on figuring it out, but if you can, make a zip file with that one .c file and the two asm files built with and without -o2 (use compiler -k option to keep the assembly output file), then attach it to a reply on this thread. When editing the reply, there is a red Options link near the top and it has an Add button for a single file attachment.

    Regards,
    RandyP