AnsweredAssumed Answered

i.MX6: clFinish() not working with out-of-order command queues

Question asked by Benoit Thebaudeau on Jun 11, 2014
Latest reply on May 30, 2018 by changfeng x



In the Vivante GPU package from i.MX6 BSP 3.0.35-4.1.0, some queued commands may still be pending after clFinish() if the command queue is of out-of-order type. This pending state of some commands is confirmed by calls to clGetEventInfo().


Steps to reproduce:

- Create a command queue with clCreateCommandQueue(), setting the CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE property.

- Enqueue a few kernels (large enough to take some time) into this command queue, requesting a completion event.

- Call clFinish() for this command queue.


Expected result:

clGetEventInfo() should report either CL_COMPLETE or an error code for all queued kernels.


Actual result:

clGetEventInfo() reports CL_QUEUED, CL_SUBMITTED or CL_RUNNING for some of the queued kernels.


This is a bug since, according to § "5.13 Flush and Finish":

The function

cl_int clFinish (cl_command_queue command_queue)

blocks until all previously queued OpenCL commands in command_queue are issued to the associated device and have completed. clFinish does not return until all queued commands in command_queue have been processed and completed.


The workaround that I've found is:

cl_event end_evt;

clEnqueueMarker(command_queue, &end_evt);


clWaitForEvents(1, &end_evt);



I have not tested this issue with the Yocto release, but I have found nothing in the release notes indicating that such a bug has been fixed. Does anyone know?