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

@ -303,6 +303,19 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
if (find) if (find)
clState->hasBitAlign = true; 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); status = clGetDeviceInfo(devices[gpu], CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, sizeof(cl_uint), (void *)&clState->preferred_vwidth, NULL);
if (status != CL_SUCCESS) { if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Failed to clGetDeviceInfo when trying to get CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT"); applog(LOG_ERR, "Error: Failed to clGetDeviceInfo when trying to get CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT");

1
ocl.h

@ -18,6 +18,7 @@ typedef struct {
cl_program program; cl_program program;
cl_mem outputBuffer; cl_mem outputBuffer;
bool hasBitAlign; bool hasBitAlign;
bool hasOpenCL11plus;
cl_uint preferred_vwidth; cl_uint preferred_vwidth;
size_t max_work_size; size_t max_work_size;
size_t work_size; size_t work_size;

Loading…
Cancel
Save