AnsweredAssumed Answered

Getting stuck in a loop, does local variable not visible to other workitems in a work group?

Question asked by avinashkrc on Apr 22, 2019
Latest reply on Apr 25, 2019 by dipak

This is my kernel code:

__kernel void test(__global int *input_vector,__global atomic_int *mem_flag)
{
    local int d[32];
    if(get_local_id(0)==0) {
            d[0] = 100;
        }
    barrier(CLK_GLOBAL_MEM_FENCE| CLK_LOCAL_MEM_FENCE);
    while(1) {
        if(get_local_id(0) == 0) {
            d[0] = 0;
            break;
        }
        else {
            if(d[0] == 0)
            break;
        }
    }

}

Inside while loop > inside else part there is if condition that is expecting d[0] equals to 0 at some point of time. But it isn't happening. I am under the assumption that local variables can be seen by all the workitems in that workgroup. I am using APU A12-9800, ubuntu 14.04, fglrx.

Attachments

Outcomes