opencl: do not use `clCreateBufferWithProperties` when targeting CL 2.x (llama/25673)
This commit is contained in:
parent
ff6847f45e
commit
a46de2e627
|
|
@ -10525,10 +10525,16 @@ static ggml_backend_buffer_t ggml_backend_opencl_buffer_type_alloc_buffer(ggml_b
|
||||||
|
|
||||||
cl_int err;
|
cl_int err;
|
||||||
cl_mem mem = clCreateBuffer(backend_ctx->context, CL_MEM_READ_WRITE, size, NULL, &err);
|
cl_mem mem = clCreateBuffer(backend_ctx->context, CL_MEM_READ_WRITE, size, NULL, &err);
|
||||||
|
#if GGML_OPENCL_TARGET_VERSION >= 300
|
||||||
|
// clCreateBufferWithProperties and cl_mem_properties are OpenCL 3.0. Drivers older than
|
||||||
|
// that do not export the symbol, so a build targeting them fails to link. The large
|
||||||
|
// buffer extension is only ever enabled on drivers that are well past 3.0, so this path
|
||||||
|
// is dead there anyway.
|
||||||
if (err != CL_SUCCESS && backend_ctx->adreno_use_large_buffer) {
|
if (err != CL_SUCCESS && backend_ctx->adreno_use_large_buffer) {
|
||||||
cl_mem_properties props[] = { 0x41A6 /* CL_LARGE_BUFFER_QCOM */, 1, 0 };
|
cl_mem_properties props[] = { 0x41A6 /* CL_LARGE_BUFFER_QCOM */, 1, 0 };
|
||||||
mem = clCreateBufferWithProperties(backend_ctx->context, props, CL_MEM_READ_WRITE, size, NULL, &err);
|
mem = clCreateBufferWithProperties(backend_ctx->context, props, CL_MEM_READ_WRITE, size, NULL, &err);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (err != CL_SUCCESS) {
|
if (err != CL_SUCCESS) {
|
||||||
GGML_LOG_INFO("%s: failed to allocate %.2f MiB\n", __func__, size / 1024.0 / 1024.0);
|
GGML_LOG_INFO("%s: failed to allocate %.2f MiB\n", __func__, size / 1024.0 / 1024.0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue