1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-08 22:08:02 +00:00

Do not perform bfi int patching for opencl1.2 or later.

This commit is contained in:
Con Kolivas 2013-10-12 16:54:39 +11:00
parent 84f642f563
commit 578fabe07c
2 changed files with 21 additions and 14 deletions

34
ocl.c
View File

@ -342,6 +342,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
/* Check for OpenCL >= 1.0 support, needed for global offset parameter usage. */ /* Check for OpenCL >= 1.0 support, needed for global offset parameter usage. */
char * devoclver = malloc(1024); char * devoclver = malloc(1024);
const char * ocl10 = "OpenCL 1.0"; const char * ocl10 = "OpenCL 1.0";
const char * ocl11 = "OpenCL 1.1";
status = clGetDeviceInfo(devices[gpu], CL_DEVICE_VERSION, 1024, (void *)devoclver, NULL); status = clGetDeviceInfo(devices[gpu], CL_DEVICE_VERSION, 1024, (void *)devoclver, NULL);
if (status != CL_SUCCESS) { if (status != CL_SUCCESS) {
@ -349,8 +350,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
return NULL; return NULL;
} }
find = strstr(devoclver, ocl10); find = strstr(devoclver, ocl10);
if (!find) if (!find) {
clState->hasOpenCL11plus = true; clState->hasOpenCL11plus = true;
find = strstr(devoclver, ocl11);
if (!find)
clState->hasOpenCL12plus = true;
}
status = clGetDeviceInfo(devices[gpu], CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, sizeof(cl_uint), (void *)&preferred_vwidth, NULL); status = clGetDeviceInfo(devices[gpu], CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, sizeof(cl_uint), (void *)&preferred_vwidth, NULL);
if (status != CL_SUCCESS) { if (status != CL_SUCCESS) {
@ -618,19 +623,20 @@ build:
if (clState->hasBitAlign) { if (clState->hasBitAlign) {
strcat(CompilerOptions, " -D BITALIGN"); strcat(CompilerOptions, " -D BITALIGN");
applog(LOG_DEBUG, "cl_amd_media_ops found, setting BITALIGN"); applog(LOG_DEBUG, "cl_amd_media_ops found, setting BITALIGN");
if (strstr(name, "Cedar") || if (!clState->hasOpenCL12plus &&
strstr(name, "Redwood") || (strstr(name, "Cedar") ||
strstr(name, "Juniper") || strstr(name, "Redwood") ||
strstr(name, "Cypress" ) || strstr(name, "Juniper") ||
strstr(name, "Hemlock" ) || strstr(name, "Cypress" ) ||
strstr(name, "Caicos" ) || strstr(name, "Hemlock" ) ||
strstr(name, "Turks" ) || strstr(name, "Caicos" ) ||
strstr(name, "Barts" ) || strstr(name, "Turks" ) ||
strstr(name, "Cayman" ) || strstr(name, "Barts" ) ||
strstr(name, "Antilles" ) || strstr(name, "Cayman" ) ||
strstr(name, "Wrestler" ) || strstr(name, "Antilles" ) ||
strstr(name, "Zacate" ) || strstr(name, "Wrestler" ) ||
strstr(name, "WinterPark" )) strstr(name, "Zacate" ) ||
strstr(name, "WinterPark" )))
patchbfi = true; patchbfi = true;
} else } else
applog(LOG_DEBUG, "cl_amd_media_ops not found, will not set BITALIGN"); applog(LOG_DEBUG, "cl_amd_media_ops not found, will not set BITALIGN");

1
ocl.h
View File

@ -27,6 +27,7 @@ typedef struct {
#endif #endif
bool hasBitAlign; bool hasBitAlign;
bool hasOpenCL11plus; bool hasOpenCL11plus;
bool hasOpenCL12plus;
bool goffset; bool goffset;
cl_uint vwidth; cl_uint vwidth;
size_t max_work_size; size_t max_work_size;