[Beignet] [PATCH] fix piglit clCreateProgramWithBinary fail.

xionghu.luo at intel.com xionghu.luo at intel.com
Sun Nov 9 22:58:40 PST 2014


From: Luo Xionghu <xionghu.luo at intel.com>

1. the program should be deserialized and loaded when created from a
EXECUTABLE binary.
2. passing a binary program to clCompileProgram() should return
CL_INVALID_OPERATION.

Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
 src/cl_program.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/cl_program.c b/src/cl_program.c
index 79dff34..43ab567 100644
--- a/src/cl_program.c
+++ b/src/cl_program.c
@@ -249,6 +249,14 @@ cl_program_create_from_binary(cl_context             ctx,
     program->source_type = FROM_LLVM;
   }
   else if (*program->binary == 0) {
+    program->opaque = interp_program_new_from_binary(program->ctx->device->vendor_id, program->binary, program->binary_sz);
+    if (UNLIKELY(program->opaque == NULL)) {
+      err = CL_INVALID_PROGRAM;
+      goto error;
+    }
+
+    /* Create all the kernels */
+    TRY (cl_program_load_gen_program, program);
     program->binary_type = CL_PROGRAM_BINARY_TYPE_EXECUTABLE;
   }
 
@@ -739,7 +747,11 @@ cl_program_compile(cl_program            p,
     /* Create all the kernels */
     p->source_type = FROM_LLVM;
     p->binary_type = CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT;
+  }else if(p->source_type == FROM_BINARY){
+    err = CL_INVALID_OPERATION;
+    return err;
   }
+
   p->is_built = 1;
   p->build_status = CL_BUILD_SUCCESS;
   return CL_SUCCESS;
-- 
1.7.9.5



More information about the Beignet mailing list