Skip to content

Commit 12127de

Browse files
authored
opencl: do not use clCreateBufferWithProperties when targeting CL 2.x (ggml-org#25673)
1 parent 00fa7cb commit 12127de

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ggml/src/ggml-opencl/ggml-opencl.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10525,10 +10525,16 @@ static ggml_backend_buffer_t ggml_backend_opencl_buffer_type_alloc_buffer(ggml_b
1052510525

1052610526
cl_int err;
1052710527
cl_mem mem = clCreateBuffer(backend_ctx->context, CL_MEM_READ_WRITE, size, NULL, &err);
10528+
#if GGML_OPENCL_TARGET_VERSION >= 300
10529+
// clCreateBufferWithProperties and cl_mem_properties are OpenCL 3.0. Drivers older than
10530+
// that do not export the symbol, so a build targeting them fails to link. The large
10531+
// buffer extension is only ever enabled on drivers that are well past 3.0, so this path
10532+
// is dead there anyway.
1052810533
if (err != CL_SUCCESS && backend_ctx->adreno_use_large_buffer) {
1052910534
cl_mem_properties props[] = { 0x41A6 /* CL_LARGE_BUFFER_QCOM */, 1, 0 };
1053010535
mem = clCreateBufferWithProperties(backend_ctx->context, props, CL_MEM_READ_WRITE, size, NULL, &err);
1053110536
}
10537+
#endif
1053210538

1053310539
if (err != CL_SUCCESS) {
1053410540
GGML_LOG_INFO("%s: failed to allocate %.2f MiB\n", __func__, size / 1024.0 / 1024.0);

0 commit comments

Comments
 (0)