AnsweredAssumed Answered

Uninitialized variable - should runtime hang?

Question asked by sandyandr on May 24, 2016
Latest reply on May 26, 2016 by dipak

My kernel simply hangs when I try to do something like this:


var ushort4 vus4;

var ushort vus;

var int i;


if (get_local_id(0) < ...) vus4 = (ushort4) (..., ..., ..., ...);


for (i = 0; i < 4; i++) {

     vus = ...;

     vus4 = (ushort4) (vus4.yzw, vus);



Windows watchdog restarts the driver - on VLIW as well on GCN devices. The problem was that vus4 wasn't initialized for every workitem. I understand the reasons why such code is a problem for OpenCL - register allocation, etc.. Anyway, in a huge kernel it took quite a long time for me to find the cause of the problem - it'd be better if OpenCL runtime could avoid lock-ups in such situations somehow. Is it possible?