Intel® Fortran Compiler 17.0 Developer Guide and Reference

Developer Directed Inline Expansion of User Functions

In addition to the options that support compiler directed inline expansion of user functions, the compiler also provides compiler options and directives that allow you to more precisely direct when and if inline function expansion should occur.

The compiler measures the relative size of a routine in an abstract value of intermediate language units, which is approximately equivalent to the number of instructions that will be generated. The compiler uses the intermediate language unit estimates to classify routines and functions as relatively small, medium, or large functions. The compiler then uses the estimates to determine when to inline a function; if the minimum criteria for inlining is met and all other things are equal, the compiler has an affinity for inlining relatively small functions and not inlining relative large functions.

Typically, the compiler targets functions that have been marked for inlining based on the following:

The following developer directed inlining options and directives provide the ability to change the boundaries used by the inliner to distinguish between small and large functions.

In general, you should use the [Q]inline-factor option before using the individual inlining options listed below; this single option effectively controls several other upper-limit options.

If your code hits an inlining limit, the compiler issues a warning at the highest warning level. The warning specifies which of the inlining limits have been hit, and the compiler option and/or directives needed to get a full report. For example, you could get a message as follows:

Inlining inhibited by limit max-total-size.  Use -qopt-report -qopt-report-phase=ipo for full report.

Messages in the report refer directly to the command line options or directives that can be used to overcome the limits.

The following table lists the options you can use to fine-tune inline expansion of functions. The directives associated with the options are documented in the Effect column.

Option Effect

[Q]inline-factor

Controls the multiplier applied to all inlining options that define upper limits: inline-max-size, inline-max-total-size, inline-max-per-routine, and inline-max-per-compile. While you can specify an individual increase in any of the upper-limit options, this single option provides an efficient means of controlling all of the upper-limit options with a single command.

By default, this option uses a multiplier of 100, which corresponds to a factor of 1. Specifying 200 implies a factor of 2, and so on. Experiment with the multiplier carefully. You could increase the upper limits to allow too much inlining, which might result in your system running out of memory.

[Q]inline-forceinline

Instructs the compiler to force inlining of functions suggested for inlining whenever the compiler is capable doing so.

Without this option, the compiler treats functions declared with the ATTRIBUTES INLINE directive as merely being recommended for inlining. When this option is used, it is as if they were declared with the ATTRIBUTES FORCEINLINE directive.

[Q]inline-min-size

Redefines the maximum size of small routines; routines that are equal to or smaller than the value specified are more likely to be inlined.

[Q]inline-max-size

Redefines the minimum size of large routines; routines that are equal to or larger than the value specified are less likely to be inlined.

[Q]inline-max-total-size

Limits the expanded size of inlined functions.

You can also use !DIR$ ATTRIBUTES OPTIMIZATION_PARAMETER:"INLINE_MAX_TOTAL_SIZE=N” to control the size an individual routine can grow through inlining.

[Q]inline-max-per-routine

Limits the number of times inlining can be applied within a routine.

You can also use !DIR$ ATTRIBUTES OPTIMIZATION_PARAMETER:"INLINE_MAX_PER_ROUTINE=N” to control the number of times inlining may be applied to a routine.

[Q]inline-max-per-compile

Limits the number of times inlining can be applied within a compilation unit.

The compilation unit limit depends on the whether or not you specify the [Q]ipo compiler option. If you enable IPO, all source files that are part of the compilation are considered one compilation unit. For compilations not involving IPO each source file is considered an individual compilation unit.

See Also