From: Luo Xionghu <[email protected]> old API clCreateCommandQueue is depricated in opencl 2.0.
Signed-off-by: Luo Xionghu <[email protected]> --- src/cl_api.c | 27 +++++++++++++++++++++++++++ src/cl_khr_icd.c | 6 +++++- utests/profiling_exec.cpp | 3 ++- utests/utest_helper.cpp | 4 ++-- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/cl_api.c b/src/cl_api.c index 5e24c36..c6b92d8 100644 --- a/src/cl_api.c +++ b/src/cl_api.c @@ -428,6 +428,33 @@ 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_queue_properties prop = 0; + CHECK_CONTEXT (context); + + INVALID_DEVICE_IF (device != context->device); + prop = properties == NULL ? 0 : *properties; + INVALID_VALUE_IF (prop & ~(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE)); + + if(prop & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) {/*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 7f9f88a..f9b91ae 100644 --- a/src/cl_khr_icd.c +++ b/src/cl_khr_icd.c @@ -56,7 +56,11 @@ struct _cl_icd_dispatch const cl_khr_icd_dispatch = { clRetainContext, clReleaseContext, clGetContextInfo, +#ifdef CL_VERSION_2_0 + (void *) NULL, /* clCreateCommandQueue deprecated.*/ +#else clCreateCommandQueue, +#endif clRetainCommandQueue, clReleaseCommandQueue, clGetCommandQueueInfo, @@ -195,7 +199,7 @@ struct _cl_icd_dispatch const cl_khr_icd_dispatch = { (void *) NULL, (void *) NULL, #ifdef CL_VERSION_2_0 - CL_2_0_NOTYET(clCreateCommandQueueWithProperties), + clCreateCommandQueueWithProperties, CL_2_0_NOTYET(clCreatePipe), CL_2_0_NOTYET(clGetPipeInfo), CL_2_0_NOTYET(clSVMAlloc), diff --git a/utests/profiling_exec.cpp b/utests/profiling_exec.cpp index afa55ba..757a061 100644 --- a/utests/profiling_exec.cpp +++ b/utests/profiling_exec.cpp @@ -53,7 +53,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_PROFILING_ENABLE; + profiling_queue = clCreateCommandQueueWithProperties(ctx, device, &properties, &status); OCL_ASSERT(status == CL_SUCCESS); /* save the default queue. */ diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp index d3c378e..6570f73 100644 --- a/utests/utest_helper.cpp +++ b/utests/utest_helper.cpp @@ -393,9 +393,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; } -- 1.9.1 _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
