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.

C6455 is slower than DM642

The same arithmetic used  the same data is running on the C6455 and DM642. C6455 takes 3  times more time than DM642.

C6455 CPU clk = 1GHz  (confirmed),  Memory being used: On chip IRAM L2, used DSP/BOIS, 1000 microsecond/Int

DM642 CPU clk = 600MHz, Memory being used: Off chip SDRAM, used DSP/BOIS, 1000 microsecond/Int

In theory, C6455 should be fast than DM642. I don't know why the result is not.

Ps: My project is based on the dsk6455 example 'dsp_app.prj'

  • Ruikai Jiang,

    This is difficult to believe for me, also.

    Ruikai Jiang said:

    C6455 CPU clk = 1GHz  (confirmed),  Memory being used: On chip IRAM L2, used DSP/BOIS, 1000 microsecond/Int

    DM642 CPU clk = 600MHz, Memory being used: Off chip SDRAM, used DSP/BOIS, 1000 microsecond/Int

    On chip vs. SDRAM should make a huge difference in speed the other way around. In other words, the DM642 should run much slower when running out of SDRAM.

    Ruikai Jiang said:
    My project is based on the dsk6455 example 'dsp_app.prj'

    I do not find any "dsp_app" on my computer. Also, ".prj" is not a filetype that we use now in CCSv5.3, nor have we used it in older systems like CCS 3.3. Please provide more information on what you are running.

    And please provide more information on what you are doing differently on the two platforms plus how you are taking your timing measurements.

    Regards,
    RandyP

     

  •  dsk6455 example 'dsp_app.prj' download http://c6000.spectrumdigital.com/dsk6455/v2/files/dsk6455_v2.zip

    DSP/BOIS config file is same to  dsk6455 example 'dsp_app.prj' .

     timing measurements using STS obj.

    eg: STS_set(&stsObj, CLK_gethtime());

     // do argorithm....

    STS_delta(&stsObj, CLK_gethtime());

  • The arithmetic is TI C6000 DSPLIB Complex FIR Fliter - DSP_fir_cplx() .

    Timing measure is using STS object.
    void PRD_fir_cplx()
    {
    STS_set(&STSt,CLK_gethtime());
    DSP_fir_cplx(x, h, r, NH, NR);
    STS_delta(&STSt,CLK_gethtime());
    }
    Test Result:
    in C6455 takes  26000 cycle.
    in DM642 takes 4900 cycle.
  • fir_cplx_d.c

    /* ======================================================================== */
    /* TEXAS INSTRUMENTS, INC. */
    /* */
    /* NAME */
    /* fir_cplx -- Driver file for fir_cplx */
    /* */
    /* USAGE */
    /* This code contains a driver program for calling the 'fir_cplx' */
    /* function. */
    /* */
    /* ------------------------------------------------------------------------ */
    /* Copyright (C) 2005 Texas Instruments, Incorporated. */
    /* All Rights Reserved. */
    /* ======================================================================== */
    #include "trackcfg.h"
    #include <stdio.h>
    #include <sts.h>
    #include <clk.h>


    /* ======================================================================== */
    /* Kernel-specific alignments */
    /* ======================================================================== */
    #pragma DATA_ALIGN(x, 8);
    #pragma DATA_ALIGN(h, 8);
    #pragma DATA_ALIGN(r, 8);

    /* ======================================================================== */
    /* Parameters of fixed dataset. */
    /* ======================================================================== */
    #define NH (32)
    #define NR (256)
    #define NI (NH+NR-1)

    /* ======================================================================== */
    /* Input data */
    /* ======================================================================== */
    short x [NI*2] =
    {
    -0x00F3, -0x0100, -0x00AE, 0x0090, 0x000A, -0x0033, 0x00D7, -0x0009,
    -0x00C4, 0x00D0, -0x000B, 0x00FE, 0x009B, 0x000D, -0x0125, -0x0043,
    0x00CD, 0x000E, -0x0082, -0x0006, 0x00AE, -0x0051, 0x0015, -0x011A,
    -0x0006, 0x00FC, 0x0100, 0x0014, -0x007C, -0x00B3, 0x003E, 0x0113,
    0x00B0, 0x002B, 0x0087, 0x012A, 0x00A4, 0x00CA, -0x00FB, 0x002E,
    -0x0107, 0x0083, 0x0067, 0x011F, 0x000A, -0x008E, 0x00CA, -0x00F3,
    0x00EB, 0x003E, -0x0040, -0x0055, 0x00E8, 0x0044, -0x007F, 0x00A0,
    -0x0121, -0x012A, -0x0073, 0x0041, 0x00A1, -0x0092, -0x009E, -0x0075,
    -0x0022, 0x012A, -0x00F0, 0x00F1, -0x0051, -0x00A2, 0x00EB, 0x006A,
    0x00B7, 0x0127, -0x0058, -0x001E, -0x00C9, 0x00EB, -0x00AA, 0x0129,
    0x012A, -0x0123, 0x000F, -0x00F4, -0x00BC, 0x00BD, -0x001A, 0x00A6,
    -0x0111, -0x0099, -0x00E1, -0x00D7, 0x0005, 0x0112, 0x011C, -0x0041,
    -0x009D, 0x009D, -0x00E0, -0x001B, 0x0112, -0x0111, -0x007F, 0x00AA,
    -0x0006, 0x0038, 0x006A, 0x00B4, -0x00C6, -0x009C, -0x0034, -0x0023,
    0x010E, -0x0128, -0x0123, -0x0028, 0x00B4, -0x0117, -0x004F, 0x0040,
    0x00EB, -0x0124, 0x006D, 0x010D, -0x011C, -0x0034, -0x0113, 0x008D,
    0x00D1, -0x00C6, 0x00F8, -0x0058, -0x0073, -0x009A, -0x00AF, -0x00A4,
    0x0108, 0x002E, -0x0058, -0x002C, -0x0055, 0x010B, 0x00DF, -0x0042,
    0x001B, -0x00BB, 0x0128, -0x007A, -0x0032, -0x004A, 0x00B4, 0x004E,
    -0x00DA, -0x006B, -0x005F, -0x007F, 0x0088, -0x0127, -0x005F, 0x0114,
    -0x002C, -0x0029, 0x00D7, -0x0122, -0x0071, -0x0077, -0x0003, 0x006C,
    0x0086, -0x00CA, 0x0055, 0x0080, 0x0103, -0x0041, -0x00AE, -0x0055,
    0x0027, 0x003F, -0x0048, 0x00C9, -0x0057, 0x0111, 0x0106, -0x0112,
    0x0032, 0x00C1, 0x0006, 0x00ED, 0x00D6, -0x0040, -0x0019, 0x0094,
    0x004C, 0x005A, 0x0063, 0x0021, 0x0119, -0x00A3, 0x0107, -0x00E5,
    -0x00D6, 0x007B, -0x0056, 0x011D, -0x0021, 0x0094, -0x00AA, -0x0019,
    0x00A7, 0x0065, 0x00F9, -0x0045, 0x001D, 0x00F3, -0x003B, 0x00EF,
    -0x0088, 0x00C1, 0x0060, 0x0109, 0x0013, -0x0004, 0x005A, 0x00E7,
    0x0035, 0x00BC, -0x005C, 0x00B9, -0x0047, 0x0016, -0x009E, 0x00EB,
    -0x00A1, 0x0076, 0x00D7, 0x0004, 0x00BF, 0x0105, 0x00DD, -0x0044,
    0x0108, -0x00B1, -0x00E5, 0x0006, 0x0018, -0x0048, -0x009A, -0x010D,
    0x0003, -0x008B, -0x007E, -0x0106, 0x0089, 0x0000, 0x00D3, -0x00A5,
    0x0104, 0x00BE, -0x00AF, -0x007B, 0x00AC, -0x0086, -0x0119, 0x005E,
    0x00A9, 0x00B2, -0x0109, 0x001B, -0x0060, 0x0066, -0x006F, -0x002B,
    0x00B2, -0x002D, -0x0064, 0x011A, -0x0005, 0x0028, 0x0107, -0x00AA,
    0x00B1, 0x009D, 0x0121, -0x0052, -0x007C, 0x00E3, 0x0066, 0x0084,
    0x00A8, -0x001E, 0x00D7, -0x008D, 0x0010, -0x012B, 0x00E9, -0x003D,
    -0x0079, 0x00A9, -0x0027, -0x0079, 0x0068, -0x002F, 0x00E3, -0x0029,
    -0x00FB, 0x0107, 0x0076, 0x0091, -0x00C2, 0x0059, -0x004A, 0x0101,
    0x00F8, 0x0012, -0x0062, -0x003C, 0x0107, -0x0054, -0x003E, -0x0042,
    0x0090, -0x0041, -0x00AC, 0x006C, -0x010E, 0x00B5, -0x007C, -0x0017,
    -0x0109, 0x003F, 0x012C, 0x00FC, 0x00C2, -0x0028, -0x0109, 0x00D1,
    0x0011, 0x0096, -0x00D8, -0x012C, 0x0125, 0x00D9, 0x00EC, 0x0020,
    0x00D8, -0x0017, -0x0113, -0x00BC, -0x00A0, 0x0111, 0x012A, -0x0058,
    0x00F0, -0x00A7, -0x000A, -0x00BE, 0x0108, -0x0084, 0x0062, 0x0002,
    -0x0110, -0x0064, -0x006D, 0x0011, -0x00C7, 0x0087, 0x0018, 0x0076,
    0x00D1, -0x0092, -0x0034, -0x00D6, 0x00FD, -0x0026, -0x009C, -0x0078,
    0x00E2, -0x00F0, 0x00B9, -0x00BE, 0x0046, 0x0105, -0x00E7, 0x00B2,
    0x00D5, -0x0038, -0x00C0, -0x00D2, 0x00DF, 0x0023, -0x0063, 0x0007,
    -0x0123, -0x00AE, 0x000D, -0x00B2, -0x0018, -0x00FD, -0x00C4, 0x0039,
    0x0095, -0x008F, -0x0112, 0x009A, 0x0037, 0x004F, 0x003C, -0x00B4,
    -0x001B, 0x003F, -0x0038, -0x0063, -0x0042, 0x00D1, -0x0104, 0x0126,
    0x0063, -0x0069, -0x00DC, 0x0060, 0x0056, -0x0082, 0x0031, 0x00C2,
    -0x002C, 0x003C, -0x0086, 0x011B, 0x00B8, -0x010D, 0x0126, 0x008A,
    0x00FA, 0x0112, -0x0045, 0x0057, -0x009C, 0x0087, 0x002F, -0x00DE,
    -0x0075, 0x00B9, 0x0069, -0x011F, 0x0085, 0x0005, 0x00D2, -0x0076,
    0x00F3, -0x009C, -0x001E, -0x0009, -0x00C3, 0x004B, 0x0039, -0x00F5,
    0x0007, -0x011A, 0x00BD, 0x00C6, 0x0068, 0x0118, -0x00B3, 0x00E3,
    -0x0116, 0x00FE, 0x0030, 0x00C4, 0x007C, -0x011E, -0x00AF, 0x00AC,
    -0x003D, -0x00C7, -0x0010, -0x00FB, 0x0051, -0x012A, -0x00DD, -0x00C5,
    0x004A, -0x0077, 0x0022, -0x00E1, -0x0009, -0x0090, 0x0002, -0x006F,
    -0x00AD, -0x00D0, 0x00F6, 0x0087, 0x00F6, 0x0102, -0x00BB, -0x0041,
    0x00AA, -0x00D4, 0x002F, 0x000C, -0x0020, 0x00CF, 0x0112, 0x007A,
    0x0106, 0x00BB, 0x0092, 0x00CA, -0x0118, 0x0074, -0x008C, -0x00E4,
    -0x0054, 0x002D, -0x00C4, 0x00A5, 0x0087, -0x003D, -0x0059, 0x00C0,
    -0x00A1, 0x00AF, 0x00EA, 0x0027, 0x007C, 0x00B4, 0x000C, -0x00A5,
    0x00C0, -0x012C, -0x00E5, -0x00D2, 0x001A, 0x0013, 0x0079, -0x0092,
    -0x005E, -0x000B, -0x001A, -0x011A, 0x0067, -0x00B1, -0x0088, 0x009B,
    -0x00D3, -0x0126, -0x0068, -0x005F, -0x00D6, 0x00A3, -0x00E3, -0x008F,
    -0x0129, 0x00EF, 0x0053, -0x00AA, 0x004E, -0x00A9, 0x0104, 0x00EB,
    0x00AC, -0x008A, 0x0099, -0x0057, 0x0069, -0x0021, 0x009F, 0x0052,
    -0x006C, 0x0036, 0x0058, 0x00EC, -0x00C8, -0x0029
    };

    /* ======================================================================== */
    /* Filter coefficients */
    /* ======================================================================== */
    short h [NH*2] =
    {
    -500, -1000, 10, 500, 1024, 3276, -50, 5694,
    8666, 13999, 6000, -345, 6744, 10000, 12444, 14692,
    14692, 12444, 10000, 6744, -345, 30000, 13999, 8666,
    5694, -50, 3276, 1024, 500, 10, -1000, -500,
    -500, -1000, 10, 500, 1024, 3276, -50, 5694,
    8666, 13999, 6000, -345, 6744, 10000, 12444, 14692,
    14692, 12444, 10000, 6744, -345, 30000, 13999, 8666,
    5694, -50, 3276, 1024, 500, 10, -1000, -500
    };

    /* ======================================================================== */
    /* Output array */
    /* ======================================================================== */
    short r [NR*2];


    /* ======================================================================== */
    /* MAIN -- Top level driver for the test. */
    /* ======================================================================== */
    void main()
    {

    // PRD_fir_cplx() is the PRD function 

    }


    void DSP_fir_cplx(short *x, short *h, short *r,short nh, short nr)
    {
    short i,j;
    int imag, real;
    for (i = 0; i < 2*nr; i += 2){
    imag = 0;
    real = 0;
    for (j = 0; j < 2*nh; j += 2){
    real += h[j] * x[i-j] - h[j+1] * x[i+1-j];
    imag += h[j] * x[i+1-j] + h[j+1] * x[i-j];
    }
    r[i] = (real >> 15);
    r[i+1] = (imag >> 15);
    }
    }

    void PRD_fir_cplx()
    {
    STS_set(&STSt,CLK_gethtime());
    DSP_fir_cplx(x, h, r, NH, NR);
    STS_delta(&STSt,CLK_gethtime());
    }

    /* ======================================================================== */
    /* End of file: temp */
    /* ------------------------------------------------------------------------ */
    /* Copyright (C) 2005 Texas Instruments, Incorporated. */
    /* All Rights Reserved. */
    /* ======================================================================== */

  • Ruikai Jiang,

    a. You are not using the DSPLIB function. You are using C code as shown in your code listing above. What are the compiler switch settings that show up in the build process, for both devices? They should be slightly different since they are different DSP cores.

    b. Read the DSP/BIOS API Reference Guide to learn the meaning of the CLK_gethtime() function for the different DSPs in the C6000 family.

    c. Also read about (and use) the companion function to determine the ratio between CLK_gethtime() and milliseconds.

    d. To get a real-life measurement of the time it takes to run the PRD_fir_cplx() function, please do the following:

    1. Change the PRD function to repeat the fir function call 1,000,000 times as shown below (if you are using the simulator, this will not work well because you will be benchmarking the simulator and not the DSP, so this needs to be done on hardware)
    2. Set a breakpoint on both of the STS function calls in the PRD_fir_cplx function
    3. Run the program to the first breakpoint
    4. Start a stopwatch or make a note of the time on a wall clock or watch with a seconds hand
    5. Run to the second breakpoint
    6. Stop the stopwatch or make a note of the new time on a wall clock or watch with a seconds hand
    7. Report the elapsed time for the two program executions.
    8. Compare those elapsed time measurements to the ratios you get with the gethtime, DSP clock speed, and counts-per-millisecond values.

    Elapsed time said:

    void PRD_fir_cplx()
    {
     int i;
     STS_set(&STSt,CLK_gethtime());
     for ( i = 0; i < 1000000; i++ )
      DSP_fir_cplx(x, h, r, NH, NR);
     STS_delta(&STSt,CLK_gethtime());
    }

     

    e. Do not use short datatype variables in your for-loops. Change short i,j to int i,j.

    f. Search the E2E forum and TI Wiki Pages for help with optimization.

    g. Use the actual DSPLIB function from the library instead of your C code implementation. It is optimized for your processor. Be sure to use the DSPLIB for the C64x for the DM642 and for the C64x+ for the C6455.

    Please report all of your results and findings for these lettered items. It will be interesting to see the differences.

    Regards,
    RandyP

  • As ‘TMS320C64x+ DSP Little-Endian DSP Library Programmer’s Reference ( sprueb8b.pdf)'  section 4.4 said, 

    void DSP_fir_cplx(), This is the natural C equivalent of the optimized intrinsic C code without restrictions. Note that the intrinsic C code is optimized and restrictions may apply.

    1. So I think the natural C is equivalent of  the actual DSPLIB.
    2. The Build Options of DM642 and C6455 are both Level -o3.
    3. I think the unit of STS result is cycles.
    4. I also download 'C64x+ TI Benchmark Routines'  http://www.ti.com.cn/cn/lit/sw/sprc135/sprc135.zip ,  as in README show 

                               fir_cplx

                              CYCLES   =  nh * nr / 2 + 16 

                              For nh = 32 and nr = 256, cycles = 4112 

                              CODESIZE  =  448 bytes

                     It is  the actual lib 'TIBenchmarkRoutines64plus.lib'.  I run it in hardware,  but the result is 26000 cycles.

  • Ruikai Jiang,

    what about or L1P or L1D chache in your project? It seems that you missed to enable caches in L1 so you get slow access to L2. By the way, L2 is quite a slow memory for CPU, its speed is closer to external SDRAM, not L1. You should either use L1 cache or DMA to L1. the most easy way to check speed is to call memcpy with different pointer combinations, L1 to L1, L2 to L1, L2 to L2, L1 to L2, etc... You will see the difference of memory performance which has much more impact on overall performance then software pipelining.

    Best regards, Vladimir.

  • Ruikai Jiang,

    Please go to the Wiki and search for "c6000 sys/bios workshop" (no quotes) to find the latest training material on the C6000 device family. You can download the Student Guide in pdf format and you can download the labs and even the solutions to the labs. It will help you to go through all of the workshop material, but please pay special attention to Chapter 10 on C Optimizations. The lab at the end of the chapter will teach you about many of the things I tried to lead you toward in my previous post. It will improve your understanding of C vs. DSPLIB, build options, and benchmarking. After learning from this workshop, you will be able to improve your performance numbers.

    I will try to guide you toward the answers for the rest of the issues you are having.

    Ruikai Jiang said:

           1.  So I think the natural C is equivalent of  the actual DSPLIB.

    The natural C version generates the equivalent result values as the actual DSPLIB library routine. It is provided so you can see what the algorithm is that is running in the DSPLIB version.

    Do you expect the same functional result values from natural C, intrinsic C, and optimized assembly? Yes.

    Do you expect the same performance timing from natural C, intrinsic C, and optimized assembly? No.

    Ruikai Jiang said:

           2.  The Build Options of DM642 and C6455 are both Level -o3.

    The compiler uses many more switches that just -o3. If you are using the exact same switches for both, then you are not building for the C6455. Please see section 2.3.4 of the C Compiler User's Guide for device-specific information.

    What are you using for -mv or --silicon_version for the two builds?

    Ruikai Jiang said:

           3.  I think the unit of STS result is cycles.

    STS stores a number in a list. That number is the result of the function supplied to the STS function. In your case, this number comes from the CLK_gethtime() function.

    As I said in my previous post, please read the DSP/BIOS API Reference Guide to learn the meaning of the CLK_gethtime() function for the different DSPs in the C6000 family.  Also read about (and use) the companion function CLK_countspms() to determine the ratio between CLK_gethtime() and milliseconds.

    Do you have the DSP/BIOS API Reference Guide available to you? You can find this information in section 2.5 where the CLK module is discussed.

    Your statement #3 will take benefit from this section, particularly the section that discusses the High-Resolution Time.

    Ruikai Jiang said:

           4.  I also download 'C64x+ TI Benchmark Routines'  http://www.ti.com.cn/cn/lit/sw/sprc135/sprc135.zip ,  as in README show

                               fir_cplx

                              CYCLES   =  nh * nr / 2 + 16

                              For nh = 32 and nr = 256, cycles = 4112
                              CODESIZE  =  448 bytes

                     It is  the actual lib 'TIBenchmarkRoutines64plus.lib'.  I run it in hardware,  but the result is 26000 cycles.

    Please see my comments to your #1, above.

    Since you are running hardware, please take the time to run the tests I described (and offered a code snippet) in my previous post for my item (d). I believe this will offer an alternative to your previous measurements.

    My questions and comments are offered to help you with your problems. You may choose to answer some or all of my questions fully and you may choose to follow some or all of my recommendations. If you have answers to any of these questions, or new observations from any of these recommendations, I will gladly follow-up with you. If we work together, we will come to a resolution.

    If someone else is better able to help you, I will stand aside for your benefit.

    Regards,
    RandyP