I’m learning about loop unrolling to avoid stalls caused by dependencies. I found many examples on internet and in literature, but I found no explanation on how the algorithm used to obtain the optimized code works (in case there is one such algorithm, of course). In particular, I don’t know how to determinate how many times should the loop be unrolled. Can it be calculated beforehand?
I’m learning about loop unrolling to avoid stalls caused by dependencies. I found many
Share
The rule of thumb is that you unwind so that:
Basically you unroll as long as you can put more resources to work and you stop when you no longer can measure any performance gains.