Discussion on the optimization experience of TI DSP 6000 series

Source: Internet
Author: User
Tags manual key loop

first, to consider the optimization from the system structure, such as minimizing the unnecessary removal of data to be processed, considering your DSP chip memory reserves and each processing data volume of the system structure optimization, this part of the optimization should be done first;


Second , from the algorithm level, to see whether the algorithm has a better and simpler calculation method, the algorithm has some symmetry, can be used more suitable data structure, etc., this optimization is more obvious than the program optimization;


third, if the algorithm level temporarily no better optimization method to see whether the software structure optimization.


For example:
      1) multilayer loop structure can reduce the layer. I often see this program:
         for (i = 0; i++; i< A)
                for (j = 0, J + + j< B)
                {
    () nbsp                 E[I][J] = c[i][j]-d[i][j];
               }
          This can be optimized to:
         for (i = 0; i++; i<a*b)
&nbs P        {
                  e[i] = C[i]-d[i];
             }
        &NBSP;2) The conditions in the key loop structure, the jump instruction should be avoided, even if the number of cycles will be increased, no conditional instruction optimizer in the loop is easier to optimize;
      & nbsp &NBSP;3) key loops do not call child functions
          Others, see the Manual, the manual is very clear.

four, combining the DSP system hardware structure optimization

1) Look at the data you are dealing with on-chip or on-chip, if placed on the outside, this proposal will be divided into pieces of data on-chip processing, similar to the flow structure;

2) optimized for L2 cache for external data


v. Optimize with DSP optimizer, instruction system, etc.

This part can be detailed to see TI's Handbook, probably have these several methods: 1) Optimization options,-o3-pm cancel-G and so on these options, if your software structure is very good, then their optimization effect is obvious;
2) plus some optimization indicators to guide optimization, this part of the manual, including storage address independence, SIMD (single instruction multi-data processing) and so on;
3) with some special instructions, such as 6000 to provide saturation plus, overflow minus instructions, you can not use conditions to judge;
4) If the effect is not good, use linear assembly to rewrite your program, your optimization ideas in a linear assembly to express, generally to the point can be;
5) If the Linear assembly optimization does not show you the optimization idea, then assemble it, the optimizer will not help you optimize, it is entirely your own control program;
This part needs to have the more rich optimization experience and the solid optimization Foundation, accumulates many, sees the material more.
PS:
The optimization of the system structure needs to be considered in the scenario phase, primarily in terms of hardware and data flow.
Algorithm this thing is very important, do the best to optimize the algorithm has a general understanding of the line, and sometimes a change in the implementation of ideas will help you optimize a lot.
Even if you do not optimize the algorithm itself, it is also helpful to understand the algorithm to optimize your program.
I went from the Assembly to C, and then when I was optimizing for C, I found that understanding of the assembly instructions was very helpful in optimizing
If you're free, you can look at the assembly instructions, especially the 64-core DSP, many packaging instructions and SIMD instructions are very helpful for program-level optimization.
You don't have to write a compilation, write a linear assembly, you don't have to schedule parallelism, that's a lot more than a compilation.
I now do optimization is to try to do with C, and then look at the disassembly instructions, not satisfied with the linear assembly to write a, generally to this step is almost.
Also can see more Ti imglib optimization code, TI provides, more see you will have harvest.


The final point is to say:
          optimization is no end, in the program to careful optimization of each part of the program to test the time, to the very time-consuming part of the optimization, one but to meet your requirements can be, do not optimize for optimization, We should have more important things to learn, not to be trapped in the optimization and can't extricate themselves.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.