I'm surprised by the behaviour of clCreateCommandQueue() on my macbook pro running OpenCL1.2.
I can supply a CL_QUEUE_PROFILING_ENABLE queue property without a problem. But if I try to set the CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE property, the queue fails to be created.
I could understand if it were to fail with CL_INVALID_QUEUE_PROPERTIES, according to the API documentation. Yet, it fails with CL_INVALID_VALUE which makes on sense. It claims the property is invalid, instead of just merely being unsupported by device. This happens on both the Iris GPU device, and the Intel CPU device.
The code:
context = clCreateContext( 0, 1, &device_id, opencl_notify, NULL, &err );
CHECK_CL
if ( !context )
{
LOGE( "Failed to create CL context. err=0x%x", err );
return 0;
}
cl_command_queue_properties queue_properties =
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE |
CL_QUEUE_PROFILING_ENABLE |
0;
commands = clCreateCommandQueue( context, device_id, queue_properties, &err );
CHECK_CL
The output:
Found 1 OpenCL platforms.
Platform FULL_PROFILE OpenCL 1.2 (Sep 20 2014 22:01:02) Apple Apple had 2 devices:
Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz with [4 units]
Iris Iris with [40 units]
ERR OpenCL called back with error: [CL_INVALID_VALUE] : OpenCL Error : clCreateCommandQueue failed: Device failed to create queue (cld returned: -35).
ERR OpenCL called back with error: [CL_INVALID_VALUE] : OpenCL Error : clCreateCommandQueue failed: Device failed to create queue: -30
CL_INVALID_VALUE
ERR Failed to create a command queue. err=0xffffffe2