[Beignet] [PATCH 2/2] utest: fix a link program error.
Yang Rong
rong.r.yang at intel.com
Mon Aug 21 07:00:54 UTC 2017
In function cl_kernel_link, the input program and the return program
of clReleaseProgram function should not use the same program,
otherwize, after release input program, the return program will
be invalid.
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
utests/utest_helper.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index 52d1714..685e185 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -360,7 +360,7 @@ cl_kernel_link(const char *file_name, const char *kernel_name, const char * link
file_name, kernel_name);
const char *src = cl_file_map_begin(fm);
const size_t sz = cl_file_map_size(fm);
- program = clCreateProgramWithSource(ctx, 1, &src, &sz, &status);
+ cl_program input_program = clCreateProgramWithSource(ctx, 1, &src, &sz, &status);
cl_file_map_delete(fm);
if (status != CL_SUCCESS) {
@@ -369,7 +369,7 @@ cl_kernel_link(const char *file_name, const char *kernel_name, const char * link
}
prevFileName = file_name;
- OCL_CALL (clCompileProgram, program,
+ OCL_CALL (clCompileProgram, input_program,
1, &device, // num_devices & device_list
NULL, // compile_options
0, // num_input_headers
@@ -377,7 +377,7 @@ cl_kernel_link(const char *file_name, const char *kernel_name, const char * link
NULL,
NULL, NULL);
OCL_ASSERT(status==CL_SUCCESS);
- cl_program input_programs[1] = {program};
+ cl_program input_programs[1] = {input_program};
program = clLinkProgram(ctx, 1, &device, link_opt, 1, input_programs, NULL, NULL, &status);
OCL_ASSERT(program != NULL);
OCL_ASSERT(status == CL_SUCCESS);
--
2.7.4
More information about the Beignet
mailing list