From 42c39bd96ca8db44e975db729028269cc8cdce22 Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Thu, 21 Nov 2013 17:04:54 +0800 Subject: [PATCH] Runtime: fix some piglit failures. compiler_available should be true. And when a program is retained, we should not call build on it again. Signed-off-by: Zhigang Gong Reviewed-by: Yang Rong --- src/cl_gt_device.h | 2 +- src/cl_kernel.c | 3 --- src/cl_kernel.h | 1 - src/cl_program.c | 3 +++ 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cl_gt_device.h b/src/cl_gt_device.h index d53588f..30692f8 100644 --- a/src/cl_gt_device.h +++ b/src/cl_gt_device.h @@ -59,7 +59,7 @@ .profiling_timer_resolution = 80, /* ns */ .endian_little = CL_TRUE, .available = CL_TRUE, -.compiler_available = CL_FALSE, /* XXX */ +.compiler_available = CL_TRUE, .execution_capabilities = CL_EXEC_KERNEL | CL_EXEC_NATIVE_KERNEL, .queue_properties = CL_QUEUE_PROFILING_ENABLE, .platform = NULL, /* == intel_platform (set when requested) */ diff --git a/src/cl_kernel.c b/src/cl_kernel.c index 1869eba..803c9e5 100644 --- a/src/cl_kernel.c +++ b/src/cl_kernel.c @@ -44,7 +44,6 @@ cl_kernel_delete(cl_kernel k) if (atomic_dec(&k->ref_n) > 1) return; /* Release one reference on all bos we own */ if (k->bo) cl_buffer_unreference(k->bo); - if (k->const_bo) cl_buffer_unreference(k->const_bo); /* This will be true for kernels created by clCreateKernel */ if (k->ref_its_program) cl_program_delete(k->program); /* Release the curbe if allocated */ @@ -256,7 +255,6 @@ cl_kernel_dup(cl_kernel from) TRY_ALLOC_NO_ERR (to, CALLOC(struct _cl_kernel)); SET_ICD(to->dispatch) to->bo = from->bo; - to->const_bo = from->const_bo; to->opaque = from->opaque; to->ref_n = 1; to->magic = CL_MAGIC_KERNEL_HEADER; @@ -279,7 +277,6 @@ cl_kernel_dup(cl_kernel from) /* Retain the bos */ if (from->bo) cl_buffer_reference(from->bo); - if (from->const_bo) cl_buffer_reference(from->const_bo); /* We retain the program destruction since this kernel (user allocated) * depends on the program for some of its pointers diff --git a/src/cl_kernel.h b/src/cl_kernel.h index 6524a69..fb509a2 100644 --- a/src/cl_kernel.h +++ b/src/cl_kernel.h @@ -47,7 +47,6 @@ struct _cl_kernel { uint64_t magic; /* To identify it as a kernel */ volatile int ref_n; /* We reference count this object */ cl_buffer bo; /* The code itself */ - cl_buffer const_bo; /* Buffer for all __constants values in the OCL program */ cl_program program; /* Owns this structure (and pointers) */ gbe_kernel opaque; /* (Opaque) compiler structure for the OCL kernel */ char *curbe; /* One curbe per kernel */ diff --git a/src/cl_program.c b/src/cl_program.c index b8da052..df2f1e0 100644 --- a/src/cl_program.c +++ b/src/cl_program.c @@ -300,6 +300,9 @@ cl_program_build(cl_program p, const char *options) int i = 0; int copyed = 0; + if (p->ref_n > 1) + return CL_INVALID_OPERATION; + if (options) { if(p->build_opts == NULL || strcmp(options, p->build_opts) != 0) { if(p->build_opts) { -- 2.7.4