summaryrefslogtreecommitdiff
path: root/src/cl_program.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cl_program.c')
-rw-r--r--src/cl_program.c40
1 files changed, 5 insertions, 35 deletions
diff --git a/src/cl_program.c b/src/cl_program.c
index faa35725..556b041f 100644
--- a/src/cl_program.c
+++ b/src/cl_program.c
@@ -382,54 +382,24 @@ cl_program_create_with_built_in_kernles(cl_context ctx,
extern size_t cl_internal_built_in_kernel_str_size;
char* p_built_in_kernel_str =cl_internal_built_in_kernel_str;
- ctx->built_in_prgs = cl_program_create_from_binary(ctx, 1,
+ cl_program built_in_prgs = cl_program_create_from_binary(ctx, 1,
&ctx->devices[0],
(size_t*)&cl_internal_built_in_kernel_str_size,
(const unsigned char **)&p_built_in_kernel_str,
&binary_status, &err);
- if (!ctx->built_in_prgs)
+ if (!built_in_prgs)
return NULL;
- err = cl_program_build(ctx->built_in_prgs, NULL);
+ err = cl_program_build(built_in_prgs, NULL);
if (err != CL_SUCCESS)
return NULL;
- ctx->built_in_prgs->is_built = 1;
-
- char delims[] = ";";
- char* saveptr = NULL;
- char* local_kernel_names;
- char* kernel = NULL;
- char* matched_kernel;
- int i = 0;
-
- //copy the content to local_kernel_names to protect the kernel_names.
- TRY_ALLOC(local_kernel_names, cl_calloc(strlen(kernel_names)+1, sizeof(char) ) );
- memcpy(local_kernel_names, kernel_names, strlen(kernel_names)+1);
-
- kernel = strtok_r( local_kernel_names, delims , &saveptr);
- while( kernel != NULL ) {
- matched_kernel = strstr(ctx->devices[0]->built_in_kernels, kernel);
- if(matched_kernel){
- for (i = 0; i < ctx->built_in_prgs->ker_n; ++i) {
- assert(ctx->built_in_prgs->ker[i]);
- const char *ker_name = cl_kernel_get_name(ctx->built_in_prgs->ker[i]);
- if (ker_name != NULL && strcmp(ker_name, kernel) == 0) {
- break;
- }
- }
-
- ctx->built_in_kernels[i] = cl_program_create_kernel(ctx->built_in_prgs, kernel, NULL);
- }
- kernel = strtok_r((char*)saveptr , delims, &saveptr );
- }
-
- cl_free(local_kernel_names);
+ built_in_prgs->is_built = 1;
exit:
if (errcode_ret)
*errcode_ret = err;
- return ctx->built_in_prgs;
+ return built_in_prgs;
error:
goto exit;