Using pair barriers in the condtional statement

Can we use following statement on OpenCL
kernel
{

if(i < 10)
{

barrier(CLK_LOCAL_MEM_FENCE);

}
else
{

barrier(CLK_LOCAL_MEM_FENCE);

}

}
Is it correct?

No, it’s not correct. See viewtopic.php?f=28&t=4392