[Beignet] [PATCH 3/6 newRT] Fix two bugs in gen kernel.
junyan.he at inbox.com
junyan.he at inbox.com
Tue Mar 28 08:25:34 UTC 2017
From: Junyan He <junyan.he at intel.com>
Signed-off-by: Junyan He <junyan.he at intel.com>
---
src/gen/cl_kernel_gen.c | 2 +-
src/gen/cl_program_gen.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/gen/cl_kernel_gen.c b/src/gen/cl_kernel_gen.c
index 78ce6b8..4e85c1d 100644
--- a/src/gen/cl_kernel_gen.c
+++ b/src/gen/cl_kernel_gen.c
@@ -301,7 +301,7 @@ cl_program_gen_get_kernel_func_cl_info(cl_device_id device, cl_kernel kernel)
}
arg_type_qualifier = 0;
- if (strstr(arg_type_qual_str, "const") && (kernel->args[i].arg_type == ArgTypePointer))
+ if (strstr(arg_type_qual_str, "const"))
arg_type_qualifier = arg_type_qualifier | CL_KERNEL_ARG_TYPE_CONST;
if (strstr(arg_type_qual_str, "volatile"))
arg_type_qualifier = arg_type_qualifier | CL_KERNEL_ARG_TYPE_VOLATILE;
diff --git a/src/gen/cl_program_gen.c b/src/gen/cl_program_gen.c
index 561c7e0..3c0b796 100644
--- a/src/gen/cl_program_gen.c
+++ b/src/gen/cl_program_gen.c
@@ -19,13 +19,14 @@
#include "cl_gen.h"
struct binary_type_header_info {
- unsigned char header[4];
+ unsigned char header[7];
cl_uint size;
cl_uint type;
};
static struct binary_type_header_info binary_type_header[4] = {
{{'B', 'C', 0xC0, 0xDE}, 4, CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT},
+ {{'L', 'I', 'B', 'B', 'C', 0xC0, 0xDE}, 7, CL_PROGRAM_BINARY_TYPE_LIBRARY},
{{0x7f, 'E', 'L', 'F'}, 4, CL_PROGRAM_BINARY_TYPE_EXECUTABLE}};
static cl_int
@@ -270,6 +271,7 @@ cl_program_load_binary_gen_elf(cl_device_id device, cl_program prog)
strlen(p_sym_entry->st_name + elf->strtab_data->d_buf) + 1);
j++;
}
+ assert(j == pd->kernel_num);
return CL_SUCCESS;
}
@@ -286,7 +288,7 @@ cl_program_load_binary_gen(cl_device_id device, cl_program prog)
assert(pd->binary != NULL);
//need at least bytes to check the binary type.
- if (pd->binary_sz < 5)
+ if (pd->binary_sz < 7)
return CL_INVALID_PROGRAM_EXECUTABLE;
if (pd->binary_type == CL_PROGRAM_BINARY_TYPE_NONE) { // Need to recognize it first
--
2.7.4
More information about the Beignet
mailing list