mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-16 11:48:15 +00:00
Remove union in hm_attrs_t; Remove code related to threshold_slowdown which will be replaced with NvGetPerfPoliciesInfo()
This commit is contained in:
parent
02dd1f20ab
commit
a3e6690a9c
@ -1084,26 +1084,16 @@ typedef struct __hc_device_param hc_device_param_t;
|
||||
|
||||
#ifdef HAVE_HWMON
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
{
|
||||
HM_ADAPTER_ADL adl;
|
||||
HM_ADAPTER_NVML nvml;
|
||||
HM_ADAPTER_NVAPI nvapi;
|
||||
|
||||
} adapter_index;
|
||||
|
||||
int od_version;
|
||||
|
||||
int fan_get_supported;
|
||||
int fan_set_supported;
|
||||
|
||||
int gpu_temp_threshold_slowdown;
|
||||
int gpu_temp_threshold_shutdown;
|
||||
|
||||
// int busid; // used for CL_DEVICE_TOPOLOGY_AMD but broken for dual GPUs
|
||||
// int devid; // used for CL_DEVICE_TOPOLOGY_AMD but broken for dual GPUs
|
||||
|
||||
} hm_attrs_t;
|
||||
#endif // HAVE_HWMON
|
||||
|
||||
|
109
src/hashcat.c
109
src/hashcat.c
@ -3818,8 +3818,6 @@ static void *thread_monitor (void *p)
|
||||
#ifdef HAVE_HWMON
|
||||
uint hwmon_check = 0;
|
||||
|
||||
int slowdown_warnings = 0;
|
||||
|
||||
// these variables are mainly used for fan control
|
||||
|
||||
int *fan_speed_chgd = (int *) mycalloc (data.devices_cnt, sizeof (int));
|
||||
@ -3884,50 +3882,6 @@ static void *thread_monitor (void *p)
|
||||
|
||||
#ifdef HAVE_HWMON
|
||||
|
||||
if (1)
|
||||
{
|
||||
hc_thread_mutex_lock (mux_adl);
|
||||
|
||||
for (uint device_id = 0; device_id < data.devices_cnt; device_id++)
|
||||
{
|
||||
hc_device_param_t *device_param = &data.devices_param[device_id];
|
||||
|
||||
if (device_param->skipped) continue;
|
||||
|
||||
if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) continue;
|
||||
|
||||
const int temperature = hm_get_temperature_with_device_id (device_id);
|
||||
|
||||
const int threshold = data.hm_device[device_id].gpu_temp_threshold_slowdown;
|
||||
|
||||
if (temperature >= threshold)
|
||||
{
|
||||
if (slowdown_warnings < 3)
|
||||
{
|
||||
if (data.quiet == 0) clear_prompt ();
|
||||
|
||||
log_info ("WARNING: Drivers temperature threshold (%dc) hit on GPU #%d, expect performance to drop...", threshold, device_id + 1);
|
||||
|
||||
if (slowdown_warnings == 2)
|
||||
{
|
||||
log_info ("");
|
||||
}
|
||||
|
||||
if (data.quiet == 0) fprintf (stdout, "%s", PROMPT);
|
||||
if (data.quiet == 0) fflush (stdout);
|
||||
|
||||
slowdown_warnings++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
slowdown_warnings = 0;
|
||||
}
|
||||
}
|
||||
|
||||
hc_thread_mutex_unlock (mux_adl);
|
||||
}
|
||||
|
||||
if (hwmon_check == 1)
|
||||
{
|
||||
hc_thread_mutex_lock (mux_adl);
|
||||
@ -14004,9 +13958,9 @@ int main (int argc, char **argv)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_HWMON
|
||||
hm_attrs_t hm_adapters_adl[DEVICES_MAX] = { { { 0 }, 0, 0, 0, 0, 0 } };
|
||||
hm_attrs_t hm_adapters_nvapi[DEVICES_MAX] = { { { 0 }, 0, 0, 0, 0, 0 } };
|
||||
hm_attrs_t hm_adapters_nvml[DEVICES_MAX] = { { { 0 }, 0, 0, 0, 0, 0 } };
|
||||
hm_attrs_t hm_adapters_adl[DEVICES_MAX] = { { 0 } };
|
||||
hm_attrs_t hm_adapters_nvapi[DEVICES_MAX] = { { 0 } };
|
||||
hm_attrs_t hm_adapters_nvml[DEVICES_MAX] = { { 0 } };
|
||||
|
||||
if (gpu_temp_disable == 0)
|
||||
{
|
||||
@ -14035,18 +13989,18 @@ int main (int argc, char **argv)
|
||||
|
||||
for (int i = 0; i < tmp_in; i++)
|
||||
{
|
||||
hm_adapters_nvml[tmp_out++].adapter_index.nvml = nvmlGPUHandle[i];
|
||||
hm_adapters_nvml[tmp_out++].nvml = nvmlGPUHandle[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i < tmp_out; i++)
|
||||
{
|
||||
unsigned int speed;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetFanSpeed (data.hm_nvml, 0, hm_adapters_nvml[i].adapter_index.nvml, &speed) == NVML_SUCCESS) hm_adapters_nvml[i].fan_get_supported = 1;
|
||||
if (hm_NVML_nvmlDeviceGetFanSpeed (data.hm_nvml, 0, hm_adapters_nvml[i].nvml, &speed) == NVML_SUCCESS) hm_adapters_nvml[i].fan_get_supported = 1;
|
||||
|
||||
hm_NVML_nvmlDeviceSetComputeMode (data.hm_nvml, 1, hm_adapters_nvml[i].adapter_index.nvml, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
|
||||
hm_NVML_nvmlDeviceSetComputeMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
|
||||
|
||||
hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nvml, 1, hm_adapters_nvml[i].adapter_index.nvml, NVML_GOM_ALL_ON);
|
||||
hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_GOM_ALL_ON);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14068,7 +14022,7 @@ int main (int argc, char **argv)
|
||||
|
||||
for (int i = 0; i < tmp_in; i++)
|
||||
{
|
||||
hm_adapters_nvapi[tmp_out++].adapter_index.nvapi = nvGPUHandle[i];
|
||||
hm_adapters_nvapi[tmp_out++].nvapi = nvGPUHandle[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14297,7 +14251,7 @@ int main (int argc, char **argv)
|
||||
|
||||
int powertune_supported = 0;
|
||||
|
||||
if ((ADL_rc = hm_ADL_Overdrive6_PowerControl_Caps (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &powertune_supported)) != ADL_OK)
|
||||
if ((ADL_rc = hm_ADL_Overdrive6_PowerControl_Caps (data.hm_adl, data.hm_device[device_id].adl, &powertune_supported)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
|
||||
|
||||
@ -14312,9 +14266,9 @@ int main (int argc, char **argv)
|
||||
|
||||
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
|
||||
|
||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &powertune)) == ADL_OK)
|
||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_adl, data.hm_device[device_id].adl, &powertune)) == ADL_OK)
|
||||
{
|
||||
ADL_rc = hm_ADL_Overdrive_PowerControl_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &od_power_control_status[device_id]);
|
||||
ADL_rc = hm_ADL_Overdrive_PowerControl_Get (data.hm_adl, data.hm_device[device_id].adl, &od_power_control_status[device_id]);
|
||||
}
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
@ -14324,7 +14278,7 @@ int main (int argc, char **argv)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adapter_index.adl, powertune.iMaxValue)) != ADL_OK)
|
||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adl, powertune.iMaxValue)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to set new ADL PowerControl values");
|
||||
|
||||
@ -14337,7 +14291,7 @@ int main (int argc, char **argv)
|
||||
|
||||
od_clock_mem_status[device_id].state.iNumberOfPerformanceLevels = 2;
|
||||
|
||||
if ((ADL_rc = hm_ADL_Overdrive_StateInfo_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE, &od_clock_mem_status[device_id])) != ADL_OK)
|
||||
if ((ADL_rc = hm_ADL_Overdrive_StateInfo_Get (data.hm_adl, data.hm_device[device_id].adl, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE, &od_clock_mem_status[device_id])) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
|
||||
|
||||
@ -14348,7 +14302,7 @@ int main (int argc, char **argv)
|
||||
|
||||
ADLOD6Capabilities caps = {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
|
||||
|
||||
if ((ADL_rc = hm_ADL_Overdrive_Capabilities_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &caps)) != ADL_OK)
|
||||
if ((ADL_rc = hm_ADL_Overdrive_Capabilities_Get (data.hm_adl, data.hm_device[device_id].adl, &caps)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to get ADL device capabilities");
|
||||
|
||||
@ -14385,7 +14339,7 @@ int main (int argc, char **argv)
|
||||
performance_state->aLevels[0].iMemoryClock = memory_clock_profile_max;
|
||||
performance_state->aLevels[1].iMemoryClock = memory_clock_profile_max;
|
||||
|
||||
if ((ADL_rc = hm_ADL_Overdrive_State_Set (data.hm_adl, data.hm_device[device_id].adapter_index.adl, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
|
||||
if ((ADL_rc = hm_ADL_Overdrive_State_Set (data.hm_adl, data.hm_device[device_id].adl, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
|
||||
{
|
||||
log_info ("ERROR: Failed to set ADL performance state");
|
||||
|
||||
@ -14402,14 +14356,14 @@ int main (int argc, char **argv)
|
||||
// powertune set
|
||||
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
|
||||
|
||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &powertune)) != ADL_OK)
|
||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_adl, data.hm_device[device_id].adl, &powertune)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to get current ADL PowerControl settings");
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adapter_index.adl, powertune.iMaxValue)) != ADL_OK)
|
||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adl, powertune.iMaxValue)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to set new ADL PowerControl values");
|
||||
|
||||
@ -14427,7 +14381,7 @@ int main (int argc, char **argv)
|
||||
|
||||
int powertune_supported = 0;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].adapter_index.nvml, &limit) == NVML_SUCCESS)
|
||||
if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].nvml, &limit) == NVML_SUCCESS)
|
||||
{
|
||||
powertune_supported = 1;
|
||||
}
|
||||
@ -14439,11 +14393,11 @@ int main (int argc, char **argv)
|
||||
unsigned int minLimit;
|
||||
unsigned int maxLimit;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data.hm_nvml, 0, data.hm_device[device_id].adapter_index.nvml, &minLimit, &maxLimit) == NVML_SUCCESS)
|
||||
if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data.hm_nvml, 0, data.hm_device[device_id].nvml, &minLimit, &maxLimit) == NVML_SUCCESS)
|
||||
{
|
||||
if (maxLimit > 0)
|
||||
{
|
||||
if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].adapter_index.nvml, maxLimit) == NVML_SUCCESS)
|
||||
if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].nvml, maxLimit) == NVML_SUCCESS)
|
||||
{
|
||||
// now we can be sure we need to reset later
|
||||
|
||||
@ -15738,21 +15692,6 @@ int main (int argc, char **argv)
|
||||
|
||||
#if defined(HAVE_HWMON)
|
||||
|
||||
/**
|
||||
* Store thermal target temperature so we can send a notice to user
|
||||
*/
|
||||
|
||||
if (gpu_temp_disable == 0)
|
||||
{
|
||||
const int gpu_temp_threshold_slowdown = hm_get_threshold_slowdown_with_device_id (device_id);
|
||||
const int gpu_temp_threshold_shutdown = hm_get_threshold_slowdown_with_device_id (device_id);
|
||||
|
||||
data.hm_device[device_id].gpu_temp_threshold_slowdown = (gpu_temp_threshold_slowdown > 0) ? gpu_temp_threshold_slowdown : 10000;
|
||||
data.hm_device[device_id].gpu_temp_threshold_shutdown = (gpu_temp_threshold_shutdown > 0) ? gpu_temp_threshold_shutdown : 10000;
|
||||
|
||||
// we could use those numbers for gpu_temp_retain and gpu_temp_abort, too
|
||||
}
|
||||
|
||||
/**
|
||||
* Store initial fanspeed if gpu_temp_retain is enabled
|
||||
*/
|
||||
@ -17998,7 +17937,7 @@ int main (int argc, char **argv)
|
||||
|
||||
int powertune_supported = 0;
|
||||
|
||||
if ((hm_ADL_Overdrive6_PowerControl_Caps (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &powertune_supported)) != ADL_OK)
|
||||
if ((hm_ADL_Overdrive6_PowerControl_Caps (data.hm_adl, data.hm_device[device_id].adl, &powertune_supported)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
|
||||
|
||||
@ -18009,7 +17948,7 @@ int main (int argc, char **argv)
|
||||
{
|
||||
// powercontrol settings
|
||||
|
||||
if ((hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adapter_index.adl, od_power_control_status[device_id])) != ADL_OK)
|
||||
if ((hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adl, od_power_control_status[device_id])) != ADL_OK)
|
||||
{
|
||||
log_info ("ERROR: Failed to restore the ADL PowerControl values");
|
||||
|
||||
@ -18027,7 +17966,7 @@ int main (int argc, char **argv)
|
||||
performance_state->aLevels[0].iMemoryClock = od_clock_mem_status[device_id].state.aLevels[0].iMemoryClock;
|
||||
performance_state->aLevels[1].iMemoryClock = od_clock_mem_status[device_id].state.aLevels[1].iMemoryClock;
|
||||
|
||||
if ((hm_ADL_Overdrive_State_Set (data.hm_adl, data.hm_device[device_id].adapter_index.adl, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
|
||||
if ((hm_ADL_Overdrive_State_Set (data.hm_adl, data.hm_device[device_id].adl, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
|
||||
{
|
||||
log_info ("ERROR: Failed to restore ADL performance state");
|
||||
|
||||
@ -18045,7 +17984,7 @@ int main (int argc, char **argv)
|
||||
|
||||
if (limit > 0)
|
||||
{
|
||||
hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].adapter_index.nvml, limit);
|
||||
hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].nvml, limit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
46
src/shared.c
46
src/shared.c
@ -3046,7 +3046,7 @@ int hm_get_adapter_index_adl (hm_attrs_t *hm_device, u32 *valid_adl_device_list,
|
||||
|
||||
int opencl_device_index = i;
|
||||
|
||||
hm_device[opencl_device_index].adapter_index.adl = info.iAdapterIndex;
|
||||
hm_device[opencl_device_index].adl = info.iAdapterIndex;
|
||||
}
|
||||
|
||||
return num_adl_adapters;
|
||||
@ -3069,7 +3069,7 @@ int hm_get_threshold_slowdown_with_device_id (const uint device_id)
|
||||
int CurrentValue = 0;
|
||||
int DefaultValue = 0;
|
||||
|
||||
if (hm_ADL_Overdrive6_TargetTemperatureData_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &CurrentValue, &DefaultValue) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive6_TargetTemperatureData_Get (data.hm_adl, data.hm_device[device_id].adl, &CurrentValue, &DefaultValue) != ADL_OK) return -1;
|
||||
|
||||
// the return value has never been tested since hm_ADL_Overdrive6_TargetTemperatureData_Get() never worked on any system. expect problems.
|
||||
|
||||
@ -3082,7 +3082,7 @@ int hm_get_threshold_slowdown_with_device_id (const uint device_id)
|
||||
{
|
||||
int target = 0;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetTemperatureThreshold (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, NVML_TEMPERATURE_THRESHOLD_SLOWDOWN, (unsigned int *) &target) != NVML_SUCCESS) return -1;
|
||||
if (hm_NVML_nvmlDeviceGetTemperatureThreshold (data.hm_nvml, 1, data.hm_device[device_id].nvml, NVML_TEMPERATURE_THRESHOLD_SLOWDOWN, (unsigned int *) &target) != NVML_SUCCESS) return -1;
|
||||
|
||||
return target;
|
||||
}
|
||||
@ -3113,7 +3113,7 @@ int hm_get_threshold_shutdown_with_device_id (const uint device_id)
|
||||
{
|
||||
int target = 0;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetTemperatureThreshold (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, NVML_TEMPERATURE_THRESHOLD_SHUTDOWN, (unsigned int *) &target) != NVML_SUCCESS) return -1;
|
||||
if (hm_NVML_nvmlDeviceGetTemperatureThreshold (data.hm_nvml, 1, data.hm_device[device_id].nvml, NVML_TEMPERATURE_THRESHOLD_SHUTDOWN, (unsigned int *) &target) != NVML_SUCCESS) return -1;
|
||||
|
||||
return target;
|
||||
}
|
||||
@ -3135,7 +3135,7 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
||||
|
||||
Temperature.iSize = sizeof (ADLTemperature);
|
||||
|
||||
if (hm_ADL_Overdrive5_Temperature_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, 0, &Temperature) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive5_Temperature_Get (data.hm_adl, data.hm_device[device_id].adl, 0, &Temperature) != ADL_OK) return -1;
|
||||
|
||||
return Temperature.iTemperature / 1000;
|
||||
}
|
||||
@ -3143,7 +3143,7 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
||||
{
|
||||
int Temperature = 0;
|
||||
|
||||
if (hm_ADL_Overdrive6_Temperature_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &Temperature) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive6_Temperature_Get (data.hm_adl, data.hm_device[device_id].adl, &Temperature) != ADL_OK) return -1;
|
||||
|
||||
return Temperature / 1000;
|
||||
}
|
||||
@ -3154,7 +3154,7 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
||||
{
|
||||
int temperature = 0;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetTemperature (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, NVML_TEMPERATURE_GPU, (uint *) &temperature) != NVML_SUCCESS) return -1;
|
||||
if (hm_NVML_nvmlDeviceGetTemperature (data.hm_nvml, 1, data.hm_device[device_id].nvml, NVML_TEMPERATURE_GPU, (uint *) &temperature) != NVML_SUCCESS) return -1;
|
||||
|
||||
return temperature;
|
||||
}
|
||||
@ -3181,7 +3181,7 @@ int hm_get_fanpolicy_with_device_id (const uint device_id)
|
||||
lpFanSpeedValue.iSize = sizeof (lpFanSpeedValue);
|
||||
lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
||||
|
||||
if (hm_ADL_Overdrive5_FanSpeed_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive5_FanSpeed_Get (data.hm_adl, data.hm_device[device_id].adl, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||
|
||||
return (lpFanSpeedValue.iFanSpeed & ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED) ? 0 : 1;
|
||||
}
|
||||
@ -3227,7 +3227,7 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
||||
lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
||||
lpFanSpeedValue.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
|
||||
|
||||
if (hm_ADL_Overdrive5_FanSpeed_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive5_FanSpeed_Get (data.hm_adl, data.hm_device[device_id].adl, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||
|
||||
return lpFanSpeedValue.iFanSpeed;
|
||||
}
|
||||
@ -3237,7 +3237,7 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
||||
|
||||
memset (&faninfo, 0, sizeof (faninfo));
|
||||
|
||||
if (hm_ADL_Overdrive6_FanSpeed_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &faninfo) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive6_FanSpeed_Get (data.hm_adl, data.hm_device[device_id].adl, &faninfo) != ADL_OK) return -1;
|
||||
|
||||
return faninfo.iFanSpeedPercent;
|
||||
}
|
||||
@ -3248,7 +3248,7 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
||||
{
|
||||
int speed = 0;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetFanSpeed (data.hm_nvml, 0, data.hm_device[device_id].adapter_index.nvml, (uint *) &speed) != NVML_SUCCESS) return -1;
|
||||
if (hm_NVML_nvmlDeviceGetFanSpeed (data.hm_nvml, 0, data.hm_device[device_id].nvml, (uint *) &speed) != NVML_SUCCESS) return -1;
|
||||
|
||||
return speed;
|
||||
}
|
||||
@ -3269,7 +3269,7 @@ int hm_get_buslanes_with_device_id (const uint device_id)
|
||||
|
||||
PMActivity.iSize = sizeof (ADLPMActivity);
|
||||
|
||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &PMActivity) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adl, &PMActivity) != ADL_OK) return -1;
|
||||
|
||||
return PMActivity.iCurrentBusLanes;
|
||||
}
|
||||
@ -3279,7 +3279,7 @@ int hm_get_buslanes_with_device_id (const uint device_id)
|
||||
{
|
||||
unsigned int currLinkWidth;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, &currLinkWidth) != NVML_SUCCESS) return -1;
|
||||
if (hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (data.hm_nvml, 1, data.hm_device[device_id].nvml, &currLinkWidth) != NVML_SUCCESS) return -1;
|
||||
|
||||
return currLinkWidth;
|
||||
}
|
||||
@ -3299,7 +3299,7 @@ int hm_get_utilization_with_device_id (const uint device_id)
|
||||
|
||||
PMActivity.iSize = sizeof (ADLPMActivity);
|
||||
|
||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &PMActivity) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adl, &PMActivity) != ADL_OK) return -1;
|
||||
|
||||
return PMActivity.iActivityPercent;
|
||||
}
|
||||
@ -3309,7 +3309,7 @@ int hm_get_utilization_with_device_id (const uint device_id)
|
||||
{
|
||||
nvmlUtilization_t utilization;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetUtilizationRates (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, &utilization) != NVML_SUCCESS) return -1;
|
||||
if (hm_NVML_nvmlDeviceGetUtilizationRates (data.hm_nvml, 1, data.hm_device[device_id].nvml, &utilization) != NVML_SUCCESS) return -1;
|
||||
|
||||
return utilization.gpu;
|
||||
}
|
||||
@ -3329,7 +3329,7 @@ int hm_get_memoryspeed_with_device_id (const uint device_id)
|
||||
|
||||
PMActivity.iSize = sizeof (ADLPMActivity);
|
||||
|
||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &PMActivity) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adl, &PMActivity) != ADL_OK) return -1;
|
||||
|
||||
return PMActivity.iMemoryClock / 100;
|
||||
}
|
||||
@ -3339,7 +3339,7 @@ int hm_get_memoryspeed_with_device_id (const uint device_id)
|
||||
{
|
||||
unsigned int clock;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetClockInfo (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, NVML_CLOCK_MEM, &clock) != NVML_SUCCESS) return -1;
|
||||
if (hm_NVML_nvmlDeviceGetClockInfo (data.hm_nvml, 1, data.hm_device[device_id].nvml, NVML_CLOCK_MEM, &clock) != NVML_SUCCESS) return -1;
|
||||
|
||||
return clock;
|
||||
}
|
||||
@ -3359,7 +3359,7 @@ int hm_get_corespeed_with_device_id (const uint device_id)
|
||||
|
||||
PMActivity.iSize = sizeof (ADLPMActivity);
|
||||
|
||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &PMActivity) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adl, &PMActivity) != ADL_OK) return -1;
|
||||
|
||||
return PMActivity.iEngineClock / 100;
|
||||
}
|
||||
@ -3369,7 +3369,7 @@ int hm_get_corespeed_with_device_id (const uint device_id)
|
||||
{
|
||||
unsigned int clock;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetClockInfo (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, NVML_CLOCK_SM, &clock) != NVML_SUCCESS) return -1;
|
||||
if (hm_NVML_nvmlDeviceGetClockInfo (data.hm_nvml, 1, data.hm_device[device_id].nvml, NVML_CLOCK_SM, &clock) != NVML_SUCCESS) return -1;
|
||||
|
||||
return clock;
|
||||
}
|
||||
@ -3391,8 +3391,8 @@ int hm_get_throttle_with_device_id (const uint device_id)
|
||||
unsigned long long clocksThrottleReasons = 0;
|
||||
unsigned long long supportedThrottleReasons = 0;
|
||||
|
||||
if (hm_NVML_nvmlDeviceGetCurrentClocksThrottleReasons (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, &clocksThrottleReasons) != NVML_SUCCESS) return -1;
|
||||
if (hm_NVML_nvmlDeviceGetSupportedClocksThrottleReasons (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, &supportedThrottleReasons) != NVML_SUCCESS) return -1;
|
||||
if (hm_NVML_nvmlDeviceGetCurrentClocksThrottleReasons (data.hm_nvml, 1, data.hm_device[device_id].nvml, &clocksThrottleReasons) != NVML_SUCCESS) return -1;
|
||||
if (hm_NVML_nvmlDeviceGetSupportedClocksThrottleReasons (data.hm_nvml, 1, data.hm_device[device_id].nvml, &supportedThrottleReasons) != NVML_SUCCESS) return -1;
|
||||
|
||||
clocksThrottleReasons &= supportedThrottleReasons;
|
||||
|
||||
@ -3419,7 +3419,7 @@ int hm_set_fanspeed_with_device_id_adl (const uint device_id, const int fanspeed
|
||||
lpFanSpeedValue.iFlags = (fanpolicy == 1) ? ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED : 0;
|
||||
lpFanSpeedValue.iFanSpeed = fanspeed;
|
||||
|
||||
if (hm_ADL_Overdrive5_FanSpeed_Set (data.hm_adl, data.hm_device[device_id].adapter_index.adl, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive5_FanSpeed_Set (data.hm_adl, data.hm_device[device_id].adl, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -3432,7 +3432,7 @@ int hm_set_fanspeed_with_device_id_adl (const uint device_id, const int fanspeed
|
||||
fan_speed_value.iSpeedType = ADL_OD6_FANSPEED_TYPE_PERCENT;
|
||||
fan_speed_value.iFanSpeed = fanspeed;
|
||||
|
||||
if (hm_ADL_Overdrive6_FanSpeed_Set (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &fan_speed_value) != ADL_OK) return -1;
|
||||
if (hm_ADL_Overdrive6_FanSpeed_Set (data.hm_adl, data.hm_device[device_id].adl, &fan_speed_value) != ADL_OK) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user