diff options
author | Luo Xionghu <xionghu.luo@intel.com> | 2015-11-26 14:00:01 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2015-12-09 11:42:49 +0800 |
commit | 5c9bc99a58495039566f85bd612abc3b45d06389 (patch) | |
tree | 5759ce2f82c50f0078e9ff49569582f376fab5c4 /src | |
parent | ce989175e2aa88093da7748965cbafa086ab3305 (diff) |
runtime: fix clLinkProgram bug.
clLinkProgram need check the existence of "-cl-kernel-arg-info"
build_option of all the input_programs. User may link two SPIR
program and call clGetKernelArgInfo to query kernel args.
Signed-off-by: Luo Xionghu <xionghu.luo@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/cl_program.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cl_program.c b/src/cl_program.c index 16ab0bff..77acc132 100644 --- a/src/cl_program.c +++ b/src/cl_program.c @@ -652,6 +652,8 @@ cl_program_link(cl_context context, err = CL_INVALID_LINKER_OPTIONS; goto error; } + const char kernel_arg_option[] = "-cl-kernel-arg-info"; + cl_bool option_exist = CL_TRUE; for(i = 0; i < num_input_programs; i++) { //num_input_programs >0 and input_programs MUST not NULL, so compare with input_programs[0] directly. if(input_programs[i]->binary_type == CL_PROGRAM_BINARY_TYPE_LIBRARY || @@ -659,6 +661,9 @@ cl_program_link(cl_context context, input_programs[i]->binary_type == CL_PROGRAM_BINARY_TYPE_INTERMEDIATE) { avialable_program++; } + if(input_programs[i]->build_opts == NULL || strstr(input_programs[i]->build_opts, kernel_arg_option) == NULL ) { + option_exist = CL_FALSE; + } } //None of program contain a compilerd binary or library. @@ -678,6 +683,11 @@ cl_program_link(cl_context context, goto error; } + if(option_exist) { + TRY_ALLOC (p->build_opts, cl_calloc(strlen(kernel_arg_option) + 1, sizeof(char))); + memcpy(p->build_opts, kernel_arg_option, strlen(kernel_arg_option)); + } + if (!check_cl_version_option(p, options)) { err = CL_BUILD_PROGRAM_FAILURE; goto error; |