Runtime: fix some piglit failures.
authorZhigang Gong <zhigang.gong@intel.com>
Thu, 21 Nov 2013 09:04:54 +0000 (17:04 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Wed, 27 Nov 2013 08:26:37 +0000 (16:26 +0800)
compiler_available should be true. And when a program is retained, we should
not call build on it again.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
src/cl_gt_device.h
src/cl_kernel.c
src/cl_kernel.h
src/cl_program.c

index d53588f..30692f8 100644 (file)
@@ -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) */
index 1869eba..803c9e5 100644 (file)
@@ -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
index 6524a69..fb509a2 100644 (file)
@@ -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 */
index b8da052..df2f1e0 100644 (file)
@@ -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) {