]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
opencl : alignment size converted from bits to bytes (llama/7090)
authorAlbert Jin <redacted>
Thu, 9 May 2024 09:34:37 +0000 (17:34 +0800)
committerGeorgi Gerganov <redacted>
Mon, 13 May 2024 08:02:26 +0000 (11:02 +0300)
* 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 <redacted>
---------

Co-authored-by: Jared Van Bortel <redacted>
ggml-opencl.cpp

index b3f8b7eaf0a3b8f7e7ebfa5389611e9b1a165cf8..880a14958cec524e11ccc91b4bc92069eb2bbf5b 100644 (file)
@@ -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;