Intel® High Level Synthesis Compiler Pro Edition: Reference Manual

ID 683349
Date 9/23/2022
Public

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

Document Table of Contents

6.5. Loop Concurrency (max_concurrency Pragma)

You can use the max_concurrency pragma to increase or limit the concurrency of a loop in your component. The concurrency of a loop is how many iterations of that loop can be in progress at one time. By default, the Intel® HLS Compiler tries to maximize the concurrency of loops so that your component runs at peak throughput.

To achieve maximum concurrency in loops, sometimes private copies of component memory have to be created to break dependencies on the underlying hardware that prevent the loop from being fully pipelined.

You can see the number of private copies created for you component memories in the High-Level Design reports (report.html) for your component:
  • In the Details pane of the Loop Analysis report as a message that says that the maximum number of simultaneous executions has been limited to N.
  • In the Bank view of your component memory in the Function Memory Viewer, which graphically shows the number of private copies.
Creating private copies of component memory in this case is not the same as replicating memory in order to increase the number of ports.
If you want to exchange some performance for component memory savings, apply #pragma max_concurrency <N> to the loop. When you apply this pragma, the number of private copies changes and controls the number of iterations entering the loop, as shown in the following example:
#pragma max_concurrency 1
​for (int i = 0; i < N; i++) {
  int arr[M];
  // Doing work on arr
}
You can control the number of private copies created for a component memory accessed withing a loop by using the hls_private_copies memory attribute. For details, see hls_private_copies Memory Attribute. For an example of increasing the number of private copies of memory, refer to the following tutorial:
<quartus_installdir>/hls/examples/tutorials/component_memories/non_power_of_two_memory
You can also control the concurrency of your component by using the hls_max_concurrency component attribute. For more information about the hls_max_concurrency(N) component attribute, see Concurrency Control (hls_max_concurrency Attribute). For an example increasing concurrency for better throughput, refer to the following tutorial:
<quartus_installdir>/hls/examples/tutorials/best_practices/optimize_ii_using_hls_register