Browse Source

Allow the worksize to be set per-device.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
26c59fbf0f
  1. 6
      cgminer.c
  2. 30
      device-gpu.c
  3. 1
      device-gpu.h
  4. 9
      ocl.c

6
cgminer.c

@ -91,8 +91,6 @@ static int opt_fail_pause = 5;
static int fail_pause = 5; static int fail_pause = 5;
int opt_log_interval = 5; int opt_log_interval = 5;
static int opt_queue = 1; static int opt_queue = 1;
int opt_vectors;
int opt_worksize;
int opt_scantime = 60; int opt_scantime = 60;
int opt_expiry = 120; int opt_expiry = 120;
int opt_bench_algo = -1; int opt_bench_algo = -1;
@ -839,8 +837,8 @@ static struct opt_table opt_config_table[] = {
"Log verbose output to stderr as well as status output"), "Log verbose output to stderr as well as status output"),
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
OPT_WITH_ARG("--worksize|-w", OPT_WITH_ARG("--worksize|-w",
set_int_0_to_9999, opt_show_intval, &opt_worksize, set_worksize, NULL, NULL,
"Override detected optimal worksize"), "Override detected optimal worksize - one value or comma separated list"),
#endif #endif
OPT_WITH_ARG("--userpass|-O", OPT_WITH_ARG("--userpass|-O",
set_userpass, NULL, NULL, set_userpass, NULL, NULL,

30
device-gpu.c

@ -93,6 +93,36 @@ char *set_vector(char *arg)
return NULL; return NULL;
} }
char *set_worksize(char *arg)
{
int i, val = 0, device = 0;
char *nextptr;
nextptr = strtok(arg, ",");
if (nextptr == NULL)
return "Invalid parameters for set work size";
val = atoi(nextptr);
if (val < 1 || val > 9999)
return "Invalid value passed to set_worksize";
gpus[device++].work_size = val;
while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atoi(nextptr);
if (val < 1 || val > 9999)
return "Invalid value passed to set_worksize";
gpus[device++].work_size = val;
}
if (device == 1) {
for (i = device; i < MAX_GPUDEVICES; i++)
gpus[i].work_size = gpus[0].work_size;
}
return NULL;
}
#endif #endif
#ifdef HAVE_ADL #ifdef HAVE_ADL

1
device-gpu.h

@ -16,6 +16,7 @@ extern char *set_temp_overheat(char *arg);
extern char *set_temp_target(char *arg); extern char *set_temp_target(char *arg);
extern char *set_intensity(char *arg); extern char *set_intensity(char *arg);
extern char *set_vector(char *arg); extern char *set_vector(char *arg);
extern char *set_worksize(char *arg);
void manage_gpu(void); void manage_gpu(void);
extern void pause_dynamic_threads(int gpu); extern void pause_dynamic_threads(int gpu);

9
ocl.c

@ -33,7 +33,6 @@
#include "findnonce.h" #include "findnonce.h"
#include "ocl.h" #include "ocl.h"
extern int opt_worksize;
int opt_platform_id; int opt_platform_id;
char *file_contents(const char *filename, int *length) char *file_contents(const char *filename, int *length)
@ -349,12 +348,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
else else
clState->vwidth = preferred_vwidth; clState->vwidth = preferred_vwidth;
if (opt_worksize && opt_worksize <= (int)clState->max_work_size) if (gpus[gpu].work_size && gpus[gpu].work_size <= clState->max_work_size)
clState->work_size = opt_worksize; clState->wsize = gpus[gpu].work_size;
else if (strstr(name, "Tahiti")) else if (strstr(name, "Tahiti"))
clState->work_size = 64; clState->wsize = 64;
else else
clState->work_size = (clState->max_work_size <= 256 ? clState->max_work_size : 256) / clState->vwidth; clState->wsize = (clState->max_work_size <= 256 ? clState->max_work_size : 256) / clState->vwidth;
/* Create binary filename based on parameters passed to opencl /* Create binary filename based on parameters passed to opencl
* compiler to ensure we only load a binary that matches what would * compiler to ensure we only load a binary that matches what would

Loading…
Cancel
Save