CLK_LOCAL_MEM_FENCE causes OpenCL to skip a workgroup

CLK_LOCAL_MEM_FENCE causes OpenCL to skip a workgroup

Hello,

Consider the following kernel:

__kernel void test(__global float *dest)
{
    const int gi = get_group_id(0);
    const int i = get_global_id(0);
    if(i >= 17)
        return;
    //barrier(CLK_LOCAL_MEM_FENCE);
    dest[i] = gi;
}

If I run it with local size 16 and global size 32, passing an array of size 17 to it, it will fill it as [0 ... 0 1], as expected. But if I uncomment the barrier, the last element does not get filled, as if the second group is not executed at all. This bug appears on Ubuntu 12.04 x64, Intel OpenCL SDK 2.0-31360, and does not appear on OSX OpenCL platform, or on the same Ubuntu system and nVidia CUDA 5 platform. Is this a known issue?

Thank you in advance.

1 条帖子 / 0 全新
如需更全面地了解编译器优化,请参阅优化注意事项