summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang, Rong R <rong.r.yang@intel.com>2017-06-20 19:07:47 +0800
committerYang Rong <rong.r.yang@intel.com>2017-07-10 17:21:37 +0800
commit4933bf9212c9721ca2b0e615097ed2b53fec51c3 (patch)
treec4633a50c9b6d382a3dccce8a28d82e48e95af5a
parent446132d40099c16135a63f52cb228dc417d3b858 (diff)
Runtime: remove ctx's useless fileds.
built_in_prgs and built_in_kernels seems useless, remove them. Signed-off-by: Yang Rong <rong.r.yang@intel.com> Reviewed-by: Ruiling Song <ruiling.song@intel.com>
-rw-r--r--src/cl_context.c6
-rw-r--r--src/cl_context.h2
-rw-r--r--src/cl_program.c40
3 files changed, 5 insertions, 43 deletions
diff --git a/src/cl_context.c b/src/cl_context.c
index f3dd4219..798419aa 100644
--- a/src/cl_context.c
+++ b/src/cl_context.c
@@ -396,12 +396,6 @@ cl_context_delete(cl_context ctx)
ctx->internal_prgs[i] = NULL;
cl_program_delete(p);
}
-
- if (ctx->built_in_kernels[i]) {
- cl_kernel k = ctx->built_in_kernels[i];
- ctx->built_in_kernels[i] = NULL;
- cl_kernel_delete(k);
- }
}
CL_OBJECT_DEC_REF(ctx);
diff --git a/src/cl_context.h b/src/cl_context.h
index 3a2e13be..36db04fb 100644
--- a/src/cl_context.h
+++ b/src/cl_context.h
@@ -126,8 +126,6 @@ struct _cl_context {
/* All programs internal used, for example clEnqueuexxx api use */
cl_kernel internal_kernels[CL_INTERNAL_KERNEL_MAX];
/* All kernels for clenqueuexxx api, for example clEnqueuexxx api use */
- cl_program built_in_prgs; /*all built-in kernels belongs to this program only*/
- cl_kernel built_in_kernels[CL_INTERNAL_KERNEL_MAX];
uint32_t ver; /* Gen version */
struct _cl_context_prop props;
cl_context_properties * prop_user; /* a copy of user passed context properties when create context */
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;