Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 11/07/2023
Public

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

Document Table of Contents

ompx prefetch data

Issues a prefetch to pre-load the data in the array sections specified.

Syntax

#pragma ompx prefetch data( [prefetch-hint-modifier:] arrsect [, arrsect] ) [if (condition)]

Arguments

arrsect

A contiguous array section, where contiguous means stride is either not specified, or is constant 1, as defined in OpenMP 5.1.

prefetch-hint-modifier

An optional, implementation defined, positive constant literal integer between 0 and 7, inclusive. When not specified, it is assumed to be 0. Possible values:

  • 0: No operation
  • 1 : Perform L1 uncached and L3 uncached memory load

  • 2 : Perform L1 uncached and L3 cached memory load

  • 3 : Perform L1 cached and L3 uncached memory load

  • 4 : Perform L1 cached and L3 cached memory load

  • 5 : Perform L1 streaming load and L3 uncached memory load

  • 6 : Perform L1 streaming load and L3 cached load

  • 7 : Perform L1 and L3 cached memory load, and invalidate L1 cache

if

An optional condition for the prefetch. The same as the existing if clause for the parallel construct specified in OpenMP 5.1.

Description

The ompx prefetch data pragma issues a prefetch to pre-load the data specified in the array sections. If the if clause is specified, then the prefetch is done only if condition is true.

The ompx prefetch data pragma is supported for Intel® Iris® Xe MAX GPU only.

Example

Use the ompx prefetch data pragma:

int   x[1024];
float y[1024];
float z[1024];
...
for (m = 0; m < 1024; m++) {
  // 4: Prefetch to L1 cache and L3 cache
  #pragma ompx prefetch data(4: y[m+16], z[m+16]) if(m%16==0 && (m+16) < 1024)
  x[m] = y[m] + z[m];
}
...