cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

xlxulin1
Journeyman III

how to test the type of half?

hello everyone.

     I got a problem on using half, below is my test kernel:

__kernel void test_half(

       __global half* a,

       __global half* b,   // output

       __global float* c  // output)

{

    int gid = get_global_id(0);

   

    half8 tmpA = vload8(0, (__global half *)a + gid);

    half8 tmpB = (half8)((half)1.0, (half)1.0, (half)1.0, (half)1.0, (half)1.0, (half)1.0, (half)1.0, (half)1.0);

    half8 tmpC = (half8)(1);

    tmpB = tmpA + tmpA;

    //tmpA = tmpB * tmpA;

    vstore8(tmpB, 0, (__global half *)b + gid);

}

On the host side, the thread size is just 1, besides, a = {1, 2, 3, 4, 5, 6, 7, 8};

when I printed out b: 0, 0, 0, 0, 0, 0, 0, 0.

Can someone explain it?

thanks.

0 Likes
1 Reply
xlxulin1
Journeyman III

I tested it on adreno, and I think I got the reason why this happening that conversion of cl_half to float is not supported on cpu.

After I do this conversion on gpu, and the result is correct.