[Beignet] [PATCH] fix enqueue_built_in_kernels bug.
xionghu.luo at intel.com
xionghu.luo at intel.com
Tue Jun 24 14:11:54 PDT 2014
From: Luo <xionghu.luo at intel.com>
need asign the length to a local variable.
Signed-off-by: Luo <xionghu.luo at intel.com>
---
src/cl_gt_device.h | 1 +
src/cl_program.c | 8 +++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/cl_gt_device.h b/src/cl_gt_device.h
index d7855cd..63c9047 100644
--- a/src/cl_gt_device.h
+++ b/src/cl_gt_device.h
@@ -87,6 +87,7 @@ DECL_INFO_STRING(built_in_kernels, "__cl_copy_region_align4;"
"__cl_copy_region_unalign_dst_offset;"
"__cl_copy_region_unalign_src_offset;"
"__cl_copy_buffer_rect;"
+ "__cl_copy_image_1d_to_1d;"
"__cl_copy_image_2d_to_2d;"
"__cl_copy_image_3d_to_2d;"
"__cl_copy_image_2d_to_3d;"
diff --git a/src/cl_program.c b/src/cl_program.c
index 7888a8f..13867e0 100644
--- a/src/cl_program.c
+++ b/src/cl_program.c
@@ -213,12 +213,14 @@ cl_program_create_from_binary(cl_context ctx,
goto error;
}
+ int length = (int)lengths[0];
+
program = cl_program_new(ctx);
// TODO: Need to check the binary format here to return CL_INVALID_BINARY.
- TRY_ALLOC(program->binary, cl_calloc(lengths[0], sizeof(char)));
- memcpy(program->binary, binaries[0], lengths[0]);
- program->binary_sz = lengths[0];
+ TRY_ALLOC(program->binary, cl_calloc(length, sizeof(char)));
+ memcpy(program->binary, binaries[0], length);
+ program->binary_sz = length;
program->source_type = FROM_BINARY;
if(isBitcode((unsigned char*)program->binary+1, (unsigned char*)program->binary+program->binary_sz)) {
--
1.8.1.2
More information about the Beignet
mailing list