Skip to content

[ggml-openc.cpp]: fix a bug in ggml_cl_pool_malloc() for ggml_cl_mul_…#2955

Merged
ggerganov merged 1 commit intoggml-org:masterfrom
rchardx:wentai/fix_opencl_mat_mul
Sep 3, 2023
Merged

[ggml-openc.cpp]: fix a bug in ggml_cl_pool_malloc() for ggml_cl_mul_…#2955
ggerganov merged 1 commit intoggml-org:masterfrom
rchardx:wentai/fix_opencl_mat_mul

Conversation

@rchardx
Copy link
Contributor

@rchardx rchardx commented Sep 1, 2023

This is a very simple fix.
ggml_cl_pool_malloc() in previous version did not have enough space for the later ggml_cl_h2d_tensor_2d().

d_X = (cl_mem) src0->data;
} else {
d_X = ggml_cl_pool_malloc(sizeof(ggml_fp16_t) * x_ne, &x_size);
d_X = ggml_cl_pool_malloc(sizeof(float) * x_ne, &x_size);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better to choose the size based on src0 type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ggml_cl_mul_mat(), the function calls of both ggml_cl_mul_mat_f32() and ggml_cl_mul_mat_f16() indicate the src0 type as f32 or f16 already.
I think it is a coding style issue, and in this commit, there is no need to modify other parts of the code for now.

@ggerganov ggerganov merged commit 6460f75 into ggml-org:master Sep 3, 2023
@rchardx rchardx deleted the wentai/fix_opencl_mat_mul branch September 3, 2023 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants