Skip to content

Commit 5bc6910

Browse files
fix: Add conditional compilation for OpenCL 2.0 compatibility
- Add #ifdef CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT check - Fixes compilation error when targeting OpenCL 2.0 - CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT was introduced in OpenCL 3.0 - Maintains backward compatibility with OpenCL 3.0+ devices - Resolves issue #15368
1 parent e5155e6 commit 5bc6910

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,8 +2231,13 @@ static ggml_backend_opencl_context * ggml_cl2_init(ggml_backend_dev_t dev) {
22312231
svm_caps & CL_DEVICE_SVM_ATOMICS ? "true" : "false");
22322232

22332233
if (opencl_c_version.major >= 3) {
2234+
#ifdef CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT
22342235
CL_CHECK(clGetDeviceInfo(device, CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT, sizeof(cl_bool),
22352236
&backend_ctx->non_uniform_workgroups, 0));
2237+
#else
2238+
// OpenCL 3.0+ headers not available, assume support
2239+
backend_ctx->non_uniform_workgroups = true;
2240+
#endif
22362241
} else {
22372242
GGML_ASSERT(opencl_c_version.major == 2);
22382243
// Non-uniform workgroup sizes is mandatory feature in v2.x.

0 commit comments

Comments
 (0)