Skip to content

Commit 4734524

Browse files
opencl : alignment size converted from bits to bytes (ggml-org#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 <[email protected]> --------- Co-authored-by: Jared Van Bortel <[email protected]>
1 parent 07cd41d commit 4734524

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ggml-opencl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,6 +2119,7 @@ static size_t ggml_backend_opencl_buffer_type_get_alignment(ggml_backend_buffer_
21192119
if (alignment == (cl_uint)-1) {
21202120
ggml_cl_init();
21212121
clGetDeviceInfo(device, CL_DEVICE_MEM_BASE_ADDR_ALIGN, sizeof(cl_uint), &alignment, NULL);
2122+
alignment /= 8; // bits to bytes
21222123
}
21232124
return alignment;
21242125

0 commit comments

Comments
 (0)