Allow a fixed speed difference between memory and GPU clock speed that will change memory speed when GPU speed is changed in autotune mode.
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
diff --git a/adl.c b/adl.c
index fb7b926..39aa697 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 3d6a019..0802896 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 f187268..b981a99 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