Developer Guide

Contents

speculated_iterations
Attribute

Use the
speculated_iterations
attribute to direct the
Intel® oneAPI
DPC++/C++
Compiler
to improve the performance of pipelined loops. The
speculated_iterations
attribute is applied to loops and hence, it must appear directly before the loop (the same place as other loop attributes). For more information, refer to Loop Speculation.
Syntax
[[intel::speculated_iterations(N)]]
Where, the integer argument
N
specifies the permissible number of iterations to speculate.
The
Intel® oneAPI
DPC++/C++
Compiler
generates hardware to run
N
extra iterations of the loop while ensuring the extra iterations do not affect anything. This allows either reducing the II of the loop or increasing the f
max
. The deciding factor is how quickly the exit condition of the loop is calculated. If the calculation takes many cycles, it is better to have larger
speculated_iterations
.
Extra iterations increase the time before the next invocation of the loop can begin. This may be a factor if the actual number of iterations of the loop is very small (less than 5 to 10 or similar). In this case, specify the
N
value as 0 to allow subsequent loop iterations to start immediately but at the cost of a larger II to allow more time to evaluate the exit condition. Refer to the Loop Analysis report to identify whether the exit condition is a bottleneck for II.
Example
[[intel::speculated_iterations(1)]] while (m*m*m < N) { m += 1; } dst[0] = m;
The loop in this example will have one speculated iteration.
For additional information, refer to the FPGA tutorial sample
speculated_iterations
listed in the Intel® oneAPI Samples Browser on Linux* or Intel® oneAPI Samples Browser on Windows*, or access the code sample in GitHub.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.