albertjin Cebtenzzre commited on
Commit
2692ce5
·
1 Parent(s): 08fc76d

opencl : alignment size converted from bits to bytes (llama/7090)

Browse files

* 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]>

Files changed (1) hide show
  1. ggml-opencl.cpp +1 -0
ggml-opencl.cpp CHANGED
@@ -2119,6 +2119,7 @@ static size_t ggml_backend_opencl_buffer_type_get_alignment(ggml_backend_buffer_
2119
  if (alignment == (cl_uint)-1) {
2120
  ggml_cl_init();
2121
  clGetDeviceInfo(device, CL_DEVICE_MEM_BASE_ADDR_ALIGN, sizeof(cl_uint), &alignment, NULL);
 
2122
  }
2123
  return alignment;
2124
 
 
2119
  if (alignment == (cl_uint)-1) {
2120
  ggml_cl_init();
2121
  clGetDeviceInfo(device, CL_DEVICE_MEM_BASE_ADDR_ALIGN, sizeof(cl_uint), &alignment, NULL);
2122
+ alignment /= 8; // bits to bytes
2123
  }
2124
  return alignment;
2125