Invites the compiler to issue or disable requests to prefetch data from memory. This pragma applies only to Intel® Advanced Vector Extensions 512 (Intel® AVX-512).
#pragma prefetch #pragma prefetch *:hint[:distance] #pragma prefetch [var1 [: hint1 [: distance1]] [, var2 [: hint2 [: distance2]]]...] #pragma noprefetch [var1 [, var2]...] |
var |
An optional memory reference (data to be prefetched) |
hint |
An optional hint to the compiler to specify the type of prefetch. Possible values:
To use this argument, you must also specify var. |
distance |
An optional integer argument with a value greater than 0. It indicates the number of loop iterations ahead of which a prefetch is issued, before the corresponding load or store instruction. To use this argument, you must also specify var and hint. |
The prefetch pragma hints to the compiler to generate data prefetches for some memory references. These hints affect the heuristics used in the compiler. Prefetching data can minimize the effects of memory latency.
If you specify the prefetch pragma with no arguments, all arrays accessed in the immediately following loop are prefetched.
If the loop includes the expression A(j), placing #pragma prefetch A in front of the loop instructs the compiler to insert prefetches for A(j + d) within the loop. Here, d is the number of iterations ahead of which to prefetch the data, and is determined by the compiler.
If you specify #pragma prefetch *, then hint and distance prefetches all array accesses in the loop.
To use these pragmas, the compiler general optimization level must be set at option O2 or higher.
The noprefetch pragma hints to the compiler not to generate data prefetches for some memory references. This affects the heuristics used in the compiler.
The prefetch and noprefetch pragmas are supported in host code only.
Example: Using the prefetch pragma |
---|
|
Example: Using noprefetch and prefetch pragmas together |
---|
|
Example: Using noprefetch and prefetch pragmas together |
---|
|