From: Albert Jin Date: Thu, 9 May 2024 09:34:37 +0000 (+0800) Subject: opencl : alignment size converted from bits to bytes (llama/7090) X-Git-Tag: upstream/1.7.4~785 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=26c550f77287158d14f3e8b15486cec86ee8a42d;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp opencl : alignment size converted from bits to bytes (llama/7090) * opencl alignment size should be converted from bits to bytes Reference: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#CL_DEVICE_MEM_BASE_ADDR_ALIGN > Alignment requirement (in bits) for sub-buffer offsets. * Update ggml-opencl.cpp for readability using division instead of shift Co-authored-by: Jared Van Bortel --------- Co-authored-by: Jared Van Bortel --- diff --git a/ggml-opencl.cpp b/ggml-opencl.cpp index b3f8b7ea..880a1495 100644 --- a/ggml-opencl.cpp +++ b/ggml-opencl.cpp @@ -2119,6 +2119,7 @@ static size_t ggml_backend_opencl_buffer_type_get_alignment(ggml_backend_buffer_ if (alignment == (cl_uint)-1) { ggml_cl_init(); clGetDeviceInfo(device, CL_DEVICE_MEM_BASE_ADDR_ALIGN, sizeof(cl_uint), &alignment, NULL); + alignment /= 8; // bits to bytes } return alignment;