diff options
-rw-r--r-- | src/cl_api.c | 70 | ||||
-rw-r--r-- | src/cl_khr_icd.c | 2 | ||||
-rw-r--r-- | utests/profiling_exec.cpp | 3 | ||||
-rw-r--r-- | utests/utest_helper.cpp | 4 |
4 files changed, 75 insertions, 4 deletions
diff --git a/src/cl_api.c b/src/cl_api.c index 2913dd04..6d796d21 100644 --- a/src/cl_api.c +++ b/src/cl_api.c @@ -351,6 +351,76 @@ error: return queue; } +cl_command_queue +clCreateCommandQueueWithProperties(cl_context context, + cl_device_id device, + const cl_queue_properties* properties, + cl_int * errcode_ret) +{ + cl_command_queue queue = NULL; + cl_int err = CL_SUCCESS; + cl_command_queue_properties prop = 0xFFFFFFFF; + CHECK_CONTEXT (context); + + INVALID_DEVICE_IF (device != context->device); + if(properties) + { + cl_ulong que_type; + cl_ulong que_val; + cl_uint i; + for(i = 0;(que_type = properties[i++])!=0;i++) + { + que_val = properties[i]; + switch(que_type) + { + case CL_QUEUE_PROPERTIES: + if(prop != 0xFFFFFFFF) + err = CL_INVALID_VALUE; + else { + switch (que_val) { + case 0: + case CL_QUEUE_PROFILING_ENABLE: + case CL_QUEUE_PROFILING_ENABLE | + CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE: + case CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE: + case CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE: + case CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | + CL_QUEUE_ON_DEVICE_DEFAULT: + case CL_QUEUE_PROFILING_ENABLE | + CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE: + case CL_QUEUE_PROFILING_ENABLE | + CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | + CL_QUEUE_ON_DEVICE_DEFAULT: + prop = que_val; + break; + default: + err = CL_INVALID_VALUE; + break; + } + } + break; + case CL_QUEUE_SIZE: + break; + default: + err = CL_INVALID_VALUE; + break; + } + } + } + if(prop == 0xFFFFFFFF) prop = 0; + + if((prop & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)||(prop & CL_QUEUE_ON_DEVICE)) {/*not supported now.*/ + err = CL_INVALID_QUEUE_PROPERTIES; + goto error; + } + + queue = cl_context_create_queue(context, device, prop, &err); +error: + if (errcode_ret) + *errcode_ret = err; + return queue; +} + cl_int clRetainCommandQueue(cl_command_queue command_queue) { diff --git a/src/cl_khr_icd.c b/src/cl_khr_icd.c index 326d2d01..69a52830 100644 --- a/src/cl_khr_icd.c +++ b/src/cl_khr_icd.c @@ -172,7 +172,7 @@ struct _cl_icd_dispatch const cl_khr_icd_dispatch = { (void *) NULL, #endif #ifdef CL_VERSION_2_0 - (void *) NULL /* clCreateCommandQueueWithProperties */, + clCreateCommandQueueWithProperties, (void *) NULL /* clCreatePipe */, (void *) NULL /* clGetPipeInfo */, clSVMAlloc, diff --git a/utests/profiling_exec.cpp b/utests/profiling_exec.cpp index 437a6285..1859134f 100644 --- a/utests/profiling_exec.cpp +++ b/utests/profiling_exec.cpp @@ -52,7 +52,8 @@ static void profiling_exec(void) /* Because the profiling prop, we can not use default queue. */ - profiling_queue = clCreateCommandQueue(ctx, device, CL_QUEUE_PROFILING_ENABLE, &status); + const cl_queue_properties properties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0}; + profiling_queue = clCreateCommandQueueWithProperties(ctx, device, properties, &status); OCL_ASSERT(status == CL_SUCCESS); OCL_CREATE_KERNEL("compiler_fabs"); diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp index 65c97bb8..f9adbc66 100644 --- a/utests/utest_helper.cpp +++ b/utests/utest_helper.cpp @@ -509,9 +509,9 @@ cl_ocl_init(void) cl_test_channel_type_string(fmt[i].image_channel_data_type)); /* We are going to push NDRange kernels here */ - queue = clCreateCommandQueue(ctx, device, 0, &status); + queue = clCreateCommandQueueWithProperties(ctx, device, 0, &status); if (status != CL_SUCCESS) { - fprintf(stderr, "error calling clCreateCommandQueue\n"); + fprintf(stderr, "error calling clCreateCommandQueueWithProperties\n"); goto error; } |