diff --git a/driver-opencl.c b/driver-opencl.c index 7d1cfc150..7a1ae5677 100644 --- a/driver-opencl.c +++ b/driver-opencl.c @@ -564,6 +564,7 @@ char *set_intensity(char *arg) tt = &gpus[device].intensity; *tt = val; gpus[device].xintensity = 0; // Disable shader based intensity + gpus[device].rawintensity = 0; // Disable raw intensity } device++; @@ -580,6 +581,7 @@ char *set_intensity(char *arg) tt = &gpus[device].intensity; *tt = val; gpus[device].xintensity = 0; // Disable shader based intensity + gpus[device].rawintensity = 0; // Disable raw intensity } device++; } @@ -588,6 +590,7 @@ char *set_intensity(char *arg) gpus[i].dynamic = gpus[0].dynamic; gpus[i].intensity = gpus[0].intensity; gpus[i].xintensity = 0; // Disable shader based intensity + gpus[i].rawintensity = 0; // Disable raw intensity } } @@ -604,10 +607,11 @@ char *set_xintensity(char *arg) return "Invalid parameters for shader based intensity"; val = atoi(nextptr); if (val < MIN_XINTENSITY || val > MAX_XINTENSITY) - return "Invalid value passed to set shader intensity"; + return "Invalid value passed to set shader-based intensity"; gpus[device].dynamic = false; // Disable dynamic intensity gpus[device].intensity = 0; // Disable regular intensity + gpus[device].rawintensity = 0; // Disable raw intensity gpus[device].xintensity = val; device++; @@ -617,13 +621,54 @@ char *set_xintensity(char *arg) return "Invalid value passed to set shader based intensity"; gpus[device].dynamic = false; // Disable dynamic intensity gpus[device].intensity = 0; // Disable regular intensity + gpus[device].rawintensity = 0; // Disable raw intensity gpus[device].xintensity = val; device++; } if (device == 1) for (i = device; i < MAX_GPUDEVICES; i++) { - gpus[i].dynamic = gpus[0].dynamic; // Disable dynamic intensity - gpus[i].intensity = gpus[0].intensity; // Disable regular intensity + gpus[i].dynamic = gpus[0].dynamic; + gpus[i].intensity = gpus[0].intensity; + gpus[i].rawintensity = gpus[0].rawintensity; + gpus[i].xintensity = gpus[0].xintensity; + } + + return NULL; +} + +char *set_rawintensity(char *arg) +{ + int i, device = 0, val = 0; + char *nextptr; + + nextptr = strtok(arg, ","); + if (nextptr == NULL) + return "Invalid parameters for raw intensity"; + val = atoi(nextptr); + if (val < MIN_RAWINTENSITY || val > MAX_RAWINTENSITY) + return "Invalid value passed to set raw intensity"; + + gpus[device].dynamic = false; // Disable dynamic intensity + gpus[device].intensity = 0; // Disable regular intensity + gpus[device].xintensity = 0; // Disable xintensity + gpus[device].rawintensity = val; + device++; + + while ((nextptr = strtok(NULL, ",")) != NULL) { + val = atoi(nextptr); + if (val < MIN_RAWINTENSITY || val > MAX_RAWINTENSITY) + return "Invalid value passed to set raw intensity"; + gpus[device].dynamic = false; // Disable dynamic intensity + gpus[device].intensity = 0; // Disable regular intensity + gpus[device].xintensity = 0; // Disable xintensity + gpus[device].rawintensity = val; + device++; + } + if (device == 1) + for (i = device; i < MAX_GPUDEVICES; i++) { + gpus[i].dynamic = gpus[0].dynamic; + gpus[i].intensity = gpus[0].intensity; + gpus[i].rawintensity = gpus[0].rawintensity; gpus[i].xintensity = gpus[0].xintensity; } @@ -693,10 +738,10 @@ void manage_gpu(void) mhash_base = false; } - wlog("GPU %d: %.1f / %.1f %sh/s | A:%d R:%d HW:%d U:%.2f/m I:%d xI:%d\n", + wlog("GPU %d: %.1f / %.1f %sh/s | A:%d R:%d HW:%d U:%.2f/m I:%d xI:%d rI:%d\n", gpu, displayed_rolling, displayed_total, mhash_base ? "M" : "K", cgpu->accepted, cgpu->rejected, cgpu->hw_errors, - cgpu->utility, cgpu->intensity, cgpu->xintensity); + cgpu->utility, cgpu->intensity, cgpu->xintensity, cgpu->rawintensity); #ifdef HAVE_ADL if (gpus[gpu].has_adl) { int engineclock = 0, memclock = 0, activity = 0, fanspeed = 0, fanpercent = 0, powertune = 0; @@ -764,7 +809,7 @@ void manage_gpu(void) wlog("\n"); } - wlogprint("[E]nable [D]isable [I]ntensity [x]Intensity [R]estart GPU %s\n",adl_active ? "[C]hange settings" : ""); + wlogprint("[E]nable [D]isable [I]ntensity [x]Intensity R[a]w Intensity [R]estart GPU %s\n",adl_active ? "[C]hange settings" : ""); wlogprint("Or press any other key to continue\n"); logwin_update(); @@ -850,7 +895,8 @@ void manage_gpu(void) } gpus[selected].dynamic = false; gpus[selected].intensity = intensity; - gpus[selected].xintensity = 0; // disable + gpus[selected].xintensity = 0; // Disable xintensity when enabling intensity + gpus[selected].rawintensity = 0; // Disable raw intensity when enabling intensity wlogprint("Intensity on gpu %d set to %d\n", selected, intensity); pause_dynamic_threads(selected); goto retry; @@ -877,11 +923,41 @@ void manage_gpu(void) goto retry; } gpus[selected].dynamic = false; - gpus[selected].intensity = 0; // disable + gpus[selected].intensity = 0; // Disable intensity when enabling xintensity + gpus[selected].rawintensity = 0; // Disable raw intensity when enabling xintensity gpus[selected].xintensity = xintensity; wlogprint("Experimental intensity on gpu %d set to %d\n", selected, xintensity); pause_dynamic_threads(selected); goto retry; + } else if (!strncasecmp(&input, "a", 1)) { + int rawintensity; + char *intvar; + + if (selected) + selected = curses_int("Select GPU to change raw intensity on"); + if (selected < 0 || selected >= nDevs) { + wlogprint("Invalid selection\n"); + goto retry; + } + + intvar = curses_input("Set raw GPU scan intensity (" MIN_RAWINTENSITY_STR " -> " MAX_RAWINTENSITY_STR ")"); + if (!intvar) { + wlogprint("Invalid input\n"); + goto retry; + } + rawintensity = atoi(intvar); + free(intvar); + if (rawintensity < MIN_RAWINTENSITY || rawintensity > MAX_RAWINTENSITY) { + wlogprint("Invalid selection\n"); + goto retry; + } + gpus[selected].dynamic = false; + gpus[selected].intensity = 0; // Disable intensity when enabling raw intensity + gpus[selected].xintensity = 0; // Disable xintensity when enabling raw intensity + gpus[selected].rawintensity = rawintensity; + wlogprint("Raw intensity on gpu %d set to %d\n", selected, rawintensity); + pause_dynamic_threads(selected); + goto retry; } else if (!strncasecmp(&input, "r", 1)) { if (selected) selected = curses_int("Select GPU to attempt to restart"); @@ -942,11 +1018,13 @@ static cl_int queue_scrypt_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_u } static void set_threads_hashes(unsigned int vectors, unsigned int compute_shaders, int64_t *hashes, size_t *globalThreads, - unsigned int minthreads, __maybe_unused int *intensity, __maybe_unused int *xintensity) + unsigned int minthreads, __maybe_unused int *intensity, __maybe_unused int *xintensity, __maybe_unused int *rawintensity) { unsigned int threads = 0; while (threads < minthreads) { - if (*xintensity > 0) { + if (*rawintensity > 0) { + threads = *rawintensity; + } else if (*xintensity > 0) { threads = compute_shaders * *xintensity; } else { threads = 1 << *intensity; @@ -1145,7 +1223,9 @@ static void get_opencl_statline_before(char *buf, size_t bufsiz, struct cgpu_inf static void get_opencl_statline(char *buf, size_t bufsiz, struct cgpu_info *gpu) { - if (gpu->xintensity > 0) + if (gpu->rawintensity > 0) + tailsprintf(buf, bufsiz, " rI:%3d", gpu->rawintensity); + else if (gpu->xintensity > 0) tailsprintf(buf, bufsiz, " xI:%3d", gpu->xintensity); else tailsprintf(buf, bufsiz, " I:%2d", gpu->intensity); @@ -1314,7 +1394,7 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work, gpu->intervals = 0; } - set_threads_hashes(clState->vwidth, clState->compute_shaders, &hashes, globalThreads, localThreads[0], &gpu->intensity, &gpu->xintensity); + set_threads_hashes(clState->vwidth, clState->compute_shaders, &hashes, globalThreads, localThreads[0], &gpu->intensity, &gpu->xintensity, &gpu->rawintensity); if (hashes > gpu->max_hashes) gpu->max_hashes = hashes; diff --git a/driver-opencl.h b/driver-opencl.h index f95ac1fd0..76c7fc047 100644 --- a/driver-opencl.h +++ b/driver-opencl.h @@ -18,6 +18,7 @@ extern char *set_temp_overheat(char *arg); extern char *set_temp_target(char *arg); extern char *set_intensity(char *arg); extern char *set_xintensity(char *arg); +extern char *set_rawintensity(char *arg); extern char *set_vector(char *arg); extern char *set_worksize(char *arg); extern char *set_shaders(char *arg); diff --git a/miner.h b/miner.h index a74e3056b..bd0d179f3 100644 --- a/miner.h +++ b/miner.h @@ -465,6 +465,7 @@ struct cgpu_info { int virtual_adl; int intensity; int xintensity; + int rawintensity; bool dynamic; cl_uint vwidth; @@ -1052,8 +1053,12 @@ extern bool add_pool_details(struct pool *pool, bool live, char *url, char *user #define MAX_INTENSITY_STR "31" #define MIN_XINTENSITY 1 #define MIN_XINTENSITY_STR "1" -#define MAX_XINTENSITY 999 -#define MAX_XINTENSITY_STR "999" +#define MAX_XINTENSITY 9999 +#define MAX_XINTENSITY_STR "9999" +#define MIN_RAWINTENSITY 1 +#define MIN_RAWINTENSITY_STR "1" +#define MAX_RAWINTENSITY 2147483647 +#define MAX_RAWINTENSITY_STR "2147483647" extern bool hotplug_mode; extern int hotplug_time; diff --git a/sgminer.c b/sgminer.c index 8b215b8c0..e18e17df2 100644 --- a/sgminer.c +++ b/sgminer.c @@ -1089,7 +1089,12 @@ static struct opt_table opt_config_table[] = { ",default: d to maintain desktop interactivity)"), OPT_WITH_ARG("--xintensity|-X", set_xintensity, NULL, NULL, - "Shader based intensity of GPU scanning (0 to 9999), overrides --intensity|-I."), + "Shader based intensity of GPU scanning (" MIN_XINTENSITY_STR " to " + MAX_XINTENSITY_STR "), overrides --intensity|-I and -rawintensity."), + OPT_WITH_ARG("--rawintensity", + set_rawintensity, NULL, NULL, + "Raw intensity of GPU scanning (" MIN_RAWINTENSITY_STR " to " + MAX_RAWINTENSITY_STR "), overrides --intensity|-I and --xintensity|-X."), OPT_WITH_ARG("--kernel-path|-K", opt_set_charp, opt_show_charp, &opt_kernel_path, "Specify a path to where kernel files are"),