Visible to Intel only — GUID: qos1551547167191
Ixiasoft
1. Intel® HLS Compiler Pro Edition Best Practices Guide
2. Best Practices for Coding and Compiling Your Component
3. FPGA Concepts
4. Interface Best Practices
5. Loop Best Practices
6. fMAX Bottleneck Best Practices
7. Memory Architecture Best Practices
8. System of Tasks Best Practices
9. Datatype Best Practices
10. Advanced Troubleshooting
A. Intel® HLS Compiler Pro Edition Best Practices Guide Archives
B. Document Revision History for Intel® HLS Compiler Pro Edition Best Practices Guide
5.1. Reuse Hardware By Calling It In a Loop
5.2. Parallelize Loops
5.3. Construct Well-Formed Loops
5.4. Minimize Loop-Carried Dependencies
5.5. Avoid Complex Loop-Exit Conditions
5.6. Convert Nested Loops into a Single Loop
5.7. Place if-Statements in the Lowest Possible Scope in a Loop Nest
5.8. Declare Variables in the Deepest Scope Possible
5.9. Raise Loop II to Increase fMAX
5.10. Control Loop Interleaving
Visible to Intel only — GUID: qos1551547167191
Ixiasoft
8.1. Executing Multiple Loops in Parallel
By using HLS tasks, you can run sequential loops in a pipelined manner within the context of the loop nest.
For example, in the following code sample, the first and second loops can be executing different invocations of the component foo() if the invocations can be pipelined by the Intel® HLS Compiler Pro Edition:
component void foo() {
// first loop
for (int i = 0; i < n; i++) {
// Do something
}
// second loop
for (int i = 0; i < m; i++) {
// Do something else
}
}
However, the same invocation of the component foo() cannot execute the two loops in parallel. System of tasks provides a way to achieve this by moving the loops into asynchronous tasks. With the first loop in an asynchronous task, the second loop can run concurrently with the first loop.
void first_loop() {
for (int i = 0; i < n; i++) {
// Do something
}
}
void second_loop() {
for (int i = 0; i < m; i++) {
// Do something else
}
}
component void foo() {
ihc::launch<first_loop>();
ihc::launch<second_loop>();
ihc::collect<first_loop>();
ihc::collect<second_loop>();
}
Review the tutorial <quartus_installdir>/hls/examples/tutorials/system_of_tasks/parallel_loop to learn more about how to run multiple loops in parallel.