summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPan Xiuli <xiuli.pan@intel.com>2016-03-22 11:09:08 +0800
committerYang Rong <rong.r.yang@intel.com>2016-04-29 11:32:20 +0800
commite966c66757acb56f4eb98d9df62dbd8b564214d2 (patch)
tree0939f3a5edbe3e2ddc9d25519814cfb76cb5be09
parent6851343a9c07b295fd7eb10a61bae83f385de311 (diff)
Runtime: Add support for queue size and fix error handling
V2: Remove check for device queue and add device queue flag. Signed-off-by: Pan Xiuli <xiuli.pan@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
-rw-r--r--src/cl_api.c24
-rw-r--r--src/cl_command_queue.h1
-rw-r--r--src/cl_gt_device.h2
3 files changed, 19 insertions, 8 deletions
diff --git a/src/cl_api.c b/src/cl_api.c
index bb9b02bb..254c0291 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -439,6 +439,7 @@ clCreateCommandQueueWithProperties(cl_context context,
cl_command_queue queue = NULL;
cl_int err = CL_SUCCESS;
cl_command_queue_properties prop = 0xFFFFFFFF;
+ cl_uint queue_sz = 0xFFFFFFFF;
CHECK_CONTEXT (context);
INVALID_DEVICE_IF (device != context->device);
@@ -470,8 +471,8 @@ clCreateCommandQueueWithProperties(cl_context context,
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;
+ prop = que_val;
+ break;
default:
err = CL_INVALID_VALUE;
break;
@@ -479,6 +480,7 @@ clCreateCommandQueueWithProperties(cl_context context,
}
break;
case CL_QUEUE_SIZE:
+ queue_sz = que_val;
break;
default:
err = CL_INVALID_VALUE;
@@ -486,14 +488,18 @@ clCreateCommandQueueWithProperties(cl_context context,
}
}
}
+ if(err) goto error;
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;
- }
+ if(queue_sz != 0xFFFFFFFF)
+ if(!(prop & CL_QUEUE_ON_DEVICE)) {
+ err = CL_INVALID_VALUE;
+ goto error;
+ }
+ if(queue_sz == 0xFFFFFFFF) queue_sz = device->queue_on_device_preferred_size;
+ INVALID_VALUE_IF (queue_sz > device->queue_on_device_max_size);
queue = cl_context_create_queue(context, device, prop, &err);
+ queue->size = queue_sz;
error:
if (errcode_ret)
*errcode_ret = err;
@@ -539,6 +545,8 @@ clGetCommandQueueInfo(cl_command_queue command_queue,
FILL_GETINFO_RET (cl_uint, 1, &ref, CL_SUCCESS);
} else if (param_name == CL_QUEUE_PROPERTIES) {
FILL_GETINFO_RET (cl_command_queue_properties, 1, &command_queue->props, CL_SUCCESS);
+ } else if (param_name == CL_QUEUE_SIZE) {
+ FILL_GETINFO_RET (cl_uint, 1, &command_queue->size, CL_SUCCESS);
} else {
return CL_INVALID_VALUE;
}
@@ -1125,6 +1133,8 @@ clCreateSamplerWithProperties(cl_context context,
}
}
}
+ if(err)
+ goto error;
if(normalized == 0xFFFFFFFF) normalized = CL_TRUE;
if(addressing == 0xFFFFFFFF) addressing = CL_ADDRESS_CLAMP;
if(filter == 0xFFFFFFFF) filter = CL_FILTER_NEAREST;
diff --git a/src/cl_command_queue.h b/src/cl_command_queue.h
index bdf1a43b..ad561296 100644
--- a/src/cl_command_queue.h
+++ b/src/cl_command_queue.h
@@ -44,6 +44,7 @@ struct _cl_command_queue {
cl_command_queue prev, next; /* We chain the command queues together */
void *thread_data; /* Used to store thread context data */
cl_mem perf; /* Where to put the perf counters */
+ cl_uint size; /* Store the specified size for queueu */
};
/* The macro to get the thread specified gpgpu struct. */
diff --git a/src/cl_gt_device.h b/src/cl_gt_device.h
index 35a6ff59..6da21542 100644
--- a/src/cl_gt_device.h
+++ b/src/cl_gt_device.h
@@ -82,7 +82,7 @@
.execution_capabilities = CL_EXEC_KERNEL | CL_EXEC_NATIVE_KERNEL,
.queue_properties = CL_QUEUE_PROFILING_ENABLE,
.queue_on_host_properties = CL_QUEUE_PROFILING_ENABLE,
-.queue_on_device_properties = CL_QUEUE_PROFILING_ENABLE,
+.queue_on_device_properties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,
.queue_on_device_preferred_size = 16 * 1024,
.queue_on_device_max_size = 256 * 1024,
.max_on_device_queues = 1,