Loop Merging - Non-Trivial Code - 2020.1 English

Vitis HLS Messaging (UG1448)

Document ID
UG1448
Release Date
2020-06-03
Version
2020.1 English

Description

This message is to inform the user that the code is violating loop merging optimization rules.

Explanation

When there are multiple sequential loops it can create additional latency and prevent further optimizations.

To remove this impact the loop merging helps to merge the loops to reduce the latency. For which loops should follow the rules which say that there should not be any non-trivial code.

The following code shows a violation of loop merging:

void top (a[4],b[4],c[4],d[4], var, ot...) {
...
Add: for (i=3;i>=0;i--) { if (d[i])
a[i] = b[i] + c[i]; }
// non-trivial code.
int h = var*a[0]*ot;
Sub: for (i=3;i>=0;i--) { if (!d[i])
a[i] = b[i] - c[i] +h ; }
...
}

Solution

Consider moving the non-trivial code before or after the loops.