Altera_Forum
Honored Contributor
7 years agoHow to deal with the Out-of-Order Loop Iterations in single work-item kernel?
Hi,
Today I tried to use single work-item kernel. I have a nested loop. In Loop Report, I found my outer loop not pipelined due to: loop iteration ordering: iterations may get out of order with respect to the inner loop,as the number of iterations of the inner loop may be different for different iterations of this loop. I understood this problem. for different outer iterations of outer loop, actually i need different number of iterations of inner loop. And in "out-of-order loop iterations" section of the best practices guide, I found an example, it is just similar to my code:
__kernel void order( __global unsigned* restrict input,
__global unsigned* restrict output, int N ) {
unsigned sum=0;
for (unsigned i = 0; i < N; i++) {
for (unsigned j = 0; j < i; j++)
sum += input;
}
output = sum;
}
But no solution is mentioned here. How can I pipeline the loop? Or how to deal with this problem? If I use multiple kernels, will it work?