-qcache

Description

The -qcache option specifies the cache configuration for a specific execution machine. If you know the type of execution system for a program, and that system has its instruction or data cache configured differently from the default case, use this option to specify the exact cache characteristics.  The compiler uses this information to calculate the benefits of cache-related optimizations.

Syntax

Read syntax diagramSkip visual syntax diagram                  .-:---------------------.
                  V                       |
>>- -q--cache--=----+-assoc--=--+-0---+-+-+--------------------><
                    |           +-1---+ |
                    |           '-n>1-' |
                    +-auto--------------+
                    +-cost--=--cycles---+
                    +-level--=--+-1-+---+
                    |           +-2-+   |
                    |           '-3-'   |
                    +-line--=--bytes----+
                    +-size--=--Kbytes---+
                    '-type--=--+-C-+----'
                               +-c-+
                               +-D-+
                               +-d-+
                               +-I-+
                               '-i-'

where available cache options are:

assoc=number Specifies the set associativity of the cache, where number is one of:
0
Direct-mapped cache
1
Fully associative cache
N>1
n-way set associative cache
auto Automatically detects the specific cache configuration of the compiling machine. This assumes that the execution environment will be the same as the compilation environment.
cost=cycles Specifies the performance penalty resulting from a cache miss.
level=level Specifies the level of cache affected, where level is one of:
1
Basic cache
2
Level-2 cache or, if there is no level-2 cache, the table lookaside buffer (TLB)
3
TLB
If a machine has more than one level of cache, use a separate -qcache option.
line=bytes Specifies the line size of the cache.
size=Kbytes Specifies the total size of the cache.
type=cache_type The settings apply to the specified type of cache, where cache_type is one of:
C or c
Combined data and instruction cache
D or d
Data cache
I or i
Instruction cache

Notes

The -qtune setting determines the optimal default -qcache settings for most typical compilations. You can use the -qcache to override these default settings. However, if you specify the wrong values for the cache configuration, or run the program on a machine with a different configuration, the program will work correctly but may be slightly slower.

You must specify -O4, -O5, or -qipa with the -qcache option.

Use the following guidelines when specifying -qcache suboptions:

Example

To tune performance for a system with a combined instruction and data level-1 cache, where cache is 2-way associative, 8 KB in size and has 64-byte cache lines, enter:

xlc++ -O4 -qcache=type=c:level=1:size=8:line=64:assoc=2 file.C

Related information