NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Compiler/diagnostic messages/C6000

From Texas Instruments Wiki
Jump to: navigation, search

Note : Following Advice Feature is only available in C6x Compiler Version 7.4 and later.

C6000 Performance Advice[edit]

The C6000 optimizing compiler can generate highly optimized DSP code from the C code. The compiler, in some cases, can do better optimization if the user aids the compiler by providing additional information in the code. The TMS320C6000 Programmers Guide (SPRU198) documents the techniques for optimizing the C code for C6000 DSP. With the 7.4 Release of the C6x Compiler [Beta Product available Feb 2012], the Compiler now emits Performance Advice which can help programmers achieve maximal performance from their code. This Performance Advice alerts the user to 3 different types of situations :

  • Advice to use correct compiler options
  • Advice to prevent software pipelining disqualification
  • Advice to improve loop performance


Requesting Performance Advice[edit]

To get Performance Advice from the compiler, invoke it with the "--advice:performance" option.

cl6x [--advice:performance] [filenames] [-z [link_options] object files]]

By default the compiler will write "Advice" for "filename.c" to a new file named "filename.advice", created in the same directory. Each compiled file will have its advice generated in a separate advice file. So, compiling files a.c and b.c will create 2 Advice files : a.advice and b.advice.

The .advice file is not created if no advice is generated. Rather the compiler prints a message to stdout :

"filename.c": advice #27004: No Performance Advice is generated.


Examples[edit]

Consider a source file "func.c"

<syntaxhighlight lang='c'> extern void calculate(int i); void init(int *);

void func(int *acl, int *inp1, int *inp2, int M) {

   int i;
   for (i = 0; i < M; i++)
   {
       init(inp1);
       acl[i] = inp1[i] + inp2[i];
       calculate(acl[i]);
   }

}

void init(int *p) {

. . .
. . . .

} </syntaxhighlight>


Example 1 : Output advice to a (default) file <filename>.advice[edit]

cl6x -mv6400 --advice:performance func.c

This outputs advice to new file called func.advice

<syntaxhighlight lang='c'>

  • TMS320C6x C/C++ Codegen Unix v7.5.0P12047 (a0322878 - Feb 16 2012) *
  • Date/Time created: Thu Feb 16 10:26:02 2012 *
  • *
  • *
  • This file contains Performance Advice generated by the compiler under the *
  • --advice:performance option. Additional information on the specific piece *
  • of advice can be found at: *
  • *
  • http://processors.wiki.ti.com/index.php/Compiler/diagnostic_messages/C6000 *
  • *
  • or by searching for `Advice #<advice_id>`. *
  • *
  • Warning: This file is auto generated by the compiler and can be *
  • overwritten during the next compile. *
  • *
User Options
  • --silicon_version=6400

"func.c": advice #27000: Detecting compilation without optimization. Use

  optimization option -o2 or higher.

</syntaxhighlight>

Example 2 : Output advice to stdout/stderr by specifying this as an argument to --advice:performance[edit]

cl6x -mv6400 -o2 -k --advice:performance=stdout func.c

The following Advice is output to the screen.

"func.c", line 10: advice #30006: Loop at line 8 cannot be scheduled efficiently
   as it contains a function call ("_init"). Try making "_init" an inline
   function.
"func.c", line 12: advice #30000: Loop at line 8 cannot be scheduled efficiently
   as it contains a function call ("_calculate"). Try to inline call or
   consider rewriting loop.

Note that Advice to prevent Software Pipeline Disqualification (such as that presented above) will also be printed in the .asm file. So, func.asm contains :

<syntaxhighlight lang='c'>

  • ----------------------------------------------------------------------------*
  • SOFTWARE PIPELINE INFORMATION
  • Disqualified loop: Loop contains a call
  • Loop at line 8 cannot be scheduled efficiently as it contains a
  • function call ("_init"). Try making "_init" an inline function.
  • Disqualified loop: Loop contains non-pipelinable instructions
  • Disqualified loop: Loop contains a call
  • Loop at line 8 cannot be scheduled efficiently as it contains a
  • function call ("_calculate"). Try to inline call or consider
  • rewriting loop.
  • Disqualified loop: Loop contains non-pipelinable instructions
  • ----------------------------------------------------------------------------*</syntaxhighlight>


Example 3 : Output advice to a specific file "myfile.adv"[edit]

cl6x -mv6400 -o2 --advice:performance=myfile.adv func.c

This outputs advice to new file called "myfile.adv". Note that this can be used to combine Advice from many files in a compilation, into a single file, like so :

cl6x -mv6400 --advice:performance=common.adv first.c second.c third.c

This creates one Advice File "common.txt" instead of creating first.advice, second.advice and third.advice.


Example 4 : Output advice to a specific file "myfile.adv" in directory "mydir"[edit]

This can be done in 2 ways. First, by using the --advice_dir option :

cl6x -mv6400 --advice:performance=myfile.adv --advice_dir=mydir basicloop.c

Second, by specifying the full path name to the --advice:performance option :

cl6x -mv6400 --advice:performance=mydir/myfile.adv basicloop.c

If --advice_dir option and full pathname are specified together, --advice_dir option is ignored, and the advice is generated in the full pathname advice file.

Also, note that directory "mydir" must already exist for an advice file to be created in there.


Types of Advice[edit]

Below are the types of Performance Advice emitted :

Subpages[edit]

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Compiler/diagnostic messages/C6000 here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Compiler/diagnostic messages/C6000 here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Compiler/diagnostic messages/C6000 here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Compiler/diagnostic messages/C6000 here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Compiler/diagnostic messages/C6000 here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Compiler/diagnostic messages/C6000 here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Compiler/diagnostic messages/C6000 here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Compiler/diagnostic messages/C6000 here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Compiler/diagnostic messages/C6000 here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity