diff options
-rw-r--r-- | backend/src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | backend/src/driver/cl_gen_command_queue.cpp | 2 | ||||
-rw-r--r-- | backend/src/driver/cl_gen_context.cpp | 3 | ||||
-rw-r--r-- | backend/src/driver/cl_gen_driver.h | 7 | ||||
-rw-r--r-- | backend/src/driver/cl_gen_mem.cpp | 30 | ||||
-rw-r--r-- | backend/src/driver/cl_gen_program.cpp | 6 | ||||
-rw-r--r-- | include/cl_driver.h | 11 | ||||
-rw-r--r-- | libclapi/cl_command_queue.c | 2 | ||||
-rw-r--r-- | libclapi/cl_context.c | 2 | ||||
-rw-r--r-- | libclapi/cl_mem.c | 11 | ||||
-rw-r--r-- | libclapi/cl_program.c | 2 |
11 files changed, 50 insertions, 27 deletions
diff --git a/backend/src/CMakeLists.txt b/backend/src/CMakeLists.txt index 7926a84b..779e5624 100644 --- a/backend/src/CMakeLists.txt +++ b/backend/src/CMakeLists.txt @@ -146,6 +146,7 @@ set (GBE_SRC driver/cl_gen_batchbuffer.cpp driver/cl_gen_program.cpp driver/cl_gen_kernel.cpp + driver/cl_gen_mem.cpp ) if (X11_FOUND) diff --git a/backend/src/driver/cl_gen_command_queue.cpp b/backend/src/driver/cl_gen_command_queue.cpp index e882ca0d..5b0cf938 100644 --- a/backend/src/driver/cl_gen_command_queue.cpp +++ b/backend/src/driver/cl_gen_command_queue.cpp @@ -178,7 +178,7 @@ GenGPUCommandQueue::~GenGPUCommandQueue(void) } extern "C" -cl_int GenCreateCommandQueue(cl_command_queue queue, const cl_command_queue_properties properties) +cl_int GenCreateCommandQueue(cl_command_queue queue) { cl_context ctx = queue->ctx; cl_device_id device = queue->device; diff --git a/backend/src/driver/cl_gen_context.cpp b/backend/src/driver/cl_gen_context.cpp index 8a9f0c7b..411fffb3 100644 --- a/backend/src/driver/cl_gen_context.cpp +++ b/backend/src/driver/cl_gen_context.cpp @@ -41,8 +41,7 @@ GenGPUContext::~GenGPUContext(void) } extern "C" -cl_int GenCreateContext(cl_context context, const cl_device_id device, - const cl_context_properties* properties) +cl_int GenCreateContext(cl_context context, const cl_device_id device) { GBE_ASSERT(getGenContextPrivate(context, device) == NULL); dri_bufmgr *bufmgr = diff --git a/backend/src/driver/cl_gen_driver.h b/backend/src/driver/cl_gen_driver.h index a2b7285b..02a58622 100644 --- a/backend/src/driver/cl_gen_driver.h +++ b/backend/src/driver/cl_gen_driver.h @@ -30,12 +30,11 @@ extern _cl_driver clgenDriver; cl_int GenDriverInit(cl_platform_id platform); cl_int GenGetDeviceIDs(cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices); -cl_int GenCreateContext(cl_context context, const cl_device_id device, - const cl_context_properties* properties); +cl_int GenCreateContext(cl_context context, const cl_device_id device); cl_int GenReleaseContext(cl_context context, const cl_device_id device); -cl_int GenCreateCommandQueue(cl_command_queue queue, const cl_command_queue_properties properties); +cl_int GenCreateCommandQueue(cl_command_queue queue); cl_int GenReleaseCommandQueue(cl_command_queue queue); -cl_int GenBuildProgram(cl_program program, const cl_device_id device, const char *options); +cl_int GenBuildProgram(cl_program program, const cl_device_id device); cl_int GenGetProgramKernelNames(cl_program program, const cl_device_id device, char *names, cl_uint name_sz, cl_uint* ret_sz, cl_uint* ker_num); cl_int GenReleaseProgram(cl_program program, const cl_device_id device); diff --git a/backend/src/driver/cl_gen_mem.cpp b/backend/src/driver/cl_gen_mem.cpp new file mode 100644 index 00000000..1b4ffb73 --- /dev/null +++ b/backend/src/driver/cl_gen_mem.cpp @@ -0,0 +1,30 @@ +/* + * 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/>. + * + */ + +#ifdef __cplusplus +extern "C" { // for the C header files +#endif /* __cplusplus */ +#include "cl_gen_driver.h" +#include "cl_mem.h" +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#include "cl_gen_driver.hpp" +#include "sys/assert.hpp" +#include "sys/alloc.hpp" + diff --git a/backend/src/driver/cl_gen_program.cpp b/backend/src/driver/cl_gen_program.cpp index cd4c81d3..1da69cd3 100644 --- a/backend/src/driver/cl_gen_program.cpp +++ b/backend/src/driver/cl_gen_program.cpp @@ -33,7 +33,7 @@ extern "C" { // for the C header files using namespace gbe; extern "C" -cl_int GenBuildProgram(cl_program program, const cl_device_id device, const char *options) +cl_int GenBuildProgram(cl_program program, const cl_device_id device) { GBE_ASSERT(getGenProgramPrivate(program, device) == NULL); @@ -41,8 +41,8 @@ cl_int GenBuildProgram(cl_program program, const cl_device_id device, const char int device_id = (reinterpret_cast<GenGPUDevice*>(getGenDevicePrivate(device)))->device_id; GBE_ASSERT(index >= 0); - Program* p = ProgramNewFromSource(device_id, program->source, CL_BUILD_LOG_MAX_SZ, - options, program->build_log[index], &program->build_log_sz[index]); + Program* p = ProgramNewFromSource(device_id, program->source, CL_BUILD_LOG_MAX_SZ, program->build_opts, + program->build_log[index], &program->build_log_sz[index]); if (p == NULL) { return CL_BUILD_PROGRAM_FAILURE; } diff --git a/include/cl_driver.h b/include/cl_driver.h index 71df18c5..649c2140 100644 --- a/include/cl_driver.h +++ b/include/cl_driver.h @@ -41,11 +41,11 @@ typedef struct _cl_driver { cl_int (*deinit)(void); cl_int (*get_device_ids)(cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices); - cl_int (*create_context)(cl_context context, const cl_device_id device, const cl_context_properties* properties); + cl_int (*create_context)(cl_context context, const cl_device_id device); cl_int (*release_context)(cl_context context, const cl_device_id device); - cl_int (*create_command_queue)(cl_command_queue queue, const cl_command_queue_properties properties); + cl_int (*create_command_queue)(cl_command_queue queue); cl_int (*release_command_queue)(cl_command_queue queue); - cl_int (*build_program)(cl_program program, const cl_device_id device, const char *options); + cl_int (*build_program)(cl_program program, const cl_device_id device); cl_int (*release_program)(cl_program program, const cl_device_id device); cl_int (*get_program_kernel_names)(cl_program program, const cl_device_id device, char *names, cl_uint name_sz, cl_uint* ret_sz, cl_uint* ker_num); @@ -59,6 +59,8 @@ typedef struct _cl_driver { cl_int (*get_arg_info)(cl_kernel kernel, const cl_device_id device, cl_uint index, size_t* size, cl_kernel_arg_type *type, cl_kernel_arg_address_qualifier *qualifier, cl_kernel_arg_access_qualifier *access, cl_kernel_arg_type_qualifier *type_qualifier); + cl_int (*create_buffer)(cl_mem mem, const cl_device_id device, cl_mem_flags flags, size_t size, void *host_ptr); + cl_int (*release_mem)(cl_mem mem, const cl_device_id device); @@ -82,14 +84,11 @@ typedef struct _cl_driver { cl_addressing_mode addressing, cl_filter_mode filter); cl_int (*release_sampler)(cl_sampler sampler, const cl_device_id device); - cl_int (*create_buffer)(cl_mem mem, const cl_device_id device, cl_context context, - cl_mem_flags flags, size_t size, void *host_ptr); cl_int (*create_subbuffer)(cl_mem subbuffer, const cl_device_id device, cl_mem buffer, cl_mem_flags flags, cl_buffer_create_type buffer_create_type, const void *buffer_create_info); cl_int (*create_image)(cl_mem image, const cl_device_id device, cl_context context, cl_mem_flags flags, const cl_image_format *image_format, const cl_image_desc *image_desc, void *host_ptr); - cl_int (*release_mem)(cl_mem mem, const cl_device_id device); } _cl_driver; typedef struct _cl_driver* cl_driver; diff --git a/libclapi/cl_command_queue.c b/libclapi/cl_command_queue.c index 9cd507f9..f8604947 100644 --- a/libclapi/cl_command_queue.c +++ b/libclapi/cl_command_queue.c @@ -108,7 +108,7 @@ static cl_command_queue cl_create_command_queue(cl_context ctx, cl_device_id dev goto exit; } - err = queue->device->driver->create_command_queue(queue, properties); + err = queue->device->driver->create_command_queue(queue); if (err != CL_SUCCESS) { cl_command_queue_delete(queue); queue = NULL; diff --git a/libclapi/cl_context.c b/libclapi/cl_context.c index 04aec88d..83b6b312 100644 --- a/libclapi/cl_context.c +++ b/libclapi/cl_context.c @@ -228,7 +228,7 @@ static cl_context cl_create_context(const cl_context_properties *properties, cl_ } for (i = 0; i < num_devices; i++) { - err = ctx->devices[i]->driver->create_context(ctx, ctx->devices[i], properties); + err = ctx->devices[i]->driver->create_context(ctx, ctx->devices[i]); if (err != CL_SUCCESS) break; } diff --git a/libclapi/cl_mem.c b/libclapi/cl_mem.c index 97688162..17c41781 100644 --- a/libclapi/cl_mem.c +++ b/libclapi/cl_mem.c @@ -279,12 +279,8 @@ static cl_mem cl_mem_create_buffer(cl_context ctx, cl_mem_flags flags, size_t sz } /* This flag is valid only if host_ptr is not NULL */ - if (UNLIKELY((((flags & CL_MEM_COPY_HOST_PTR) || - (flags & CL_MEM_USE_HOST_PTR)) && - data == NULL)) - || (!(flags & (CL_MEM_COPY_HOST_PTR - |CL_MEM_USE_HOST_PTR)) - && (data != NULL))) { + if (UNLIKELY((((flags & CL_MEM_COPY_HOST_PTR) || (flags & CL_MEM_USE_HOST_PTR)) && data == NULL)) + || (!(flags & (CL_MEM_COPY_HOST_PTR |CL_MEM_USE_HOST_PTR)) && (data != NULL))) { err = CL_INVALID_HOST_PTR; goto error; } @@ -315,8 +311,7 @@ static cl_mem cl_mem_create_buffer(cl_context ctx, cl_mem_flags flags, size_t sz mem->host_ptr = data; for (i = 0; i < ctx->device_num; i++) { - err = ctx->devices[i]->driver->create_buffer(mem, - ctx->devices[i], ctx, flags, sz, data); + err = ctx->devices[i]->driver->create_buffer(mem, ctx->devices[i], flags, sz, data); if (err != CL_SUCCESS) goto error; } diff --git a/libclapi/cl_program.c b/libclapi/cl_program.c index 9797b0cd..ac49fcff 100644 --- a/libclapi/cl_program.c +++ b/libclapi/cl_program.c @@ -453,7 +453,7 @@ static cl_int cl_program_build(cl_program p, const char *options, for (i = 0; i < num_devices; i++) { index = cl_context_get_device_index(p->ctx, device_list[i]); - err = device_list[i]->driver->build_program(p, device_list[i], options); + err = device_list[i]->driver->build_program(p, device_list[i]); if (err != CL_SUCCESS) { goto error; } else { |