インテル® Fortran コンパイラー XE 13.1 ユーザー・リファレンス・ガイド
General Compiler Directives: PREFETCH hints to the compiler to prefetch data into closer levels of cache. Prefetching data can minimize the effects of memory latency. NOPREFETCH disables data prefetching. These directives give fine-level control to the programmer to influence the prefetches generated by the compiler. These directives are only available on Intel® MIC Architecture.
cDEC$ PREFETCH [var1[: hint1[: distance1]] [,var2[: hint2[: distance2]]]...]
cDEC$ NOPREFETCH [var1[,var2]...]
c |
Is one of the following: C (or c), !, or *. (See Syntax Rules for Compiler Directives.) |
var |
Is an optional memory reference. |
hint |
Is an optional integer initialization expression with the value 0 or 1. These are the same as the defined values FOR_K_PREFETCH_T0 and FOR_K_PREFETCH_T1 for hint in the intrinsic subroutine MM_PREFETCH. To use this argument, you must also specify var. |
distance |
Is an optional integer initialization expression with a value greater than 0. It indicates the number of (possibly vectorized) 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. |
To use these directives, compiler option opt-prefetch must be set. Note that this option is turned on by default if the compiler general optimization level is O2 or higher.
This directive affects the DO loop it precedes.
If you specify NOPREFETCH with no arguments, all arrays accessed in the DO loop will NOT be prefetched.
If a loop includes expression A(j), placing cDEC$ PREFETCH A:0:d in front of the loop instructs the compiler to insert a vprefetch0 instruction for A within the loop that is d iterations ahead.
! Issue no prefetches for a1
! Issue vector prefetch from L2 and higher caches for b with a distance of 16 vectorized iterations ahead
! Issue vector prefetch from L1 and higher caches for b with a distance of 4 vectorized iterations ahead
!dir$ noprefetch a1
!dir$ prefetch b:1:16
!dir$ prefetch b:0:4
do i = 1,N
a1(i) = b(i-1) + b(i+1)
enddo