Kariddi

event_wait_list into clEnqueueNDRangeKernel() doesn't work??

Discussion created by Kariddi on Apr 25, 2011
Latest reply on Apr 28, 2011 by himanshu.gautam

Hi, I'm triggering a strange bug (or situation) with clEnqueueNDRangeKernel() and event_wait_list.

What I do is making a kernel wait for some buffers to be ready before starting execution. More or less the code that does the trick is this one :

 

 

status = clEnqueueWriteBuffer(queue, oclb->m_edgeeq, CL_FALSE, 0, 

sizeof(cl_float)*9, eqparams, 0, NULL, events+2);

status = clEnqueueWriteBuffer(queue, oclb->m_interpar, CL_FALSE, 0, 

sizeof(cl_float)*3, lerppar, 0, NULL, events+3);

/* DOING SOME MORE WORK HERE ... */

if (blx > 0 && bly > 0 && trx > 0 && trry > 0)

{

status = clEnqueueNDRangeKernel(queue, interpk, 2, global_offset, global_size, NULL, 2, events+2, events+5); 

}



 

where events is an array of cl_event defined as 

cl_event events[10];

I use this for various events.

 

The problem is that the kernel doesn't seem to wait for the buffers to be ready before starting execution, triggering some nasty and subtle problems (that in the beginning brought me completely in the wrong direction).


Doing this :

 

if (blx > 0 && bly > 0 && trx > 0 && trry > 0)

{

clWaitForEvents(2, events+2);

status = clEnqueueNDRangeKernel(queue, interpk, 2, global_offset, global_size, NULL, 0, NULL, events+5); 

}



 

putting a clWaitForEvents just before the kernel execution solves the problem and the execution is correct. Even setting the Buffer write as blocking (setting the blocking parameter with CL_TRUE) solves the problem without the need for any event wait.


So, what's the problem? Why doesn't the function wait for the events I specified in the list? I did something wrong?

Thank you 

 

Outcomes