Does OpenCL Nvidia support int2, int3, int4..etc in kernel ?

I have tested in a simple opencl program.

Here’s the kernel


int2 get_uint2() {
    int2 ret;
    ret.x = 100;
    ret.y = 200;
}
__kernel void vector_test(__global int* num)
{
    int2 a = get_uint2();
    int2 b;
    b.x = 300;
    b.y = 400;
    for(int i = 0; i<10;i++) {
        num[i] = a.x;
    }
    for(int i = 10; i< 20; i++) {
        num[i] = a.y;
    }
    for(int i = 20; i< 30; i++) {
        num[i] = b.x;
    }
    for(int i = 30; i< 40; i++) {
        num[i] = b.y;
    }
    return ;
}

In the host, “num” is initialized -1, when I run the kernel above, I get the following result:


mem[0] : -1
mem[1] : -1
mem[2] : -1
mem[3] : -1
mem[4] : -1
mem[5] : -1
mem[6] : -1
mem[7] : -1
mem[8] : -1
mem[9] : -1
mem[10] : -1
mem[11] : -1
mem[12] : -1
mem[13] : -1
mem[14] : -1
mem[15] : -1
mem[16] : -1
mem[17] : -1
mem[18] : -1
mem[19] : -1
mem[20] : 300
mem[21] : 300
mem[22] : 300
mem[23] : 300
mem[24] : 300
mem[25] : 300
mem[26] : 300
mem[27] : 300
mem[28] : 300
mem[29] : 300
mem[30] : 400
mem[31] : 400
mem[32] : 400
mem[33] : 400
mem[34] : 400
mem[35] : 400
mem[36] : 400
mem[37] : 400
mem[38] : 400
mem[39] : 400
mem[40] : -1
mem[41] : -1
mem[42] : -1
mem[43] : -1
mem[44] : -1
mem[45] : -1

That says int2 is invalid when it is returned from another function.

What confuse me is the program won’t produce any error information.

So I can’t pass int2 or int3 …etc between functions, is that true ?

I did some extre test, that proved I can’t use “=” to assign a int2 to another int2. Is that right ? Or is that only happen in nvdia OpenCL?

Adding “return ret;” at the end of getuint2() will probably help…