Sun Studio 12 Update 1: C++ User's Guide

A.2.167.1 Defaults

The default is -xprefetch=auto,explicit. This default adversely affects applications that have essentially non-linear memory access patterns. Specify -xprefetch=no%auto,no%explicit to override the default.

The default of auto is assumed unless explicitly overridden with an argument of no%auto or an argument of no. For example, -xprefetch=explicit is the same as -xprefetch=explicit,auto.

The default of explicit is assumed unless explicitly overridden with an argument of no%explicit or an argument of no. For example, -xprefetch=auto is the same as -xprefetch=auto,explicit.

If only -xprefetch is specified, -xprefetch=auto,explicit is assumed.

If automatic prefetching is enabled, but a latency factor is not specified, then -xprefetch=latx:1.0 is assumed.

Interactions

This option accumulates instead of overrides.

The sun_prefetch.h header file provides the macros for specifying explicit prefetch instructions. The prefetches will be approximately at the place in the executable that corresponds to where the macros appear.

To use the explicit prefetch instructions, you must be on the correct architecture, include sun_prefetch.h, and either exclude -xprefetch from the compiler command or use -xprefetch, -xprefetch=auto,explicit or -xprefetch=explicit.

If you call the macros and include the sun_prefetch.h header file, but specify -xprefetch=no%explicit, the explicit prefetches will not appear in your executable.

The use of latx:factor is valid only when automatic prefetching is enabled. That is, latx:factor is ignored unless you use it in conjunction with -xprefetch=auto,latx:factor.

Warnings

Explicit prefetching should only be used under special circumstances that are supported by measurements.

Because the compiler tunes the prefetch mechanism for optimal performance across a wide range of machines and applications, you should only use -xprefetch=latx:factor when the performance tests indicate there is a clear benefit. The assumed prefetch latencies may change from release to release. Therefore, retesting the effect of the latency factor on performance whenever switching to a different release is highly recommended.