Altera_Forum
Honored Contributor
7 years agoLocal variables in Kernel
Hi!
I was getting bad results in my kernel, so i decided to printf the local variables marked on the code in bold and blue. At every iteration of the 2nd loop the value from previous iteration is stored instead of creating a new local variable. Whats going wrong? P.S- In red i have a memory dependency, how i resolve this?int total_gin;
for(int w=0; w < row;w++)
{
int fcont = 0;
int row_mat = w*col;
for(i = 0; i < (col >> 3);i++)
{
int aux = i * 8;
int lcontsum = 0;
int ccol_co;
int copl=0;
int aux_tt;
int lcont;
# pragma unroll 8
for(int j=0;j < 8;j++)
{
int aux_g1 = aux + j;
lcont = loc_col & (g1 != 0);
lcontsum += lcont;
if(lcont)
{
ccol_co = j+1;
copl++;
aux_tt=1;
}
}
for(int bb=0; bb < 8;bb++){
total_gin += aux_tt;
int ax_col = (aux + (ccol_co-1));
if(ccol_co != 0){
in_cols] = w;
}
}
fcont += lcontsum;
}
}