From: Junyan He <[email protected]> V2: Rebase to OpenCL 2.0
Signed-off-by: Junyan He <[email protected]> --- src/CMakeLists.txt | 3 + src/cl_api.c | 161 -------------- src/cl_api_command_queue.c | 40 +++- src/cl_api_context.c | 61 ++++++ src/cl_api_device_id.c | 34 +++ src/cl_api_event.c | 39 ++++ src/cl_api_kernel.c | 48 ++++- src/cl_api_platform_id.c | 65 ++++++ src/cl_device_id.c | 521 +++++++++++++++++++++++++++++++++------------ src/cl_device_id.h | 2 +- src/cl_gt_device.h | 2 +- src/cl_platform_id.c | 51 ----- src/cl_platform_id.h | 7 - 13 files changed, 670 insertions(+), 364 deletions(-) create mode 100644 src/cl_api_context.c create mode 100644 src/cl_api_device_id.c create mode 100644 src/cl_api_platform_id.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 80e78fd..42cea21 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -69,10 +69,13 @@ set(OPENCL_SRC cl_base_object.c cl_utils.c cl_api.c + cl_api_platform_id.c + cl_api_device_id.c cl_api_mem.c cl_api_kernel.c cl_api_command_queue.c cl_api_event.c + cl_api_context.c cl_alloc.c cl_kernel.c cl_program.c diff --git a/src/cl_api.c b/src/cl_api.c index c4c8e6a..605c853 100644 --- a/src/cl_api.c +++ b/src/cl_api.c @@ -106,24 +106,6 @@ clGetPlatformIDs(cl_uint num_entries, } cl_int -clGetPlatformInfo(cl_platform_id platform, - cl_platform_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) -{ - /* Only one platform. This is easy */ - if (UNLIKELY(platform != NULL && platform != cl_get_platform_default())) - return CL_INVALID_PLATFORM; - - return cl_get_platform_info(platform, - param_name, - param_value_size, - param_value, - param_value_size_ret); -} - -cl_int clGetDeviceIDs(cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, @@ -152,20 +134,6 @@ clGetDeviceIDs(cl_platform_id platform, } cl_int -clGetDeviceInfo(cl_device_id device, - cl_device_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) -{ - return cl_get_device_info(device, - param_name, - param_value_size, - param_value, - param_value_size_ret); -} - -cl_int clCreateSubDevices(cl_device_id in_device, const cl_device_partition_property * properties, cl_uint num_devices, @@ -293,39 +261,6 @@ error: return err; } -cl_int -clGetContextInfo(cl_context context, - cl_context_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) -{ - cl_int err = CL_SUCCESS; - CHECK_CONTEXT (context); - - if (param_name == CL_CONTEXT_DEVICES) { - FILL_GETINFO_RET (cl_device_id, 1, &context->device, CL_SUCCESS); - } else if (param_name == CL_CONTEXT_NUM_DEVICES) { - cl_uint n = 1; - FILL_GETINFO_RET (cl_uint, 1, &n, CL_SUCCESS); - } else if (param_name == CL_CONTEXT_REFERENCE_COUNT) { - cl_uint ref = CL_OBJECT_GET_REF(context); - FILL_GETINFO_RET (cl_uint, 1, &ref, CL_SUCCESS); - } else if (param_name == CL_CONTEXT_PROPERTIES) { - if(context->prop_len > 0) { - FILL_GETINFO_RET (cl_context_properties, context->prop_len, context->prop_user, CL_SUCCESS); - } else { - cl_context_properties n = 0; - FILL_GETINFO_RET (cl_context_properties, 1, &n, CL_SUCCESS); - } - } else { - return CL_INVALID_VALUE; - } - -error: - return err; -} - cl_command_queue clCreateCommandQueue(cl_context context, cl_device_id device, @@ -437,35 +372,6 @@ error: return err; } -cl_int -clGetCommandQueueInfo(cl_command_queue command_queue, - cl_command_queue_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) -{ - cl_int err = CL_SUCCESS; - CHECK_QUEUE (command_queue); - - if (param_name == CL_QUEUE_CONTEXT) { - FILL_GETINFO_RET (cl_context, 1, &command_queue->ctx, CL_SUCCESS); - } else if (param_name == CL_QUEUE_DEVICE) { - FILL_GETINFO_RET (cl_device_id, 1, &command_queue->ctx->device, CL_SUCCESS); - } else if (param_name == CL_QUEUE_REFERENCE_COUNT) { - cl_uint ref = CL_OBJECT_GET_REF(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; - } - -error: - return err; -} - cl_mem clCreateBuffer(cl_context context, cl_mem_flags flags, @@ -1743,41 +1649,6 @@ error: } cl_int -clGetKernelInfo(cl_kernel kernel, - cl_kernel_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) -{ - cl_int err; - - CHECK_KERNEL(kernel); - - if (param_name == CL_KERNEL_CONTEXT) { - FILL_GETINFO_RET (cl_context, 1, &kernel->program->ctx, CL_SUCCESS); - } else if (param_name == CL_KERNEL_PROGRAM) { - FILL_GETINFO_RET (cl_program, 1, &kernel->program, CL_SUCCESS); - } else if (param_name == CL_KERNEL_NUM_ARGS) { - cl_uint n = kernel->arg_n; - FILL_GETINFO_RET (cl_uint, 1, &n, CL_SUCCESS); - } else if (param_name == CL_KERNEL_REFERENCE_COUNT) { - cl_int ref = CL_OBJECT_GET_REF(kernel); - FILL_GETINFO_RET (cl_int, 1, &ref, CL_SUCCESS); - } else if (param_name == CL_KERNEL_FUNCTION_NAME) { - const char * n = cl_kernel_get_name(kernel); - FILL_GETINFO_RET (cl_char, strlen(n)+1, n, CL_SUCCESS); - } else if (param_name == CL_KERNEL_ATTRIBUTES) { - const char * n = cl_kernel_get_attributes(kernel); - FILL_GETINFO_RET (cl_char, strlen(n)+1, n, CL_SUCCESS); - } else { - return CL_INVALID_VALUE; - } - -error: - return err; -} - -cl_int clGetKernelWorkGroupInfo(cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, @@ -1814,38 +1685,6 @@ clGetKernelSubGroupInfoKHR(cl_kernel kernel, } cl_int -clGetEventInfo(cl_event event, - cl_event_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) -{ - cl_int err = CL_SUCCESS; - cl_int status; - CHECK_EVENT(event); - - if (param_name == CL_EVENT_COMMAND_QUEUE) { - FILL_GETINFO_RET (cl_command_queue, 1, &event->queue, CL_SUCCESS); - } else if (param_name == CL_EVENT_CONTEXT) { - FILL_GETINFO_RET (cl_context, 1, &event->ctx, CL_SUCCESS); - } else if (param_name == CL_EVENT_COMMAND_TYPE) { - FILL_GETINFO_RET (cl_command_type, 1, &event->event_type, CL_SUCCESS); - } else if (param_name == CL_EVENT_COMMAND_EXECUTION_STATUS) { - status = cl_event_get_status(event); - FILL_GETINFO_RET (cl_int, 1, &status, CL_SUCCESS); - } else if (param_name == CL_EVENT_REFERENCE_COUNT) { - cl_uint ref = CL_OBJECT_GET_REF(event); - FILL_GETINFO_RET (cl_int, 1, &ref, CL_SUCCESS); - } else { - return CL_INVALID_VALUE; - } - -error: - return err; - -} - -cl_int clRetainEvent(cl_event event) { cl_int err = CL_SUCCESS; diff --git a/src/cl_api_command_queue.c b/src/cl_api_command_queue.c index 9f06deb..4ddebe3 100644 --- a/src/cl_api_command_queue.c +++ b/src/cl_api_command_queue.c @@ -20,6 +20,44 @@ #include <stdio.h> cl_int +clGetCommandQueueInfo(cl_command_queue command_queue, + cl_command_queue_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) +{ + const void *src_ptr = NULL; + size_t src_size = 0; + + if (!CL_OBJECT_IS_COMMAND_QUEUE(command_queue)) { + return CL_INVALID_COMMAND_QUEUE; + } + + if (param_name == CL_QUEUE_CONTEXT) { + src_ptr = &command_queue->ctx; + src_size = sizeof(cl_context); + } else if (param_name == CL_QUEUE_DEVICE) { + src_ptr = &command_queue->ctx->device; + src_size = sizeof(cl_device_id); + } else if (param_name == CL_QUEUE_REFERENCE_COUNT) { + cl_int ref = CL_OBJECT_GET_REF(command_queue); + src_ptr = &ref; + src_size = sizeof(cl_int); + } else if (param_name == CL_QUEUE_PROPERTIES) { + src_ptr = &command_queue->props; + src_size = sizeof(cl_command_queue_properties); + } else if (param_name == CL_QUEUE_SIZE) { + src_ptr = &command_queue->size; + src_size = sizeof(cl_uint); + } else { + return CL_INVALID_VALUE; + } + + return cl_get_info_helper(src_ptr, src_size, + param_value, param_value_size, param_value_size_ret); +} + +cl_int clFlush(cl_command_queue command_queue) { if (!CL_OBJECT_IS_COMMAND_QUEUE(command_queue)) { @@ -39,7 +77,6 @@ clFinish(cl_command_queue command_queue) return cl_command_queue_wait_finish(command_queue); } - cl_int clReleaseCommandQueue(cl_command_queue command_queue) { @@ -52,4 +89,3 @@ clReleaseCommandQueue(cl_command_queue command_queue) cl_command_queue_delete(command_queue); return CL_SUCCESS; } - diff --git a/src/cl_api_context.c b/src/cl_api_context.c new file mode 100644 index 0000000..d2adb41 --- /dev/null +++ b/src/cl_api_context.c @@ -0,0 +1,61 @@ +/* + * Copyright © 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include "cl_context.h" + +cl_int +clGetContextInfo(cl_context context, + cl_context_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) +{ + const void *src_ptr = NULL; + size_t src_size = 0; + + if (!CL_OBJECT_IS_CONTEXT(context)) { + return CL_INVALID_CONTEXT; + } + + if (param_name == CL_CONTEXT_DEVICES) { + src_ptr = &context->device; + src_size = sizeof(cl_device_id); + } else if (param_name == CL_CONTEXT_NUM_DEVICES) { + cl_uint n = 1; + src_ptr = &n; + src_size = sizeof(cl_uint); + } else if (param_name == CL_CONTEXT_REFERENCE_COUNT) { + cl_uint ref = CL_OBJECT_GET_REF(context); + src_ptr = &ref; + src_size = sizeof(cl_uint); + } else if (param_name == CL_CONTEXT_PROPERTIES) { + if (context->prop_len > 0) { + src_ptr = context->prop_user; + src_size = sizeof(cl_context_properties) * context->prop_len; + } else { + cl_context_properties n = 0; + src_ptr = &n; + src_size = sizeof(cl_context_properties); + } + } else { + return CL_INVALID_VALUE; + } + + return cl_get_info_helper(src_ptr, src_size, + param_value, param_value_size, param_value_size_ret); +} diff --git a/src/cl_api_device_id.c b/src/cl_api_device_id.c new file mode 100644 index 0000000..4b67dc3 --- /dev/null +++ b/src/cl_api_device_id.c @@ -0,0 +1,34 @@ +/* + * Copyright © 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include "cl_device_id.h" + +cl_int +clGetDeviceInfo(cl_device_id device, + cl_device_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) +{ + if (!CL_OBJECT_IS_DEVICE(device)) { + return CL_INVALID_DEVICE; + } + + return cl_get_device_info(device, param_name, param_value_size, + param_value, param_value_size_ret); +} diff --git a/src/cl_api_event.c b/src/cl_api_event.c index 63bccf2..a5cc114 100644 --- a/src/cl_api_event.c +++ b/src/cl_api_event.c @@ -249,3 +249,42 @@ clSetEventCallback(cl_event event, err = cl_event_set_callback(event, command_exec_callback_type, pfn_notify, user_data); return err; } + +cl_int +clGetEventInfo(cl_event event, + cl_event_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) +{ + void *src_ptr = NULL; + size_t src_size = 0; + + if (!CL_OBJECT_IS_EVENT(event)) { + return CL_INVALID_EVENT; + } + + if (param_name == CL_EVENT_COMMAND_QUEUE) { + src_ptr = &event->queue; + src_size = sizeof(cl_command_queue); + } else if (param_name == CL_EVENT_CONTEXT) { + src_ptr = &event->ctx; + src_size = sizeof(cl_context); + } else if (param_name == CL_EVENT_COMMAND_TYPE) { + src_ptr = &event->event_type; + src_size = sizeof(cl_command_type); + } else if (param_name == CL_EVENT_COMMAND_EXECUTION_STATUS) { + cl_int status = cl_event_get_status(event); + src_ptr = &status; + src_size = sizeof(cl_int); + } else if (param_name == CL_EVENT_REFERENCE_COUNT) { + cl_uint ref = CL_OBJECT_GET_REF(event); + src_ptr = &ref; + src_size = sizeof(cl_int); + } else { + return CL_INVALID_VALUE; + } + + return cl_get_info_helper(src_ptr, src_size, + param_value, param_value_size, param_value_size_ret); +} diff --git a/src/cl_api_kernel.c b/src/cl_api_kernel.c index 70140b2..f38464b 100644 --- a/src/cl_api_kernel.c +++ b/src/cl_api_kernel.c @@ -28,6 +28,50 @@ #include <string.h> cl_int +clGetKernelInfo(cl_kernel kernel, + cl_kernel_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) +{ + const void *src_ptr = NULL; + size_t src_size = 0; + + if (!CL_OBJECT_IS_KERNEL(kernel)) { + return CL_INVALID_KERNEL; + } + + if (param_name == CL_KERNEL_CONTEXT) { + src_ptr = &kernel->program->ctx; + src_size = sizeof(cl_context); + } else if (param_name == CL_KERNEL_PROGRAM) { + src_ptr = &kernel->program; + src_size = sizeof(cl_program); + } else if (param_name == CL_KERNEL_NUM_ARGS) { + cl_uint n = kernel->arg_n; + src_ptr = &n; + src_size = sizeof(cl_uint); + } else if (param_name == CL_KERNEL_REFERENCE_COUNT) { + cl_int ref = CL_OBJECT_GET_REF(kernel); + src_ptr = &ref; + src_size = sizeof(cl_int); + } else if (param_name == CL_KERNEL_FUNCTION_NAME) { + const char *str = cl_kernel_get_name(kernel); + src_ptr = str; + src_size = strlen(str) + 1; + } else if (param_name == CL_KERNEL_ATTRIBUTES) { + const char *str = cl_kernel_get_attributes(kernel); + src_ptr = str; + src_size = strlen(str) + 1; + } else { + return CL_INVALID_VALUE; + } + + return cl_get_info_helper(src_ptr, src_size, + param_value, param_value_size, param_value_size_ret); +} + +cl_int clEnqueueNDRangeKernel(cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, @@ -127,8 +171,8 @@ clEnqueueNDRangeKernel(cl_command_queue command_queue, if (realGroupSize % 8 != 0 && warn_no_good_localsize) { warn_no_good_localsize = 0; DEBUGP(DL_WARNING, "unable to find good values for local_work_size[i], please provide\n" - " local_work_size[] explicitly, you can find good values with\n" - " trial-and-error method."); + " local_work_size[] explicitly, you can find good values with\n" + " trial-and-error method."); } } } diff --git a/src/cl_api_platform_id.c b/src/cl_api_platform_id.c new file mode 100644 index 0000000..10d8894 --- /dev/null +++ b/src/cl_api_platform_id.c @@ -0,0 +1,65 @@ +/* + * Copyright © 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include "cl_platform_id.h" +#include "CL/cl_ext.h" + +cl_int +clGetPlatformInfo(cl_platform_id platform, + cl_platform_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) +{ + const void *src_ptr = NULL; + size_t src_size = 0; + + if (!CL_OBJECT_IS_PLATFORM(platform)) { + return CL_INVALID_PLATFORM; + } + + /* Only one platform now. */ + if (platform != cl_get_platform_default()) { + return CL_INVALID_PLATFORM; + } + + if (param_name == CL_PLATFORM_PROFILE) { + src_ptr = platform->profile; + src_size = platform->profile_sz; + } else if (param_name == CL_PLATFORM_VERSION) { + src_ptr = platform->version; + src_size = platform->version_sz; + } else if (param_name == CL_PLATFORM_NAME) { + src_ptr = platform->name; + src_size = platform->name_sz; + } else if (param_name == CL_PLATFORM_VENDOR) { + src_ptr = platform->vendor; + src_size = platform->vendor_sz; + } else if (param_name == CL_PLATFORM_EXTENSIONS) { + src_ptr = platform->extensions; + src_size = platform->extensions_sz; + } else if (param_name == CL_PLATFORM_ICD_SUFFIX_KHR) { + src_ptr = platform->icd_suffix_khr; + src_size = platform->icd_suffix_khr_sz; + } else { + return CL_INVALID_VALUE; + } + + return cl_get_info_helper(src_ptr, src_size, + param_value, param_value_size, param_value_size_ret); +} diff --git a/src/cl_device_id.c b/src/cl_device_id.c index 24334fd..88284c6 100644 --- a/src/cl_device_id.c +++ b/src/cl_device_id.c @@ -917,30 +917,6 @@ cl_get_device_ids(cl_platform_id platform, } } -#define DECL_FIELD(CASE,FIELD) \ - case JOIN(CL_DEVICE_,CASE): \ - if (param_value_size_ret) { \ - *param_value_size_ret = sizeof device->FIELD; \ - if (!param_value) \ - return CL_SUCCESS; \ - } \ - if (param_value_size < sizeof device->FIELD) \ - return CL_INVALID_VALUE; \ - memcpy(param_value, &device->FIELD, sizeof device->FIELD); \ - return CL_SUCCESS; - -#define DECL_STRING_FIELD(CASE,FIELD) \ - case JOIN(CL_DEVICE_,CASE): \ - if (param_value_size_ret) { \ - *param_value_size_ret = device->JOIN(FIELD,_sz); \ - if (!param_value) \ - return CL_SUCCESS; \ - } \ - if (param_value_size < device->JOIN(FIELD,_sz)) \ - return CL_INVALID_VALUE; \ - memcpy(param_value, device->FIELD, device->JOIN(FIELD,_sz)); \ - return CL_SUCCESS; - LOCAL cl_bool is_gen_device(cl_device_id device) { return device == &intel_ivb_gt1_device || device == &intel_ivb_gt2_device || @@ -972,130 +948,397 @@ cl_get_device_info(cl_device_id device, void * param_value, size_t * param_value_size_ret) { + const void *src_ptr = NULL; + size_t src_size = 0; + + // We now just support gen devices. if (UNLIKELY(is_gen_device(device) == CL_FALSE)) return CL_INVALID_DEVICE; /* Find the correct parameter */ switch (param_name) { - DECL_FIELD(TYPE, device_type) - DECL_FIELD(VENDOR_ID, vendor_id) - DECL_FIELD(MAX_COMPUTE_UNITS, max_compute_unit) - DECL_FIELD(MAX_WORK_ITEM_DIMENSIONS, max_work_item_dimensions) - DECL_FIELD(MAX_WORK_ITEM_SIZES, max_work_item_sizes) - DECL_FIELD(MAX_WORK_GROUP_SIZE, max_work_group_size) - DECL_FIELD(PREFERRED_VECTOR_WIDTH_CHAR, preferred_vector_width_char) - DECL_FIELD(PREFERRED_VECTOR_WIDTH_SHORT, preferred_vector_width_short) - DECL_FIELD(PREFERRED_VECTOR_WIDTH_INT, preferred_vector_width_int) - DECL_FIELD(PREFERRED_VECTOR_WIDTH_LONG, preferred_vector_width_long) - DECL_FIELD(PREFERRED_VECTOR_WIDTH_FLOAT, preferred_vector_width_float) - DECL_FIELD(PREFERRED_VECTOR_WIDTH_DOUBLE, preferred_vector_width_double) - DECL_FIELD(PREFERRED_VECTOR_WIDTH_HALF, preferred_vector_width_half) - DECL_FIELD(NATIVE_VECTOR_WIDTH_CHAR, native_vector_width_char) - DECL_FIELD(NATIVE_VECTOR_WIDTH_SHORT, native_vector_width_short) - DECL_FIELD(NATIVE_VECTOR_WIDTH_INT, native_vector_width_int) - DECL_FIELD(NATIVE_VECTOR_WIDTH_LONG, native_vector_width_long) - DECL_FIELD(NATIVE_VECTOR_WIDTH_FLOAT, native_vector_width_float) - DECL_FIELD(NATIVE_VECTOR_WIDTH_DOUBLE, native_vector_width_double) - DECL_FIELD(NATIVE_VECTOR_WIDTH_HALF, native_vector_width_half) - DECL_FIELD(MAX_CLOCK_FREQUENCY, max_clock_frequency) - DECL_FIELD(ADDRESS_BITS, address_bits) - DECL_FIELD(MAX_MEM_ALLOC_SIZE, max_mem_alloc_size) - 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) - DECL_FIELD(IMAGE3D_MAX_WIDTH, image3d_max_width) - DECL_FIELD(IMAGE3D_MAX_HEIGHT, image3d_max_height) - DECL_FIELD(IMAGE3D_MAX_DEPTH, image3d_max_depth) - DECL_FIELD(MAX_SAMPLERS, max_samplers) - DECL_FIELD(MAX_PARAMETER_SIZE, max_parameter_size) - DECL_FIELD(MEM_BASE_ADDR_ALIGN, mem_base_addr_align) - DECL_FIELD(MIN_DATA_TYPE_ALIGN_SIZE, min_data_type_align_size) - DECL_FIELD(MAX_PIPE_ARGS, max_pipe_args) - DECL_FIELD(PIPE_MAX_ACTIVE_RESERVATIONS, pipe_max_active_reservations) - DECL_FIELD(PIPE_MAX_PACKET_SIZE, pipe_max_packet_siz) - DECL_FIELD(SINGLE_FP_CONFIG, single_fp_config) - DECL_FIELD(HALF_FP_CONFIG, half_fp_config) - DECL_FIELD(DOUBLE_FP_CONFIG, double_fp_config) - DECL_FIELD(GLOBAL_MEM_CACHE_TYPE, global_mem_cache_type) - DECL_FIELD(GLOBAL_MEM_CACHELINE_SIZE, global_mem_cache_line_size) - DECL_FIELD(GLOBAL_MEM_CACHE_SIZE, global_mem_cache_size) - DECL_FIELD(GLOBAL_MEM_SIZE, global_mem_size) - 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) - DECL_FIELD(HOST_UNIFIED_MEMORY, host_unified_memory) - DECL_FIELD(PROFILING_TIMER_RESOLUTION, profiling_timer_resolution) - DECL_FIELD(ENDIAN_LITTLE, endian_little) - DECL_FIELD(AVAILABLE, available) - DECL_FIELD(COMPILER_AVAILABLE, compiler_available) - 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) - DECL_STRING_FIELD(NAME, name) - DECL_STRING_FIELD(VENDOR, vendor) - DECL_STRING_FIELD(VERSION, version) - DECL_STRING_FIELD(PROFILE, profile) - DECL_STRING_FIELD(OPENCL_C_VERSION, opencl_c_version) - DECL_STRING_FIELD(SPIR_VERSIONS, spir_versions) - DECL_STRING_FIELD(EXTENSIONS, extensions); - DECL_STRING_FIELD(BUILT_IN_KERNELS, built_in_kernels) - DECL_FIELD(PARENT_DEVICE, parent_device) - DECL_FIELD(PARTITION_MAX_SUB_DEVICES, partition_max_sub_device) - DECL_FIELD(PARTITION_PROPERTIES, partition_property) - DECL_FIELD(PARTITION_AFFINITY_DOMAIN, affinity_domain) - DECL_FIELD(PARTITION_TYPE, partition_type) - 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) - + case CL_DEVICE_TYPE: + src_ptr = &device->device_type; + src_size = sizeof(device->device_type); + break; + case CL_DEVICE_VENDOR_ID: + src_ptr = &device->vendor_id; + src_size = sizeof(device->vendor_id); + break; + case CL_DEVICE_MAX_COMPUTE_UNITS: + src_ptr = &device->max_compute_unit; + src_size = sizeof(device->max_compute_unit); + break; + case CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: + src_ptr = &device->max_work_item_dimensions; + src_size = sizeof(device->max_work_item_dimensions); + break; + case CL_DEVICE_MAX_WORK_ITEM_SIZES: + src_ptr = &device->max_work_item_sizes; + src_size = sizeof(device->max_work_item_sizes); + break; + case CL_DEVICE_MAX_WORK_GROUP_SIZE: + src_ptr = &device->max_work_group_size; + src_size = sizeof(device->max_work_group_size); + break; + case CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR: + src_ptr = &device->preferred_vector_width_char; + src_size = sizeof(device->preferred_vector_width_char); + break; + case CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT: + src_ptr = &device->preferred_vector_width_short; + src_size = sizeof(device->preferred_vector_width_short); + break; + case CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT: + src_ptr = &device->preferred_vector_width_int; + src_size = sizeof(device->preferred_vector_width_int); + break; + case CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG: + src_ptr = &device->preferred_vector_width_long; + src_size = sizeof(device->preferred_vector_width_long); + break; + case CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT: + src_ptr = &device->preferred_vector_width_float; + src_size = sizeof(device->preferred_vector_width_float); + break; + case CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE: + src_ptr = &device->preferred_vector_width_double; + src_size = sizeof(device->preferred_vector_width_double); + break; + case CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF: + src_ptr = &device->preferred_vector_width_half; + src_size = sizeof(device->preferred_vector_width_half); + break; + case CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR: + src_ptr = &device->native_vector_width_char; + src_size = sizeof(device->native_vector_width_char); + break; + case CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT: + src_ptr = &device->native_vector_width_short; + src_size = sizeof(device->native_vector_width_short); + break; + case CL_DEVICE_NATIVE_VECTOR_WIDTH_INT: + src_ptr = &device->native_vector_width_int; + src_size = sizeof(device->native_vector_width_int); + break; + case CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG: + src_ptr = &device->native_vector_width_long; + src_size = sizeof(device->native_vector_width_long); + break; + case CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT: + src_ptr = &device->native_vector_width_float; + src_size = sizeof(device->native_vector_width_float); + break; + case CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE: + src_ptr = &device->native_vector_width_double; + src_size = sizeof(device->native_vector_width_double); + break; + case CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF: + src_ptr = &device->native_vector_width_half; + src_size = sizeof(device->native_vector_width_half); + break; + case CL_DEVICE_MAX_CLOCK_FREQUENCY: + src_ptr = &device->max_clock_frequency; + src_size = sizeof(device->max_clock_frequency); + break; + case CL_DEVICE_ADDRESS_BITS: + src_ptr = &device->address_bits; + src_size = sizeof(device->address_bits); + break; + case CL_DEVICE_MAX_MEM_ALLOC_SIZE: + src_ptr = &device->max_mem_alloc_size; + src_size = sizeof(device->max_mem_alloc_size); + break; + case CL_DEVICE_IMAGE_SUPPORT: + src_ptr = &device->image_support; + src_size = sizeof(device->image_support); + break; + case CL_DEVICE_MAX_READ_IMAGE_ARGS: + src_ptr = &device->max_read_image_args; + src_size = sizeof(device->max_read_image_args); + break; + case CL_DEVICE_MAX_WRITE_IMAGE_ARGS: + src_ptr = &device->max_write_image_args; + src_size = sizeof(device->max_write_image_args); + break; + case CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS: + src_ptr = &device->max_read_write_image_args; + src_size = sizeof(device->max_read_write_image_args); + break; + case CL_DEVICE_IMAGE_MAX_ARRAY_SIZE: + src_ptr = &device->image_max_array_size; + src_size = sizeof(device->image_max_array_size); + break; + case CL_DEVICE_IMAGE2D_MAX_WIDTH: + src_ptr = &device->image2d_max_width; + src_size = sizeof(device->image2d_max_width); + break; + case CL_DEVICE_IMAGE2D_MAX_HEIGHT: + src_ptr = &device->image2d_max_height; + src_size = sizeof(device->image2d_max_height); + break; + case CL_DEVICE_IMAGE3D_MAX_WIDTH: + src_ptr = &device->image3d_max_width; + src_size = sizeof(device->image3d_max_width); + break; + case CL_DEVICE_IMAGE3D_MAX_HEIGHT: + src_ptr = &device->image3d_max_height; + src_size = sizeof(device->image3d_max_height); + break; + case CL_DEVICE_IMAGE3D_MAX_DEPTH: + src_ptr = &device->image3d_max_depth; + src_size = sizeof(device->image3d_max_depth); + break; + case CL_DEVICE_MAX_SAMPLERS: + src_ptr = &device->max_samplers; + src_size = sizeof(device->max_samplers); + break; + case CL_DEVICE_MAX_PARAMETER_SIZE: + src_ptr = &device->max_parameter_size; + src_size = sizeof(device->max_parameter_size); + break; + case CL_DEVICE_MEM_BASE_ADDR_ALIGN: + src_ptr = &device->mem_base_addr_align; + src_size = sizeof(device->mem_base_addr_align); + break; + case CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE: + src_ptr = &device->min_data_type_align_size; + src_size = sizeof(device->min_data_type_align_size); + break; + case CL_DEVICE_MAX_PIPE_ARGS: + src_ptr = &device->max_pipe_args; + src_size = sizeof(device->max_pipe_args); + break; + case CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS: + src_ptr = &device->pipe_max_active_reservations; + src_size = sizeof(device->pipe_max_active_reservations); + break; + case CL_DEVICE_PIPE_MAX_PACKET_SIZE: + src_ptr = &device->pipe_max_packet_size; + src_size = sizeof(device->pipe_max_packet_size); + break; + case CL_DEVICE_SINGLE_FP_CONFIG: + src_ptr = &device->single_fp_config; + src_size = sizeof(device->single_fp_config); + break; + case CL_DEVICE_HALF_FP_CONFIG: + src_ptr = &device->half_fp_config; + src_size = sizeof(device->half_fp_config); + break; + case CL_DEVICE_DOUBLE_FP_CONFIG: + src_ptr = &device->double_fp_config; + src_size = sizeof(device->double_fp_config); + break; + case CL_DEVICE_GLOBAL_MEM_CACHE_TYPE: + src_ptr = &device->global_mem_cache_type; + src_size = sizeof(device->global_mem_cache_type); + break; + case CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE: + src_ptr = &device->global_mem_cache_line_size; + src_size = sizeof(device->global_mem_cache_line_size); + break; + case CL_DEVICE_GLOBAL_MEM_CACHE_SIZE: + src_ptr = &device->global_mem_cache_size; + src_size = sizeof(device->global_mem_cache_size); + break; + case CL_DEVICE_GLOBAL_MEM_SIZE: + src_ptr = &device->global_mem_size; + src_size = sizeof(device->global_mem_size); + break; + case CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: + src_ptr = &device->max_constant_buffer_size; + src_size = sizeof(device->max_constant_buffer_size); + break; + case CL_DEVICE_IMAGE_MAX_BUFFER_SIZE: + src_ptr = &device->image_mem_size; + src_size = sizeof(device->image_mem_size); + break; + case CL_DEVICE_MAX_CONSTANT_ARGS: + src_ptr = &device->max_constant_args; + src_size = sizeof(device->max_constant_args); + break; + case CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE: + src_ptr = &device->max_global_variable_size; + src_size = sizeof(device->max_global_variable_size); + break; + case CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE: + src_ptr = &device->global_variable_preferred_total_size; + src_size = sizeof(device->global_variable_preferred_total_size); + break; + case CL_DEVICE_LOCAL_MEM_TYPE: + src_ptr = &device->local_mem_type; + src_size = sizeof(device->local_mem_type); + break; + case CL_DEVICE_LOCAL_MEM_SIZE: + src_ptr = &device->local_mem_size; + src_size = sizeof(device->local_mem_size); + break; + case CL_DEVICE_ERROR_CORRECTION_SUPPORT: + src_ptr = &device->error_correction_support; + src_size = sizeof(device->error_correction_support); + break; + case CL_DEVICE_HOST_UNIFIED_MEMORY: + src_ptr = &device->host_unified_memory; + src_size = sizeof(device->host_unified_memory); + break; + case CL_DEVICE_PROFILING_TIMER_RESOLUTION: + src_ptr = &device->profiling_timer_resolution; + src_size = sizeof(device->profiling_timer_resolution); + break; + case CL_DEVICE_ENDIAN_LITTLE: + src_ptr = &device->endian_little; + src_size = sizeof(device->endian_little); + break; + case CL_DEVICE_AVAILABLE: + src_ptr = &device->available; + src_size = sizeof(device->available); + break; + case CL_DEVICE_COMPILER_AVAILABLE: + src_ptr = &device->compiler_available; + src_size = sizeof(device->compiler_available); + break; + case CL_DEVICE_LINKER_AVAILABLE: + src_ptr = &device->linker_available; + src_size = sizeof(device->linker_available); + break; + case CL_DEVICE_EXECUTION_CAPABILITIES: + src_ptr = &device->execution_capabilities; + src_size = sizeof(device->execution_capabilities); + break; + case CL_DEVICE_QUEUE_PROPERTIES: + src_ptr = &device->queue_properties; + src_size = sizeof(device->queue_properties); + break; + //case CL_DEVICE_QUEUE_ON_HOST_PROPERTIES: + // src_ptr = &device->queue_on_host_properties; + // src_size = sizeof(device->queue_on_host_properties); + // break; + case CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES: + src_ptr = &device->queue_on_device_properties; + src_size = sizeof(device->queue_on_device_properties); + break; + case CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE: + src_ptr = &device->queue_on_device_preferred_size; + src_size = sizeof(device->queue_on_device_preferred_size); + break; + case CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE: + src_ptr = &device->queue_on_device_max_size; + src_size = sizeof(device->queue_on_device_max_size); + break; + case CL_DEVICE_MAX_ON_DEVICE_QUEUES: + src_ptr = &device->max_on_device_queues; + src_size = sizeof(device->max_on_device_queues); + break; + case CL_DEVICE_MAX_ON_DEVICE_EVENTS: + src_ptr = &device->max_on_device_events; + src_size = sizeof(device->max_on_device_events); + break; + case CL_DEVICE_PLATFORM: + src_ptr = &device->platform; + src_size = sizeof(device->platform); + break; + case CL_DEVICE_PRINTF_BUFFER_SIZE: + src_ptr = &device->printf_buffer_size; + src_size = sizeof(device->printf_buffer_size); + break; + case CL_DEVICE_PREFERRED_INTEROP_USER_SYNC: + src_ptr = &device->interop_user_sync; + src_size = sizeof(device->interop_user_sync); + break; + case CL_DEVICE_NAME: + src_ptr = device->name; + src_size = device->name_sz; + break; + case CL_DEVICE_VENDOR: + src_ptr = device->vendor; + src_size = device->vendor_sz; + break; + case CL_DEVICE_VERSION: + src_ptr = device->version; + src_size = device->version_sz; + break; + case CL_DEVICE_PROFILE: + src_ptr = device->profile; + src_size = device->profile_sz; + break; + case CL_DEVICE_OPENCL_C_VERSION: + src_ptr = device->opencl_c_version; + src_size = device->opencl_c_version_sz; + break; + case CL_DEVICE_SPIR_VERSIONS: + src_ptr = device->spir_versions; + src_size = device->spir_versions_sz; + break; + case CL_DEVICE_EXTENSIONS: + src_ptr = device->extensions; + src_size = device->extensions_sz; + break; + case CL_DEVICE_BUILT_IN_KERNELS: + src_ptr = device->built_in_kernels; + src_size = device->built_in_kernels_sz; + break; + case CL_DEVICE_PARENT_DEVICE: + src_ptr = &device->parent_device; + src_size = sizeof(device->parent_device); + break; + case CL_DEVICE_PARTITION_MAX_SUB_DEVICES: + src_ptr = &device->partition_max_sub_device; + src_size = sizeof(device->partition_max_sub_device); + break; + case CL_DEVICE_PARTITION_PROPERTIES: + src_ptr = &device->partition_property; + src_size = sizeof(device->partition_property); + break; + case CL_DEVICE_PARTITION_AFFINITY_DOMAIN: + src_ptr = &device->affinity_domain; + src_size = sizeof(device->affinity_domain); + break; + case CL_DEVICE_PARTITION_TYPE: + src_ptr = &device->partition_type; + src_size = sizeof(device->partition_type); + break; + case CL_DEVICE_SVM_ATOMICS: + src_ptr = &device->svm_capabilities; + src_size = sizeof(device->svm_capabilities); + break; + case CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT: + src_ptr = &device->preferred_platform_atomic_alignment; + src_size = sizeof(device->preferred_platform_atomic_alignment); + break; + case CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT: + src_ptr = &device->preferred_global_atomic_alignment; + src_size = sizeof(device->preferred_global_atomic_alignment); + break; + case CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT: + src_ptr = &device->preferred_local_atomic_alignment; + src_size = sizeof(device->preferred_local_atomic_alignment); + break; + case CL_DEVICE_IMAGE_PITCH_ALIGNMENT: + src_ptr = &device->image_pitch_alignment; + src_size = sizeof(device->image_pitch_alignment); + break; + case CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT: + src_ptr = &device->image_base_address_alignment; + src_size = sizeof(device->image_base_address_alignment); + break; case CL_DEVICE_REFERENCE_COUNT: - { - cl_uint dev_ref = CL_OBJECT_GET_REF(device); - if (param_value_size_ret) { - *param_value_size_ret = sizeof(cl_uint); - if (!param_value) - return CL_SUCCESS; + { + cl_int dev_ref = CL_OBJECT_GET_REF(device); + src_ptr = &dev_ref; + src_size = sizeof(cl_int); + break; } - if (param_value_size < sizeof(cl_uint)) - return CL_INVALID_VALUE; - memcpy(param_value, &dev_ref, sizeof(cl_uint)); - return CL_SUCCESS; - } - case CL_DRIVER_VERSION: - if (param_value_size_ret) { - *param_value_size_ret = device->driver_version_sz; - if (!param_value) - return CL_SUCCESS; - } - if (param_value_size < device->driver_version_sz) - return CL_INVALID_VALUE; - memcpy(param_value, device->driver_version, device->driver_version_sz); - return CL_SUCCESS; + src_ptr = device->driver_version; + src_size = device->driver_version_sz; + break; - default: return CL_INVALID_VALUE; - }; + default: + return CL_INVALID_VALUE; + } + + return cl_get_info_helper(src_ptr, src_size, + param_value, param_value_size, param_value_size_ret); } LOCAL cl_int diff --git a/src/cl_device_id.h b/src/cl_device_id.h index 69aeeac..19e367b 100644 --- a/src/cl_device_id.h +++ b/src/cl_device_id.h @@ -76,7 +76,7 @@ struct _cl_device_id { cl_uint min_data_type_align_size; cl_uint max_pipe_args; cl_uint pipe_max_active_reservations; - cl_uint pipe_max_packet_siz; + cl_uint pipe_max_packet_size; cl_device_fp_config single_fp_config; cl_device_fp_config half_fp_config; cl_device_fp_config double_fp_config; diff --git a/src/cl_gt_device.h b/src/cl_gt_device.h index cf5ad7a..5457537 100644 --- a/src/cl_gt_device.h +++ b/src/cl_gt_device.h @@ -64,7 +64,7 @@ .min_data_type_align_size = sizeof(cl_long) * 16, .max_pipe_args = 16, .pipe_max_active_reservations = 1, -.pipe_max_packet_siz = 1024, +.pipe_max_packet_size = 1024, .double_fp_config = 0, .global_mem_cache_type = CL_READ_WRITE_CACHE, .max_constant_buffer_size = 128 * 1024 * 1024, diff --git a/src/cl_platform_id.c b/src/cl_platform_id.c index 400f6f7..1f21f5d 100644 --- a/src/cl_platform_id.c +++ b/src/cl_platform_id.c @@ -69,54 +69,3 @@ cl_get_platform_ids(cl_uint num_entries, return CL_SUCCESS; } - -#define DECL_FIELD(CASE,FIELD) \ - case JOIN(CL_,CASE): \ - if (param_value_size < cl_get_platform_default()->JOIN(FIELD,_sz)) \ - return CL_INVALID_VALUE; \ - if (param_value_size_ret != NULL) \ - *param_value_size_ret = cl_get_platform_default()->JOIN(FIELD,_sz); \ - memcpy(param_value, \ - cl_get_platform_default()->FIELD, \ - cl_get_platform_default()->JOIN(FIELD,_sz)); \ - return CL_SUCCESS; - -#define GET_FIELD_SZ(CASE,FIELD) \ - case JOIN(CL_,CASE): \ - if (param_value_size_ret != NULL) \ - *param_value_size_ret = cl_get_platform_default()->JOIN(FIELD,_sz); \ - return CL_SUCCESS; - -LOCAL cl_int -cl_get_platform_info(cl_platform_id platform, - cl_platform_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret) -{ - if (param_value == NULL) { - switch (param_name) { - GET_FIELD_SZ (PLATFORM_PROFILE, profile); - GET_FIELD_SZ (PLATFORM_VERSION, version); - GET_FIELD_SZ (PLATFORM_NAME, name); - GET_FIELD_SZ (PLATFORM_VENDOR, vendor); - GET_FIELD_SZ (PLATFORM_EXTENSIONS, extensions); - GET_FIELD_SZ (PLATFORM_ICD_SUFFIX_KHR, icd_suffix_khr); - default: return CL_INVALID_VALUE; - } - } - - /* Fetch the platform inform */ - switch (param_name) { - DECL_FIELD (PLATFORM_PROFILE, profile); - DECL_FIELD (PLATFORM_VERSION, version); - DECL_FIELD (PLATFORM_NAME, name); - DECL_FIELD (PLATFORM_VENDOR, vendor); - DECL_FIELD (PLATFORM_EXTENSIONS, extensions); - DECL_FIELD (PLATFORM_ICD_SUFFIX_KHR, icd_suffix_khr); - default: return CL_INVALID_VALUE; - } -} - -#undef DECL_FIELD - diff --git a/src/cl_platform_id.h b/src/cl_platform_id.h index aaba624..3fdb920 100644 --- a/src/cl_platform_id.h +++ b/src/cl_platform_id.h @@ -57,13 +57,6 @@ extern cl_int cl_get_platform_ids(cl_uint num_entries, cl_platform_id * platforms, cl_uint * num_platforms); -/* Return information for the current platform */ -extern cl_int cl_get_platform_info(cl_platform_id platform, - cl_platform_info param_name, - size_t param_value_size, - void * param_value, - size_t * param_value_size_ret); - #define _STR(x) #x #define _JOINT(x, y) _STR(x) "." _STR(y) #define _JOINT3(x, y, z) _STR(x) "." _STR(y) "." _STR(z) -- 2.7.4 _______________________________________________ Beignet mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/beignet
