[Python] Seemingly random values in PyOpenCL code when doing simple calculations

Discussão em 'Python' iniciado por Stack, Março 18, 2025.

  1. Stack

    Stack Membro Participativo

    While calculating some index values, I occasionally get nonsensical values. This is the code that seems to be the problem.

    int gid = get_global_id(0);
    int2 gids12 = (int2)(get_global_id(1),get_global_id(2));
    int tid = sorted_tris[gid];
    int2 pretile;
    for (int i = 1; i<(11*11); i++)
    {
    if (offsets[i/11][i%11] > gid)
    {
    pretile = (int2)((i-1)/11,(i-1)%11);
    i = 10000;
    }
    }
    int tile_val = gid%(pre_dims.x*pre_dims.y);
    int2 tile = (int2)((pretile.x*4)+gids12.x,(pretile.y*6)+gids12.y);


    The problem is that tile can sometimes be something like -1850166141, 195065, when the global work space is (n, 4, 6), and pretile should not exceed 10,10. The full program can be found here:CL3D Repo on Github. The code is from kernels.cl, line 375.

    I logged pretile and gids12 values and the error originates from the pretile calculation. I seems to be an overflow error, but I can't find the cause.

    Continue reading...

Compartilhe esta Página