diff --git a/adl.c b/adl.c index fb7b9263..39aa697c 100644 --- a/adl.c +++ b/adl.c @@ -808,9 +808,11 @@ void gpu_autotune(int gpu, bool *enable) { int temp, fanpercent, engine, newpercent, newengine; bool fan_optimal = true; + struct cgpu_info *cgpu; struct gpu_adl *ga; - ga = &gpus[gpu].adl; + cgpu = &gpus[gpu]; + ga = &cgpu->adl; lock_adl(); temp = __gpu_temp(ga); @@ -880,6 +882,8 @@ void gpu_autotune(int gpu, bool *enable) newengine /= 100; applog(LOG_INFO, "Setting GPU %d engine clock to %d", gpu, newengine); set_engineclock(gpu, newengine); + if (cgpu->gpu_memdiff) + set_memoryclock(gpu, newengine + cgpu->gpu_memdiff); } } ga->lasttemp = temp; diff --git a/main.c b/main.c index 3d6a0195..08028966 100644 --- a/main.c +++ b/main.c @@ -1237,6 +1237,35 @@ static char *set_gpu_memclock(char *arg) return NULL; } +static char *set_gpu_memdiff(char *arg) +{ + int i, val = 0, device = 0; + char *nextptr; + + nextptr = strtok(arg, ","); + if (nextptr == NULL) + return "Invalid parameters for set gpu memdiff"; + val = atoi(nextptr); + if (val < -9999 || val > 9999) + return "Invalid value passed to set_gpu_memdiff"; + + gpus[device++].gpu_memdiff = val; + + while ((nextptr = strtok(NULL, ",")) != NULL) { + val = atoi(nextptr); + if (val < -9999 || val > 9999) + return "Invalid value passed to set_gpu_memdiff"; + + gpus[device++].gpu_memdiff = val; + } + if (device == 1) { + for (i = device; i < MAX_GPUDEVICES; i++) + gpus[i].gpu_memdiff = gpus[0].gpu_memdiff; + } + + return NULL; +} + static char *set_gpu_powertune(char *arg) { int i, val = 0, device = 0; @@ -1525,6 +1554,9 @@ static struct opt_table opt_config_table[] = { OPT_WITH_ARG("--gpu-memclock", set_gpu_memclock, NULL, NULL, "Set the GPU memory (over)clock in Mhz - one value for all or separate by commas for per card"), + OPT_WITH_ARG("--gpu-memdiff", + set_gpu_memdiff, NULL, NULL, + "Set a fixed difference in clock speed between the GPU and memory in auto-gpu mode"), OPT_WITH_ARG("--gpu-powertune", set_gpu_powertune, NULL, NULL, "Set the GPU powertune percentage - one value for all or separate by commas for per card"), diff --git a/miner.h b/miner.h index f187268d..b981a994 100644 --- a/miner.h +++ b/miner.h @@ -218,6 +218,7 @@ struct cgpu_info { int gpu_fan; int min_fan; int gpu_memclock; + int gpu_memdiff; int gpu_powertune; float gpu_vddc; #endif