Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

MM_PREFETCH

Intrinsic Subroutine (Generic): Prefetches data from the specified address on one memory cache line. Intrinsic subroutines cannot be passed as actual arguments.

CALL MM_PREFETCH (address[,hint] [,fault] [,exclusive])

address

(Input) Is the name of a scalar or array; it can be of any type or rank. It specifies the address of the data on the cache line to prefetch.

hint

(Input; optional) Is an optional default integer constant with one of the following values:

Value

Prefetch Constant

Description

0

FOR_K_PREFETCH_T0

Prefetches into the L1 cache (and the L2 and the L3 cache). Use this for integer data.

1

FOR_K_PREFETCH_T1

Prefetches into the L2 cache (and the L3 cache); floating-point data is used from the L2 cache, not the L1 cache. Use this for real data.

2

FOR_K_PREFETCH_T2

Prefetches into the L2 cache (and the L3 cache); this line will be marked for early displacement. Use this if you are not going to reuse the cache line frequently.

3

FOR_K_PREFETCH_NTA

Prefetches into the L2 cache (but not the L3 cache); this line will be marked for early displacement. Use this if you are not going to reuse the cache line.

The preceding constants are defined in file fordef.for on Windows* systems and file fordef.f on Linux* systems.

If hint is omitted, 0 is assumed.

fault

(Input; optional) Is an optional default logical constant. If .TRUE. is specified, page faults are allowed to occur, if necessary; if .FALSE. is specified, page faults are not allowed to occur. If fault is omitted, .FALSE. is assumed. This argument is currently ignored.

exclusive

(Input; optional) Is an optional default logical constant. If.TRUE. is specified, you get exclusive ownership of the cache line because you intend to assign to it; if .FALSE. is specified, there is no exclusive ownership. If exclusive is omitted, .FALSE.is assumed. This argument is currently ignored.

Example

 subroutine spread_lf (a, b)
 PARAMETER (n = 1025)

 real*8 a(n,n), b(n,n), c(n)
 do j = 1,n
   do i = 1,100
     a(i, j) = b(i-1, j) + b(i+1, j)
     call mm_prefetch (a(i+20, j), 1)
     call mm_prefetch (b(i+21, j), 1)
   enddo
 enddo

 print *, a(2, 567)

 stop
 end