Allow the worksize to be set per-device.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
diff --git a/cgminer.c b/cgminer.c
index d0c1e2e..b5965a0 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -91,8 +91,6 @@ static int opt_fail_pause = 5;
static int fail_pause = 5;
int opt_log_interval = 5;
static int opt_queue = 1;
-int opt_vectors;
-int opt_worksize;
int opt_scantime = 60;
int opt_expiry = 120;
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"),
#ifdef HAVE_OPENCL
OPT_WITH_ARG("--worksize|-w",
- set_int_0_to_9999, opt_show_intval, &opt_worksize,
- "Override detected optimal worksize"),
+ set_worksize, NULL, NULL,
+ "Override detected optimal worksize - one value or comma separated list"),
#endif
OPT_WITH_ARG("--userpass|-O",
set_userpass, NULL, NULL,
diff --git a/device-gpu.c b/device-gpu.c
index 1c2ad64..a60e80e 100644
--- a/device-gpu.c
+++ b/device-gpu.c
@@ -93,6 +93,36 @@ char *set_vector(char *arg)
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
#ifdef HAVE_ADL
diff --git a/device-gpu.h b/device-gpu.h
index 12af985..2c8d1e3 100644
--- a/device-gpu.h
+++ b/device-gpu.h
@@ -16,6 +16,7 @@ extern char *set_temp_overheat(char *arg);
extern char *set_temp_target(char *arg);
extern char *set_intensity(char *arg);
extern char *set_vector(char *arg);
+extern char *set_worksize(char *arg);
void manage_gpu(void);
extern void pause_dynamic_threads(int gpu);
diff --git a/ocl.c b/ocl.c
index 5869ce4..54a09d3 100644
--- a/ocl.c
+++ b/ocl.c
@@ -33,7 +33,6 @@
#include "findnonce.h"
#include "ocl.h"
-extern int opt_worksize;
int opt_platform_id;
char *file_contents(const char *filename, int *length)
@@ -349,12 +348,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
else
clState->vwidth = preferred_vwidth;
- if (opt_worksize && opt_worksize <= (int)clState->max_work_size)
- clState->work_size = opt_worksize;
+ if (gpus[gpu].work_size && gpus[gpu].work_size <= clState->max_work_size)
+ clState->wsize = gpus[gpu].work_size;
else if (strstr(name, "Tahiti"))
- clState->work_size = 64;
+ clState->wsize = 64;
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
* compiler to ensure we only load a binary that matches what would