summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYang, Rong R <rong.r.yang@intel.com>2017-07-20 13:40:13 +0800
committerYang Rong <rong.r.yang@intel.com>2017-07-27 16:19:37 +0800
commitad63a53e5f77eb2a09e0e72cbee60298d6ff4d02 (patch)
tree9d0cca7632f3808bf26cd29f548cf2e4cb1747c4 /src
parent705e73c7873e11a14fcc308fafd1c26bc188021f (diff)
Runtime: fix the context ref is not 0 assert when delete.
The CL_ENQUEUE_FILL_BUFFER_ALIGN8_* internal program is the same program, only add the program's ref once, but when delete context, caculate the internal program count, will add them individually. This mismatch will cause the context be free by mistake. New different CL_ENQUEUE_FILL_BUFFER_ALIGN8_* program for clearly. Signed-off-by: Yang Rong <rong.r.yang@intel.com> Reviewed-by: Ruiling Song <ruiling.song@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/cl_context.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/cl_context.c b/src/cl_context.c
index 798419aa..d58bf430 100644
--- a/src/cl_context.c
+++ b/src/cl_context.c
@@ -445,32 +445,18 @@ cl_context_get_static_kernel_from_bin(cl_context ctx, cl_int index,
ctx->internal_prgs[index]->is_built = 1;
- /* All CL_ENQUEUE_FILL_BUFFER_ALIGN16_xxx use the same program, different kernel. */
- if (index >= CL_ENQUEUE_FILL_BUFFER_ALIGN8_8 && index <= CL_ENQUEUE_FILL_BUFFER_ALIGN8_64) {
- int i = CL_ENQUEUE_FILL_BUFFER_ALIGN8_8;
- for (; i <= CL_ENQUEUE_FILL_BUFFER_ALIGN8_64; i++) {
- if (index != i) {
- assert(ctx->internal_prgs[i] == NULL);
- assert(ctx->internal_kernels[i] == NULL);
- cl_program_add_ref(ctx->internal_prgs[index]);
- ctx->internal_prgs[i] = ctx->internal_prgs[index];
- }
-
- if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_8) {
- ctx->internal_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
+ if (index == CL_ENQUEUE_FILL_BUFFER_ALIGN8_8) {
+ ctx->internal_kernels[index] = cl_program_create_kernel(ctx->internal_prgs[index],
"__cl_fill_region_align8_2", NULL);
- } else if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_16) {
- ctx->internal_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
+ } else if (index == CL_ENQUEUE_FILL_BUFFER_ALIGN8_16) {
+ ctx->internal_kernels[index] = cl_program_create_kernel(ctx->internal_prgs[index],
"__cl_fill_region_align8_4", NULL);
- } else if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_32) {
- ctx->internal_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
+ } else if (index == CL_ENQUEUE_FILL_BUFFER_ALIGN8_32) {
+ ctx->internal_kernels[index] = cl_program_create_kernel(ctx->internal_prgs[index],
"__cl_fill_region_align8_8", NULL);
- } else if (i == CL_ENQUEUE_FILL_BUFFER_ALIGN8_64) {
- ctx->internal_kernels[i] = cl_program_create_kernel(ctx->internal_prgs[index],
+ } else if (index == CL_ENQUEUE_FILL_BUFFER_ALIGN8_64) {
+ ctx->internal_kernels[index] = cl_program_create_kernel(ctx->internal_prgs[index],
"__cl_fill_region_align8_16", NULL);
- } else
- assert(0);
- }
} else {
ctx->internal_kernels[index] = cl_kernel_dup(ctx->internal_prgs[index]->ker[0]);
}