Higher optimization levels can have a tremendous impact
on performance, but some trade-offs can occur in terms of code size,
compile time, resource requirements, and numeric or algorithmic precision.
After applying
Basic optimization and
successfully compiling and executing your application, you can apply
more powerful optimization tools. The XL compiler optimization portfolio
includes many options for directing advanced optimization, and the
transformations your application undergoes are largely under your
control. The discussion of each optimization level in
Table 1 includes
information on not only the performance benefits, and the possible
trade-offs as well, but information on how you can help guide the
optimizer to find the best solutions for your application.
Table 1. Advanced optimizationsOptimization Level |
Additional options implied |
Complementary options |
Options with possible benefits |
-O3 |
- -qnostrict
- -qmaxmem=-1
- -qhot=level=0
|
|
|
-O4 |
- -qnostrict
- -qmaxmem=-1
- -qhot
- -qipa
- -qarch=auto
- -qtune=auto
- -qcache=auto
|
|
|
-O5 |
|
|
|
When you compile programs with any of the following
sets of options:
the compiler automatically attempts to vectorize calls to system
math functions by calling the equivalent vector functions in the Mathematical
Acceleration Subsystem libraries (MASS), with the exceptions of functions
vdnint,
vdint,
vcosisin,
vscosisin,
vqdrt,
vsqdrt,
vrqdrt,
vsrqdrt,
vpopcnt4,
and
vpopcnt8. If the compiler cannot vectorize, it
automatically tries to call the equivalent MASS scalar functions.
For automatic vectorization or scalarization, the compiler uses versions
of the MASS functions contained in the system library
libxlopt.a.
In addition to any of the preceding sets of options,
when the -qipa option is in effect,
if the compiler cannot vectorize, it tries to inline the MASS scalar
functions before deciding to call them.