Forum Discussion
Altera_Forum
Honored Contributor
12 years agoFOR loops can also have subtle races.
LOOP Indices starting from a Linear Function of ThreadID (like for (int i=get_local_id(0);)) and ending against a comparison to constant N (constant for all threads) will also make the FOR loop unsuitable for BARRIERs. e.g. for(int i=get_local_id(0); i<N ; i+=get_local_size(0)) { .... .... barrier(CLK_LOCAL_MEM_FENCE); // --> This is a bug. }