From ed7210af6ca4c0a1959ecd54ba5648a5e7f13fa4 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Thu, 9 Feb 2012 15:15:03 +0100 Subject: [PATCH] added OpenCL >= 1.1 detection code, in preparation of OpenCL 1.1 global offset parameter support --- ocl.c | 13 +++++++++++++ ocl.h | 1 + 2 files changed, 14 insertions(+) diff --git a/ocl.c b/ocl.c index 53115576..e0aafb11 100644 --- a/ocl.c +++ b/ocl.c @@ -302,6 +302,19 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) find = strstr(extensions, camo); if (find) clState->hasBitAlign = true; + + /* Check for OpenCL >= 1.0 support, needed for global offset parameter usage. */ + char * devoclver = malloc(1024); + const char * ocl10 = "OpenCL 1.0"; + + status = clGetDeviceInfo(devices[gpu], CL_DEVICE_VERSION, 1024, (void *)devoclver, NULL); + if (status != CL_SUCCESS) { + applog(LOG_ERR, "Error: Failed to clGetDeviceInfo when trying to get CL_DEVICE_VERSION"); + return NULL; + } + find = strstr(devoclver, ocl10); + if !(find) + clState->hasOpenCL11plus = true; status = clGetDeviceInfo(devices[gpu], CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, sizeof(cl_uint), (void *)&clState->preferred_vwidth, NULL); if (status != CL_SUCCESS) { diff --git a/ocl.h b/ocl.h index d52bfcee..ccab8b87 100644 --- a/ocl.h +++ b/ocl.h @@ -18,6 +18,7 @@ typedef struct { cl_program program; cl_mem outputBuffer; bool hasBitAlign; + bool hasOpenCL11plus; cl_uint preferred_vwidth; size_t max_work_size; size_t work_size;