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.

Default auto inline threshold with -o3

Hi,

What is the default auto-inline threshold(--auto_inline=size) when -O3 is enabled? In the document "TMS320C6000 Optimizing Compiler v7.4"  it's just mentioned as "Inlines calls to small functions" . But what exactly is the number of bytes for which the compiler inlines any function?

Also, what is the general recommendation for auto-inline threshold if I choose to override default value in -O3 for better performance. I am fine with increased code size.

I am using cg tools version 7.4.1 to compile for C66x architecture.

Regards,

Vijay

  • vijay kumar98736 said:

    What is the default auto-inline threshold(--auto_inline=size) when -O3 is enabled?

    Approximately 20.

    vijay kumar98736 said:

    But what exactly is the number of bytes for which the compiler inlines any function?

    It isn't bytes, it's units of the internal representation.  If you use the option --gen_opt_info=2, there will be produced a .nfo file that, among other things, indicates the sizes in units of your functions.

    vijay kumar98736 said:

    Also, what is the general recommendation for auto-inline threshold if I choose to override default value in -O3 for better performance.

    There isn't any single recommended value.  Anywhere from 20 to 1000 is common, but you could go larger.

    Note that setting this option will not simply inline every function that fits under the limit.  The compiler limits inlining to avoid making the calling function too large and to avoid increasing the overall size of the program too much.  (The latter factor can be controlled somewhat with the -mf or --opt_for_speed option. The default for C6x is -mf4, which allows a fair bit of growth;  -mf5 allows a little more.)  The compiler will also favor functions that are called at only one site.

    If you want to force a function to inline, you can use the "inline" keyword which will cause the function to be inlined wherever it is able, within limits, uncontrolled by --auto_inline.  If you want to ignore the limits, you can use the FUNC_ALWAYS_INLINE pragma to insist that all calls to a function be inlined, even if it crashes the compiler.

  • Thanks for the response. I can try with FUNC_ALWAYS_INLINE pragma than increasing auto-inline threshold.


    Regards,

    Vijay