1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-09 06:18:06 +00:00

opencl: rename cgpu_info->kname to cgpu_info->kernelname.

This commit is contained in:
Noel Maersk 2014-03-17 20:39:11 +02:00
parent 4ea508850e
commit 87801c2578
5 changed files with 19 additions and 19 deletions

2
api.c
View File

@ -2698,7 +2698,7 @@ static void devdetails(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __m
root = api_add_string(root, "Name", cgpu->drv->name, false); root = api_add_string(root, "Name", cgpu->drv->name, false);
root = api_add_int(root, "ID", &(cgpu->device_id), false); root = api_add_int(root, "ID", &(cgpu->device_id), false);
root = api_add_string(root, "Driver", cgpu->drv->dname, false); root = api_add_string(root, "Driver", cgpu->drv->dname, false);
root = api_add_const(root, "Kernel", cgpu->kname ? cgpu->kname : BLANK, false); root = api_add_const(root, "Kernel", cgpu->kernelname ? cgpu->kernelname : BLANK, false);
root = api_add_const(root, "Model", cgpu->name ? cgpu->name : BLANK, false); root = api_add_const(root, "Model", cgpu->name ? cgpu->name : BLANK, false);
root = api_add_const(root, "Device Path", cgpu->device_path ? cgpu->device_path : BLANK, false); root = api_add_const(root, "Device Path", cgpu->device_path ? cgpu->device_path : BLANK, false);

View File

@ -203,15 +203,15 @@ char *set_kernel(char *arg)
if (nextptr == NULL) if (nextptr == NULL)
return "Invalid parameters for set kernel"; return "Invalid parameters for set kernel";
gpus[device++].kname = strdup(nextptr); gpus[device++].kernelname = strdup(nextptr);
while ((nextptr = strtok(NULL, ",")) != NULL) while ((nextptr = strtok(NULL, ",")) != NULL)
gpus[device++].kname = strdup(nextptr); gpus[device++].kernelname = strdup(nextptr);
/* If only one kernel name provided, use same for all GPUs. */ /* If only one kernel name provided, use same for all GPUs. */
if (device == 1) { if (device == 1) {
for (i = device; i < MAX_GPUDEVICES; i++) for (i = device; i < MAX_GPUDEVICES; i++)
gpus[i].kname = strdup(gpus[0].kname); gpus[i].kernelname = strdup(gpus[0].kernelname);
} }
return NULL; return NULL;
@ -1280,8 +1280,8 @@ static bool opencl_thread_prepare(struct thr_info *thr)
} }
if (!cgpu->name) if (!cgpu->name)
cgpu->name = strdup(name); cgpu->name = strdup(name);
if (!cgpu->kname) if (!cgpu->kernelname)
cgpu->kname = strdup("ckolivas"); cgpu->kernelname = strdup("ckolivas");
applog(LOG_INFO, "initCl() finished. Found %s", name); applog(LOG_INFO, "initCl() finished. Found %s", name);
cgtime(&now); cgtime(&now);

View File

@ -462,7 +462,7 @@ struct cgpu_info {
int64_t max_hashes; int64_t max_hashes;
char *kname; /* Human-readable kernel name. */ char *kernelname; /* Human-readable kernel name. */
bool mapped; bool mapped;
int virtual_gpu; int virtual_gpu;
int virtual_adl; int virtual_adl;

22
ocl.c
View File

@ -413,11 +413,19 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
char numbuf[16]; char numbuf[16];
char strbuf[255]; char strbuf[255];
if (strcmp(cgpu->kname, "") == 0) { if (strcmp(cgpu->kernelname, "") == 0) {
applog(LOG_INFO, "No kernel specified, selecting kernel ckolivas"); applog(LOG_INFO, "No kernel specified, defaulting to ckolivas");
strcpy(cgpu->kname, "ckolivas"); strcpy(cgpu->kernelname, "ckolivas");
} }
sprintf(strbuf, "%s.cl", cgpu->kernelname);
strcpy(filename, strbuf);
strcpy(binaryfilename, cgpu->kernelname);
/* Kernel zuikkis only supports lookup-gap 2 */
if (strcmp(cgpu->kernelname, "zuikkis") == 0)
cgpu->lookup_gap = 2;
/* For some reason 2 vectors is still better even if the card says /* For some reason 2 vectors is still better even if the card says
* otherwise, and many cards lie about their max so use 256 as max * otherwise, and many cards lie about their max so use 256 as max
* unless explicitly set on the command line. Tahiti prefers 1 */ * unless explicitly set on the command line. Tahiti prefers 1 */
@ -429,14 +437,6 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
/* All available kernels only support vector 1 */ /* All available kernels only support vector 1 */
cgpu->vwidth = 1; cgpu->vwidth = 1;
sprintf(strbuf, "%s.cl", cgpu->kname);
strcpy(filename, strbuf);
strcpy(binaryfilename, cgpu->kname);
/* Kernel zuikkis only supports lookup-gap 2 */
if (strcmp(cgpu->kname, "zuikkis") == 0)
cgpu->lookup_gap = 2;
/* Vectors are hard-set to 1 above. */ /* Vectors are hard-set to 1 above. */
if (likely(cgpu->vwidth)) if (likely(cgpu->vwidth))
clState->vwidth = cgpu->vwidth; clState->vwidth = cgpu->vwidth;

View File

@ -4262,7 +4262,7 @@ void write_config(FILE *fcfg)
fputs("\",\n\"kernel\" : \"", fcfg); fputs("\",\n\"kernel\" : \"", fcfg);
for(i = 0; i < nDevs; i++) { for(i = 0; i < nDevs; i++) {
fprintf(fcfg, "%s", i > 0 ? "," : ""); fprintf(fcfg, "%s", i > 0 ? "," : "");
fprintf(fcfg, "%s", gpus[i].kname); fprintf(fcfg, "%s", gpus[i].kernelname);
} }
fputs("\",\n\"lookup-gap\" : \"", fcfg); fputs("\",\n\"lookup-gap\" : \"", fcfg);