|
@@ -454,11 +454,15 @@ bool _set_gpu_engine(struct cgpu_info * const cgpu, const char * const _val)
|
|
|
{
|
|
{
|
|
|
int val1, val2;
|
|
int val1, val2;
|
|
|
get_intrange(_val, &val1, &val2);
|
|
get_intrange(_val, &val1, &val2);
|
|
|
- if (val1 < 0 || val1 > 9999 || val2 < 0 || val2 > 9999)
|
|
|
|
|
|
|
+ if (val1 < 0 || val1 > 9999 || val2 < 0 || val2 > 9999 || val2 < val1)
|
|
|
return false;
|
|
return false;
|
|
|
|
|
+
|
|
|
struct opencl_device_data * const data = cgpu->device_data;
|
|
struct opencl_device_data * const data = cgpu->device_data;
|
|
|
|
|
+ struct gpu_adl * const ga = &data->adl;
|
|
|
|
|
+
|
|
|
data->min_engine = val1;
|
|
data->min_engine = val1;
|
|
|
data->gpu_engine = val2;
|
|
data->gpu_engine = val2;
|
|
|
|
|
+ ga->autoengine = (val1 != val2);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
_SET_INTERFACE(gpu_engine)
|
|
_SET_INTERFACE(gpu_engine)
|
|
@@ -469,8 +473,38 @@ const char *set_gpu_engine(char *arg)
|
|
|
static
|
|
static
|
|
|
const char *opencl_set_gpu_engine(struct cgpu_info * const proc, const char * const optname, const char * const newvalue, char * const replybuf, enum bfg_set_device_replytype * const out_success)
|
|
const char *opencl_set_gpu_engine(struct cgpu_info * const proc, const char * const optname, const char * const newvalue, char * const replybuf, enum bfg_set_device_replytype * const out_success)
|
|
|
{
|
|
{
|
|
|
- if (set_engineclock(proc->device_id, atoi(newvalue)))
|
|
|
|
|
- return "Failed to set gpu_engine";
|
|
|
|
|
|
|
+ struct opencl_device_data * const data = proc->device_data;
|
|
|
|
|
+ struct gpu_adl * const ga = &data->adl;
|
|
|
|
|
+
|
|
|
|
|
+ int val1, val2;
|
|
|
|
|
+ get_intrange(newvalue, &val1, &val2);
|
|
|
|
|
+ if (val1 < 0 || val1 > 100 || val2 < 0 || val2 > 100 || val2 < val1)
|
|
|
|
|
+ return "Invalid value for clock";
|
|
|
|
|
+
|
|
|
|
|
+ if (val1 == val2)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (set_engineclock(proc->device_id, val1))
|
|
|
|
|
+ return "Failed to set gpu_engine";
|
|
|
|
|
+ ga->autoengine = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ // Ensure current clock is within range
|
|
|
|
|
+ if (ga->lastengine < val1)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (set_engineclock(proc->device_id, val1))
|
|
|
|
|
+ return "Failed to set gpu_engine";
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ if (ga->lastengine > val2)
|
|
|
|
|
+ if (set_engineclock(proc->device_id, val2))
|
|
|
|
|
+ return "Failed to set gpu_engine";
|
|
|
|
|
+
|
|
|
|
|
+ data->min_engine = val1;
|
|
|
|
|
+ data->gpu_engine = val2;
|
|
|
|
|
+ ga->autoengine = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return NULL;
|
|
return NULL;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -479,11 +513,15 @@ bool _set_gpu_fan(struct cgpu_info * const cgpu, const char * const _val)
|
|
|
{
|
|
{
|
|
|
int val1, val2;
|
|
int val1, val2;
|
|
|
get_intrange(_val, &val1, &val2);
|
|
get_intrange(_val, &val1, &val2);
|
|
|
- if (val1 < 0 || val1 > 100 || val2 < 0 || val2 > 100)
|
|
|
|
|
|
|
+ if (val1 < 0 || val1 > 100 || val2 < 0 || val2 > 100 || val2 < val1)
|
|
|
return false;
|
|
return false;
|
|
|
|
|
+
|
|
|
struct opencl_device_data * const data = cgpu->device_data;
|
|
struct opencl_device_data * const data = cgpu->device_data;
|
|
|
|
|
+ struct gpu_adl * const ga = &data->adl;
|
|
|
|
|
+
|
|
|
data->min_fan = val1;
|
|
data->min_fan = val1;
|
|
|
data->gpu_fan = val2;
|
|
data->gpu_fan = val2;
|
|
|
|
|
+ ga->autofan = (val1 != val2);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
_SET_INTERFACE(gpu_fan)
|
|
_SET_INTERFACE(gpu_fan)
|
|
@@ -494,8 +532,38 @@ const char *set_gpu_fan(char *arg)
|
|
|
static
|
|
static
|
|
|
const char *opencl_set_gpu_fan(struct cgpu_info * const proc, const char * const optname, const char * const newvalue, char * const replybuf, enum bfg_set_device_replytype * const out_success)
|
|
const char *opencl_set_gpu_fan(struct cgpu_info * const proc, const char * const optname, const char * const newvalue, char * const replybuf, enum bfg_set_device_replytype * const out_success)
|
|
|
{
|
|
{
|
|
|
- if (set_fanspeed(proc->device_id, atoi(newvalue)))
|
|
|
|
|
- return "Failed to set gpu_fan";
|
|
|
|
|
|
|
+ struct opencl_device_data * const data = proc->device_data;
|
|
|
|
|
+ struct gpu_adl * const ga = &data->adl;
|
|
|
|
|
+
|
|
|
|
|
+ int val1, val2;
|
|
|
|
|
+ get_intrange(newvalue, &val1, &val2);
|
|
|
|
|
+ if (val1 < 0 || val1 > 100 || val2 < 0 || val2 > 100 || val2 < val1)
|
|
|
|
|
+ return "Invalid value for fan";
|
|
|
|
|
+
|
|
|
|
|
+ if (val1 == val2)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (set_fanspeed(proc->device_id, val1))
|
|
|
|
|
+ return "Failed to set gpu_fan";
|
|
|
|
|
+ ga->autofan = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ // Ensure current fan is within range
|
|
|
|
|
+ if (ga->targetfan < val1)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (set_fanspeed(proc->device_id, val1))
|
|
|
|
|
+ return "Failed to set gpu_fan";
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ if (ga->targetfan > val2)
|
|
|
|
|
+ if (set_fanspeed(proc->device_id, val2))
|
|
|
|
|
+ return "Failed to set gpu_fan";
|
|
|
|
|
+
|
|
|
|
|
+ data->min_fan = val1;
|
|
|
|
|
+ data->gpu_fan = val2;
|
|
|
|
|
+ ga->autofan = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return NULL;
|
|
return NULL;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -672,7 +740,6 @@ void pause_dynamic_threads(int gpu)
|
|
|
thr = cgpu->thr[i];
|
|
thr = cgpu->thr[i];
|
|
|
if (!thr->pause && data->dynamic) {
|
|
if (!thr->pause && data->dynamic) {
|
|
|
applog(LOG_WARNING, "Disabling extra threads due to dynamic mode.");
|
|
applog(LOG_WARNING, "Disabling extra threads due to dynamic mode.");
|
|
|
- applog(LOG_WARNING, "Tune dynamic intensity with --gpu-dyninterval");
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
thr->pause = data->dynamic;
|
|
thr->pause = data->dynamic;
|
|
@@ -1282,7 +1349,6 @@ static int opencl_autodetect()
|
|
|
cgpu = &gpus[i];
|
|
cgpu = &gpus[i];
|
|
|
struct opencl_device_data * const data = cgpu->device_data;
|
|
struct opencl_device_data * const data = cgpu->device_data;
|
|
|
|
|
|
|
|
- cgpu->devtype = "GPU";
|
|
|
|
|
cgpu->deven = DEV_ENABLED;
|
|
cgpu->deven = DEV_ENABLED;
|
|
|
cgpu->drv = &opencl_api;
|
|
cgpu->drv = &opencl_api;
|
|
|
cgpu->device_id = i;
|
|
cgpu->device_id = i;
|
|
@@ -1330,9 +1396,8 @@ static void reinit_opencl_device(struct cgpu_info *gpu)
|
|
|
tq_push(control_thr[gpur_thr_id].q, gpu);
|
|
tq_push(control_thr[gpur_thr_id].q, gpu);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// FIXME: Legacy (called by TUI) for side effects
|
|
|
|
|
static
|
|
static
|
|
|
-bool override_opencl_statline_temp(char *buf, size_t bufsz, struct cgpu_info *gpu, __maybe_unused bool per_processor)
|
|
|
|
|
|
|
+bool opencl_get_stats(struct cgpu_info * const gpu)
|
|
|
{
|
|
{
|
|
|
__maybe_unused struct opencl_device_data * const data = gpu->device_data;
|
|
__maybe_unused struct opencl_device_data * const data = gpu->device_data;
|
|
|
#ifdef HAVE_SENSORS
|
|
#ifdef HAVE_SENSORS
|
|
@@ -1353,7 +1418,7 @@ bool override_opencl_statline_temp(char *buf, size_t bufsz, struct cgpu_info *gp
|
|
|
continue;
|
|
continue;
|
|
|
|
|
|
|
|
gpu->temp = val;
|
|
gpu->temp = val;
|
|
|
- return false;
|
|
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
@@ -1364,7 +1429,7 @@ bool override_opencl_statline_temp(char *buf, size_t bufsz, struct cgpu_info *gp
|
|
|
gpu_fanspeed(gpuid);
|
|
gpu_fanspeed(gpuid);
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
- return false;
|
|
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static
|
|
static
|
|
@@ -1766,7 +1831,7 @@ struct device_drv opencl_api = {
|
|
|
.drv_detect = opencl_detect,
|
|
.drv_detect = opencl_detect,
|
|
|
.reinit_device = reinit_opencl_device,
|
|
.reinit_device = reinit_opencl_device,
|
|
|
.watchdog = opencl_watchdog,
|
|
.watchdog = opencl_watchdog,
|
|
|
- .override_statline_temp2 = override_opencl_statline_temp,
|
|
|
|
|
|
|
+ .get_stats = opencl_get_stats,
|
|
|
#ifdef HAVE_CURSES
|
|
#ifdef HAVE_CURSES
|
|
|
.proc_wlogprint_status = opencl_wlogprint_status,
|
|
.proc_wlogprint_status = opencl_wlogprint_status,
|
|
|
.proc_tui_wlogprint_choices = opencl_tui_wlogprint_choices,
|
|
.proc_tui_wlogprint_choices = opencl_tui_wlogprint_choices,
|