Ensure ext_buffer is null terminated
This commit is contained in:
parent
6c5c79a2a3
commit
a4e5f65659
1 changed files with 2 additions and 1 deletions
|
@ -469,8 +469,9 @@ void ggml_cl_init(void) {
|
|||
|
||||
size_t ext_str_size;
|
||||
clGetDeviceInfo(device, CL_DEVICE_EXTENSIONS, 0, NULL, &ext_str_size);
|
||||
char *ext_buffer = (char *)alloca(ext_str_size);
|
||||
char *ext_buffer = (char *)alloca(ext_str_size + 1);
|
||||
clGetDeviceInfo(device, CL_DEVICE_EXTENSIONS, ext_str_size, ext_buffer, NULL);
|
||||
ext_buffer[ext_str_size] = '\0'; // ensure it is null terminated
|
||||
// Check if ext_buffer contains cl_khr_fp16
|
||||
fp16_support = strstr(ext_buffer, "cl_khr_fp16") != NULL;
|
||||
fprintf(stderr, "ggml_opencl: device FP16 support: %s\n", fp16_support ? "true" : "false");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue