[Beignet] [PATCH] fix piglit clCreateProgramWithBinary fail.

Zhigang Gong zhigang.gong at linux.intel.com
Sun Nov 9 22:36:38 PST 2014


The patch LGTM, split it to two patches and pushed, thanks.

On Mon, Nov 10, 2014 at 02:58:40PM +0800, xionghu.luo at intel.com wrote:
> 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
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list