loop_info

Date:

02-09-2023

NAME

loop_info - allow additional loop information to be specified about the behavior of a loop

SYNOPSIS

C

#pragma _CRI loop_info [min_trips(c)] [est_trips(c)] [max_trips(c)][cache( symbol[,symbol ...] )][cache_nt(symbol[,symbol ...] ) ][prefetch] [noprefetch][prefer_thread] [prefer_nothread]

Fortran

!DIR$ LOOP_INFO [min_trips(c)] [est_trips(c)] [max_trips(c)][cache( symbol[,symbol ...] )][cache_nt(symbol[,symbol ...] ) ][prefetch] [noprefetch][prefer_thread] [prefer_nothread]

IMPLEMENTATION

The loop_info directive allows additional information to be specified about the behavior of a loop, including run-time trip count and hints on cache allocation strategy. The directive provides information to the optimizer and can produce faster code sequences.

loop_info is used immediately before a for loop to indicate minimum, maximum, or estimated trip count. The compiler will diagnose misuse at compile time (when able) or when option -h dir_check is specified at run time.

For cache allocation hints, the loop_info directive can be used to override default settings, cache or cache_nt directives, or override automatic cache management decisions. The cache hints are local and apply only to the specified loop nest.

c An expression that evaluates to an integer constant at compilation time.

min_trips Specifies guaranteed minimum number of trips.

est_trips Specifies estimated or average number of trips.

max_trips Specifies guaranteed maximum number of trips.

cache Specifies symbol is to be allocated in cache; this is the default if no hint is specified and the cache_nt directive is not specified.

cache_nt Specifies symbol is to use non-temporal reads and writes.

prefetch Specifies a preference that prefetches be performed for the following loop.

noprefetch Specifies a preference that no prefetches be performed for the following loop.

prefer_thread The PREFER_THREAD and PREFER_NOTHREAD directives are special cases of the LOOP_INFO advisory directive. Use these directives to indicate a preference for turning threading on or off for the subsequent loop. Use the LOOP_INFO PREFER_THREAD directive to indicate your preference that the loop following the directive be threaded.

prefer_nothread Use the LOOP_INFO PREFER_NOTHREAD directive to indicate that the loop should not be threaded.

symbol The base name of the object that should not be placed into the cache. This can be the base name of any object (such as an array, scalar structure) without member references like C[10]. If you specify a pointer in the list, only the references, not the pointer itself, have the no cache allocate property.

EXAMPLES

Example 1: Trip counts

The following example in C/C++, the minimum trip count is 1 and the maximum trip count is 1000:

C

void loop_info( double *restrict a, double *restrict b, double s1, int n ) {

int i;

#pragma _CRI loop_info min_trips(1) max_trips(1000), cache_nt(b)
for (i = 0; i< n; i++) {
if(a[i] != 0.0) {

a[i] = a[i] + b[i]*s1;

}

}

}