mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
added OpenCL >= 1.1 detection code, in preparation of OpenCL 1.1 global offset parameter support
This commit is contained in:
parent
6d997d4567
commit
ed7210af6c
13
ocl.c
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
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…
Reference in New Issue
Block a user