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.

Is CCS C compiler becoming more and more poor efficiency?

Other Parts Discussed in Thread: TMS320C6455, CCSTUDIO

The same C program, when I profile it withe ccs3.2 ccs3.3 and ccs5, I find the execution cycles  become more and more.IS there anything wrong with the CCS version Or I am wrong?

在使用CCS的profiler时,同样的程序、同样的芯片类型,运行周期从CCS3.2到3.3到5.0,周期在不断变大。是C编译器的原因还是以前版本计算的不够准确?请求您给予一个解答,谢谢了!

韦志恒 weizhiheng99@yahoo.com.cn 中国科学院声学研究所 海淀区北四环西路21号 

 

The dsp chip is tms320c6455

===========hello.c

#include <stdio.h>

//double a1=12.0;double b1=23.0;double c1=3.0;

int a1=12;int b1=23;int c1=3;

 

void jisuanAdd(){   c1=a1+b1;}

void jisuanMul(){   c1=a1*b1;}

void jisuanDiv(){   a1=c1/b1;}

 

void main(void) {

        jisuanAdd();

        jisuanMul();

        jisuanDiv();}

 

============================= wei.cmd

-heap  0x2000

-stack 0x2000

-l rts64plus.lib

/* Memory Map 1 - the default */

MEMORY

{

        L1D:     o = 00f00000h   l = 00008000h

        L1P:     o = 00e00000h   l = 0000F000h

        L2:      o = 00800000h   l = 00200000h

}

SECTIONS

{   

    .text       >       L2

    .stack      >       L2

    .bss        >       L2

    .cinit      >       L2

    .cio        >       L2

    .const      >       L2

    .data       >       L2

    .switch     >       L2

    .sysmem     >       L2

    .far        >       L2      

}

 

CCS3.2 compile

[hello.c] "C:\CCStudio_v3.2\C6000\cgtools\bin\cl6x" -g -fr"D:/CCC345/Debug" -d"_DEBUG" -mv6400+ -@"Debug.lkf" "hello.c"

 

[Linking...] "C:\CCStudio_v3.2\C6000\cgtools\bin\cl6x" -@"Debug.lkf"

<Linking>

 

Build Complete,

0 Errors, 0 Warnings, 0 Remarks.

 

Below is debug.lkf

-z -c -m"./Debug/CCC345.map" -o"./Debug/CCC345.out" -w -x -i"C:/CCStudio_v3.2/C6000/rtdx/lib" -i"C:/CCStudio_v3.2/C6000/csl/lib" -i"C:/CCStudio_v3.2/C6000/xdais/lib" -i"C:/CCStudio_v3.2/bios_5_21/packages/ti/bios/lib" -i"C:/CCStudio_v3.2/C6000/cgtools/lib"

"D:\CCC345\wei.cmd"

"D:\CCC345\Debug\hello.obj"

"C:\CCStudio_v3.2\C6000\cgtools\lib\rts64plus.lib" 

  

jisuan Add  10 cycles

jisuanDiv 38 cycles

jisuanMul  19 cycles

CCS5.0.   Version: 5.0.1.201105110900

**** Build of configuration Debug for project TestFloat ****

 

C:\Program Files\Texas Instruments\ccsv5\utils\gmake\gmake -k all

'Building file: ../hello.c'

'Invoking: C6000 Compiler'

"C:/Program Files/Texas Instruments/ccsv5/tools/compiler/c6000/bin/cl6x" -mv64+ -g --include_path="C:/Program Files/Texas Instruments/ccsv5/tools/compiler/c6000/include" --diag_warning=225 --abi=coffabi --preproc_with_compile --preproc_dependency="hello.pp"  "../hello.c"

'Finished building: ../hello.c'

' '

'Building target: TestFloat.out'

'Invoking: C6000 Linker'

"C:/Program Files/Texas Instruments/ccsv5/tools/compiler/c6000/bin/cl6x" -mv64+ -g --diag_warning=225 --abi=coffabi -z -m"TestFloat.map" --warn_sections -i"C:/Program Files/Texas Instruments/ccsv5/tools/compiler/c6000/lib" -i"C:/Program Files/Texas Instruments/ccsv5/tools/compiler/c6000/include" --reread_libs --rom_model -o "TestFloat.out"  "./hello.obj" -l"libc.a" "../rts64plus.lib" "../wei.cmd"

<Linking>

'Finished building target: TestFloat.out'

jisuan Add  14 cycles

jisuanDiv 79cycles

jisuanMul  17 cycles

If change the src file :

//double a1=12.0;double b1=23.0;double c1=3.0;

int a1=12;int b1=23;int c1=3;

to

double a1=12.0;double b1=23.0;double c1=3.0;

//int a1=12;int b1=23;int c1=3;

 

Can get: CCS3.2

jisuan Add  149 cycles

jisuanDiv 287cycles

jisuanMul  118 cycles

CCS5

jisuan Add  259 cycles

jisuanDiv 1058 cycles

jisuanMul  189 cycles

IS THERE SOMETHING WRONG???

The function jisuanDiv execution cycle : from 287 change to 1058.

CCS3.3 compile

-----------------------------  CCC345.pjt - Debug  -----------------------------

[hello.c] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -g -fr"D:/CCC345/Debug" -d"_DEBUG" -mv6400+ -@"Debug.lkf" "hello.c"

 

[Linking...] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -@"Debug.lkf"

<Linking>

 

Build Complete,

  0 Errors, 0 Warnings, 0 Remarks.

 

double

 

jisuan Add  155 cycles

jisuanDiv 293cycles

jisuanMul  124 cycles

int

 

 

jisuan Add  16 cycles

jisuanDiv 44 cycles

jisuanMul  19 cycles

  • What version of the C6000 compiler are you using in each of these three cases?  (The compiler version is not the same as the CCS version.)

  • The c compiler version is more and more new.

    ccs3.2<============> cl6x.exe 6.01

    ccs3.3<============> cl6x.exe 6.08

    ccs5.0<============> cl6x.exe 7.21

    //=======================================

    The src above can be test by anyone. without optimation. Below is no opt selection. Other compiler is the same.

    "C:\CCStudio_v3.2\C6000\cgtools\bin\cl6x" -g -fr"D:/CCC345/Debug" -d"_DEBUG" -mv6400+ -@"Debug.lkf" "hello.c"

  • I looked at the compiler-generated code for each of these different compiler versions, and the code is not substantially different between versions.  The 16-bit instruction usage is different between 6.0.x and 7.2.1, but this should have minimal impact on performance.  Therefore, it is not the compiler which is causing these numbers to increase.  I don't know what is causing this; perhaps the profiler is getting more accurate about memory stalls; perhaps the profiling methodology is changing.  In any case, this is a question for the CCS forum, rather than the compiler forum.

  • Zhiheng,

    Are you using the simulator or running on hardware when you do the profiling?
    If you take the .out file created in CCS 3.2 or CCS 3.3, load that into CCSv5 and profile it, do you still see increased numbers? Basically this will be using the same executable (.out) in CCS 3.3 and CCSv5 and help narrow down if the issue is in the profiler or elsewhere.

    I will also try to build your code and see what kind of cycle counts I get for it in CCS5.2.1 (which is the latest - I noticed you are using an older version 5.0.1)

  • I did some testing with CCS 5.2.1 (latest version) and different versions of the compiler tools and profiled the functions in each case. I found that the cycle counts for the jisuanDiv routine was very high for the 7.2.1 cgtools as you noted, however they were back down with version 7.3.4 which is the version included with CCS 5.2.1.

    I used your C source code and linker command file and simply rebuilt the code with different versions of the compiler tools in CCS 5.2.1. I then ran the code on a C64x+ CPU Cycle Accurate simulator.

    Here are the values I saw with the different versions of cgtools:

    CGT 6.0.8:
    jisuanAdd - 156
    jisuanDiv - 294
    jisuanMul - 125

    CGT 7.2.1:
    jisuanAdd - 154
    jisuanDiv - 899
    jisuanMul - 131

    CGT 7.3.4:
    jisuanAdd - 154
    jisuanDiv - 393
    jisuanMul - 131

    There was probably an inefficiency in the divide routine in the runtime library of CGT 7.2.1 that caused the spike in cycle count for that version.

    If possible, I would strongly suggest updating to CCS 5.2.1. You can still easily set CCS to use different versions of the compiler to build your project, if you desire, without having to switch the version of CCS itself.

  • Thank you Archaeologist !

    Thank you AartiG!

    Thanks TI !

    As a DSP lover and user,I am so glad with your careful support ! AartiG's answer is in detailed ,I am so graceful that I can not say much more.

  • AartiG:

       would you open your CGT 7.2.1 configuration?

       In CGT 6.0.8 , we are nearly the same

    jisuan Add  155 cycles         jisuanDiv 293cycles            jisuanMul  124 cycles

    CGT 6.0.8:
    jisuanAdd - 156
    jisuanDiv - 294
    jisuanMul - 125

    but in CGT7.2.1 ,difference is so big:

    jisuan Add  259 cycles        jisuanDiv 1058 cycles    jisuanMul  189 cycles

    CGT 7.2.1:
    jisuanAdd - 154
    jisuanDiv - 899
    jisuanMul - 131.

    In my simulation, without optimation.

    Thanks!

  • My build was without optimization as well. Here is the output of my build with CGT 7.2.1:

    **** Build of configuration Debug for project c6455_profile ****

    C:\CCStudio_v5.2.1.00018\ccsv5\utils\bin\gmake -k all

    'Building file: ../main.c'

    'Invoking: C6000 Compiler'

    "C:/ti/C6000 Code Generation Tools 7.2.1/bin/cl6x" -mv64+ -g --define=c6455 --include_path="C:/ti/C6000 Code Generation Tools 7.2.1/include" --display_error_number --diag_warning=225 --abi=coffabi --preproc_with_compile --preproc_dependency="main.pp" "../main.c"

    'Finished building: ../main.c'

    ' '

    'Building target: c6455_profile.out'

    'Invoking: C6000 Linker'

    "C:/ti/C6000 Code Generation Tools 7.2.1/bin/cl6x" -mv64+ -g --define=c6455 --display_error_number --diag_warning=225 --abi=coffabi -z -m"c6455_profile.map" --stack_size=0x800 --heap_size=0x800 --warn_sections -i"C:/ti/C6000 Code Generation Tools 7.2.1/lib" -i"C:/ti/C6000 Code Generation Tools 7.2.1/include" --reread_libs --rom_model -o "c6455_profile.out" "./main.obj" -l"rts64plus.lib" "../link.cmd"

    <Linking>

    'Finished building target: c6455_profile.out'

    ' '

    **** Build Finished ****

    My suggestion would be to update to the latest version of CCS (including latest CGT) and go from there. CCS can be downloaded and installed from http://processors.wiki.ti.com/index.php/Download_CCS