When running the AI Engine
compiler with a target of x86sim
the compiler
ignores the --Xchess
option. This means that the
x86sim
flow does not support kernel-specific
compile options.
To understand this better consider the following example. A common
method of making compile-time modifications to C code is using preprocessor
directives such as #ifndef
. To control these
preprocessor directives it is helpful to pass #defines
through the command line compiler options. The following
example code block takes two different actions based on a preprocessor
directive.
void example_kernel()
{
#ifdef SIM
printf("Simulation Mode\n");
#else
printf("Default Mode\n");
#endif
}
To define the SIM macro at compile time with the AI Engine compiler targeting hardware (hw
) you can do the following.
v++ -c --mode aie -target=hw -Xchess="example_kernel:-DSIM"
Because the -Xchess
argument is
ignored when the compilation target is set to x86sim
, SIM is not defined for the x86 simulator case and the output
of the kernel is Default Mode.
If you need to specify preprocessor options with the x86 simulator you can do
so using v++ -c --mode aie -target=x86sim
--Xpreproc
instead of -Xchess
. Any
options passed in this manner applies to all source code and all target flows.
Option | Description |
---|---|
--Xchess=<string>
|
Can be used to pass kernel specific options to the CHESS compiler that is used to compile code for each AI Engine. The option string is specified as<kernel-function>:<optionid>=<value> .
This option string is included during compilation of generated
source files on the AI Engine
where the specified kernel function is mapped. |
--Xpreproc=<string>
|
Pass general option to the
PREPROCESSOR phase for all source code compilations ( --Xpreproc=-D<var>=<value>
|