Quantcast
Channel: Intel® Software - OpenCL*
Viewing all articles
Browse latest Browse all 1182

Intel HD Graphics 4600 GPU + ternary operator on pointers + while-loop = freeze

$
0
0

Hi!

Found and refined new strange cause for freezing OpenCL kernel.

This is absolutely minimal demonstration:

__kernel void freeze(
    __global int *a,
    __global int *b,
    int parity )
{
    __global int* c = (parity>0) ? a : b;
    uint id = (uint) get_global_id(0);
    while (id<256) {
        c[id] = -1;
        id += (uint) get_local_size(0);
    }
}

(The ZIP archive with complete code of this minimal demonstration is attached to the message)

Conditions:

1. Intel HD Graphics 4600 GPU (while all others I checked -- Intel CPU, NVIDIA GPU, AMD GPU -- run fine)

2. work group size: starting from 32

3. kernel like this:

  •   ternary operator choosing from one of two global arrays of the same type
  •   while-loop to write into this array (size 256 can be anything else)

4. the condition of the operator is met (in this code, parity is greater than zero)

 

Then the program locks, several seconds later the computer freezes completely so you need to press Reset.

-----------------

I hope there are no dumb errors:

  •  both arrays exist,
  •  their size is large enough: is 65536*sizeof(cl_int)
  •  and you can explicitly use either of them in writing: a[id]=-1 and b[id]=-1 work OK. so, only access to c[] in looped manner cause the freezing.
  • the initial (rather complex) program works well on many other devices.

P.S.
if printed, the pointer 'c' looks OK:

  if (id==0) printf(" a=%p b=%p c=%p\n", a, b, c);

it prints, for example:
 

     a=0x100000000 b=0x200000000 c=0x100000000
    or
     a=0x100000000 b=0x200000000 c=0x200000000

The code with printf() does not freeze. But I don't need any printf() in the production code :)

Looks like bu... well... imperfection :)
And I don't see any restriction on ternary operator in documentation.

 

Best Regard,

Petr


Viewing all articles
Browse latest Browse all 1182

Trending Articles