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
Note : Following Advice Feature is only available in C6x Compiler Version 7.4 and later.
Contents
- 1 C6000 Performance Advice
- 2 Requesting Performance Advice
- 3 Examples
- 3.1 Example 1 : Output advice to a (default) file <filename>.advice
- 3.2 Example 2 : Output advice to stdout/stderr by specifying this as an argument to --advice:performance
- 3.3 Example 3 : Output advice to a specific file "myfile.adv"
- 3.4 Example 4 : Output advice to a specific file "myfile.adv" in directory "mydir"
- 4 Types of Advice
- 5 Subpages
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 :
- Advice #27000: Use Optimization Options
- Advice #27001: Increase Optimization Level
- Advice #27002: Do not turn off software pipelining
- Advice #27003: Avoid compiling with debug options
- Advice #27004: No Performance Advice generated
- Advice #30000: Prevent Loop Disqualification due to call
- Advice #30001: Prevent Loop Disqualification due to rts-call
- Advice #30002: Prevent Loop Disqualification due to asm statement
- Advice #30003: Prevent Loop Disqualification due to complex condition
- Advice #30004: Prevent Loop Disqualification due to switch statement
- Advice #30005: Prevent Loop Disqualification due to arithmetic operation
- Advice #30006: Prevent Loop Disqualification due to call(2)
- Advice #30007: Prevent Loop Disqualification due to rts-call(2)
- Advice #30008: Improve Loop; Qualify with restrict
- Advice #30009: Improve Loop; Add MUST_ITERATE pragma
- Advice #30010: Improve Loop; Add MUST_ITERATE pragma(2)
- Advice #30011: Improve Loop; Add _nassert()
Subpages[edit]
- Compiler/diagnostic messages/C6000
- Compiler/diagnostic messages/C6000/27000
- Compiler/diagnostic messages/C6000/27001
- Compiler/diagnostic messages/C6000/27002
- Compiler/diagnostic messages/C6000/27003
- Compiler/diagnostic messages/C6000/27004
- Compiler/diagnostic messages/C6000/30000
- Compiler/diagnostic messages/C6000/30001
- Compiler/diagnostic messages/C6000/30002
- Compiler/diagnostic messages/C6000/30003
- Compiler/diagnostic messages/C6000/30004
- Compiler/diagnostic messages/C6000/30005
- Compiler/diagnostic messages/C6000/30006
- Compiler/diagnostic messages/C6000/30007
- Compiler/diagnostic messages/C6000/30008
- Compiler/diagnostic messages/C6000/30009
- Compiler/diagnostic messages/C6000/30010
- Compiler/diagnostic messages/C6000/30011