[Beignet] [PATCH OCL2.0 5/6] Runtime: Add support of OCL2.0 device queries

Xiuli Pan xiuli.pan at intel.com
Tue Mar 1 00:40:03 UTC 2016


From: Pan Xiuli <xiuli.pan at intel.com>

Add device queries for OpenCL 2.0

Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
---
 src/cl_device_id.c | 14 +++++++++++++-
 src/cl_device_id.h | 16 ++++++++++++++--
 src/cl_gt_device.h | 14 +++++++++++++-
 3 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/src/cl_device_id.c b/src/cl_device_id.c
index 0652f4a..f419603 100644
--- a/src/cl_device_id.c
+++ b/src/cl_device_id.c
@@ -786,6 +786,7 @@ cl_get_device_info(cl_device_id     device,
     DECL_FIELD(IMAGE_SUPPORT, image_support)
     DECL_FIELD(MAX_READ_IMAGE_ARGS, max_read_image_args)
     DECL_FIELD(MAX_WRITE_IMAGE_ARGS, max_write_image_args)
+    DECL_FIELD(MAX_READ_WRITE_IMAGE_ARGS, max_read_write_image_args)
     DECL_FIELD(IMAGE_MAX_ARRAY_SIZE, image_max_array_size)
     DECL_FIELD(IMAGE2D_MAX_WIDTH, image2d_max_width)
     DECL_FIELD(IMAGE2D_MAX_HEIGHT, image2d_max_height)
@@ -809,6 +810,8 @@ cl_get_device_info(cl_device_id     device,
     DECL_FIELD(MAX_CONSTANT_BUFFER_SIZE, max_constant_buffer_size)
     DECL_FIELD(IMAGE_MAX_BUFFER_SIZE, image_mem_size)
     DECL_FIELD(MAX_CONSTANT_ARGS, max_constant_args)
+    DECL_FIELD(MAX_GLOBAL_VARIABLE_SIZE, max_global_variable_size)
+    DECL_FIELD(GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE, global_variable_preferred_total_size)
     DECL_FIELD(LOCAL_MEM_TYPE, local_mem_type)
     DECL_FIELD(LOCAL_MEM_SIZE, local_mem_size)
     DECL_FIELD(ERROR_CORRECTION_SUPPORT, error_correction_support)
@@ -820,6 +823,12 @@ cl_get_device_info(cl_device_id     device,
     DECL_FIELD(LINKER_AVAILABLE, linker_available)
     DECL_FIELD(EXECUTION_CAPABILITIES, execution_capabilities)
     DECL_FIELD(QUEUE_PROPERTIES, queue_properties)
+    //DECL_FIELD(QUEUE_ON_HOST_PROPERTIES, queue_on_host_properties)
+    DECL_FIELD(QUEUE_ON_DEVICE_PROPERTIES, queue_on_device_properties)
+    DECL_FIELD(QUEUE_ON_DEVICE_PREFERRED_SIZE, queue_on_device_preferred_size)
+    DECL_FIELD(QUEUE_ON_DEVICE_MAX_SIZE, queue_on_device_max_size)
+    DECL_FIELD(MAX_ON_DEVICE_QUEUES, max_on_device_queues)
+    DECL_FIELD(MAX_ON_DEVICE_EVENTS, max_on_device_events)
     DECL_FIELD(PLATFORM, platform)
     DECL_FIELD(PRINTF_BUFFER_SIZE, printf_buffer_size)
     DECL_FIELD(PREFERRED_INTEROP_USER_SYNC, interop_user_sync)
@@ -837,9 +846,12 @@ cl_get_device_info(cl_device_id     device,
     DECL_FIELD(PARTITION_AFFINITY_DOMAIN, affinity_domain)
     DECL_FIELD(PARTITION_TYPE, partition_type)
     DECL_FIELD(REFERENCE_COUNT, device_reference_count)
+    DECL_FIELD(SVM_CAPABILITIES, svm_capabilities)
+    DECL_FIELD(PREFERRED_PLATFORM_ATOMIC_ALIGNMENT, preferred_platform_atomic_alignment)
+    DECL_FIELD(PREFERRED_GLOBAL_ATOMIC_ALIGNMENT, preferred_global_atomic_alignment)
+    DECL_FIELD(PREFERRED_LOCAL_ATOMIC_ALIGNMENT, preferred_local_atomic_alignment)
     DECL_FIELD(IMAGE_PITCH_ALIGNMENT, image_pitch_alignment)
     DECL_FIELD(IMAGE_BASE_ADDRESS_ALIGNMENT, image_base_address_alignment)
-    DECL_FIELD(SVM_CAPABILITIES, svm_capabilities)
 
     case CL_DRIVER_VERSION:
       if (param_value_size_ret) {
diff --git a/src/cl_device_id.h b/src/cl_device_id.h
index e57e8e6..c4f9798 100644
--- a/src/cl_device_id.h
+++ b/src/cl_device_id.h
@@ -53,9 +53,13 @@ struct _cl_device_id {
   cl_uint  address_bits;
   size_t   max_mem_alloc_size;
   cl_device_svm_capabilities  svm_capabilities;
+  cl_uint preferred_platform_atomic_alignment;
+  cl_uint preferred_global_atomic_alignment;
+  cl_uint preferred_local_atomic_alignment;
   cl_bool  image_support;
   cl_uint  max_read_image_args;
   cl_uint  max_write_image_args;
+  cl_uint  max_read_write_image_args;
   size_t   image2d_max_width;
   size_t   image_max_array_size;
   size_t   image2d_max_height;
@@ -79,6 +83,8 @@ struct _cl_device_id {
   cl_ulong global_mem_size;
   cl_ulong max_constant_buffer_size;
   cl_uint  max_constant_args;
+  size_t  max_global_variable_size;
+  size_t  global_variable_preferred_total_size;
   cl_device_local_mem_type local_mem_type;
   cl_ulong local_mem_size;
   cl_ulong scratch_mem_size;
@@ -91,6 +97,12 @@ struct _cl_device_id {
   cl_bool  linker_available;
   cl_device_exec_capabilities execution_capabilities;
   cl_command_queue_properties queue_properties;
+  cl_command_queue_properties queue_on_host_properties;
+  cl_command_queue_properties queue_on_device_properties;
+  cl_uint queue_on_device_preferred_size;
+  cl_uint queue_on_device_max_size;
+  cl_uint max_on_device_queues;
+  cl_uint max_on_device_events;
   cl_platform_id platform;
   size_t printf_buffer_size;
   cl_bool interop_user_sync;
@@ -122,8 +134,8 @@ struct _cl_device_id {
   cl_device_partition_property partition_type[3];
   cl_uint      device_reference_count;
   uint32_t atomic_test_result;
-  uint32_t image_pitch_alignment;
-  uint32_t image_base_address_alignment;
+  cl_uint image_pitch_alignment;
+  cl_uint image_base_address_alignment;
 };
 
 /* Get a device from the given platform */
diff --git a/src/cl_gt_device.h b/src/cl_gt_device.h
index 06d11db..041ddaa 100644
--- a/src/cl_gt_device.h
+++ b/src/cl_gt_device.h
@@ -40,11 +40,15 @@
 .native_vector_width_double = 2,
 .native_vector_width_half = 8,
 .preferred_wg_sz_mul = 16,
-.address_bits = 32,
+.address_bits = 64,
 .svm_capabilities = CL_DEVICE_SVM_COARSE_GRAIN_BUFFER,
+.preferred_platform_atomic_alignment = 0,
+.preferred_global_atomic_alignment = 0,
+.preferred_local_atomic_alignment = 0,
 .image_support = CL_TRUE,
 .max_read_image_args = BTI_MAX_READ_IMAGE_ARGS,
 .max_write_image_args = BTI_MAX_WRITE_IMAGE_ARGS,
+.max_read_write_image_args = BTI_MAX_WRITE_IMAGE_ARGS,
 .image_max_array_size = 2048,
 .image2d_max_width = 8192,
 .image2d_max_height = 8192,
@@ -62,6 +66,8 @@
 .global_mem_cache_type = CL_READ_WRITE_CACHE,
 .max_constant_buffer_size = 128 * 1024 * 1024,
 .max_constant_args = 8,
+.max_global_variable_size = 64 * 1024,
+.global_variable_preferred_total_size = 64 * 1024,
 .error_correction_support = CL_FALSE,
 #ifdef HAS_USERPTR
 .host_unified_memory = CL_TRUE,
@@ -75,6 +81,12 @@
 .linker_available = CL_TRUE,
 .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_preferred_size = 16 * 1024,
+.queue_on_device_max_size = 256 * 1024,
+.max_on_device_queues = 1,
+.max_on_device_events = 1024,
 .platform = NULL, /* == intel_platform (set when requested) */
 /* IEEE 754, XXX does IVB support CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT? */
 .single_fp_config = CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST , /* IEEE 754. */
-- 
2.5.0



More information about the Beignet mailing list