Browse Source

added OpenCL >= 1.1 detection code, in preparation of OpenCL 1.1 global offset parameter support

nfactor-troky
Philip Kaufmann 13 years ago committed by Con Kolivas
parent
commit
47a09ceab8
  1. 13
      ocl.c
  2. 1
      ocl.h

13
ocl.c

@ -302,6 +302,19 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -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) {

1
ocl.h

@ -18,6 +18,7 @@ typedef struct { @@ -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;

Loading…
Cancel
Save