mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-03 12:21:07 +00:00
Prepare for reintegration of nvapi for checking thermal limit
This commit is contained in:
parent
7ba1322d7f
commit
3c6296801a
@ -53,8 +53,9 @@
|
|||||||
typedef void *OCL_LIB;
|
typedef void *OCL_LIB;
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#ifdef HAVE_HWMON
|
||||||
typedef void *NV_LIB;
|
typedef void *ADL_LIB;
|
||||||
typedef void *AMD_LIB;
|
typedef void *NVAPI_LIB;
|
||||||
|
typedef void *NVML_LIB;
|
||||||
#ifdef OSX
|
#ifdef OSX
|
||||||
#define __stdcall
|
#define __stdcall
|
||||||
#endif
|
#endif
|
||||||
@ -86,8 +87,9 @@ typedef UINT64 uint64_t;
|
|||||||
typedef HINSTANCE OCL_LIB;
|
typedef HINSTANCE OCL_LIB;
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#ifdef HAVE_HWMON
|
||||||
typedef HINSTANCE NV_LIB;
|
typedef HINSTANCE ADL_LIB;
|
||||||
typedef HINSTANCE AMD_LIB;
|
typedef HINSTANCE NVAPI_LIB;
|
||||||
|
typedef HINSTANCE NVML_LIB;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define mkdir(name,mode) mkdir (name)
|
#define mkdir(name,mode) mkdir (name)
|
||||||
|
@ -269,7 +269,7 @@ typedef void* (__stdcall *ADL_MAIN_MALLOC_CALLBACK )( int );
|
|||||||
* End of declarations from adl_sdk.h and subheaders
|
* End of declarations from adl_sdk.h and subheaders
|
||||||
**/
|
**/
|
||||||
|
|
||||||
typedef int HM_ADAPTER_AMD;
|
typedef int HM_ADAPTER_ADL;
|
||||||
|
|
||||||
#include <shared.h>
|
#include <shared.h>
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ typedef int (*ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET) (int, ADLOD6Paramet
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
AMD_LIB lib;
|
ADL_LIB lib;
|
||||||
|
|
||||||
ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy;
|
ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy;
|
||||||
ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create;
|
ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create;
|
||||||
|
@ -107,7 +107,7 @@ typedef enum nvmlGom_enum
|
|||||||
* End of declarations from nvml.h
|
* End of declarations from nvml.h
|
||||||
**/
|
**/
|
||||||
|
|
||||||
typedef nvmlDevice_t HM_ADAPTER_NV;
|
typedef nvmlDevice_t HM_ADAPTER_NVML;
|
||||||
|
|
||||||
#include <shared.h>
|
#include <shared.h>
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ typedef nvmlReturn_t (*NVML_DEVICE_GET_POWERMANAGEMENTLIMIT) (nvmlDevice_t, unsi
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
NV_LIB lib;
|
NVML_LIB lib;
|
||||||
|
|
||||||
NVML_ERROR_STRING nvmlErrorString;
|
NVML_ERROR_STRING nvmlErrorString;
|
||||||
NVML_INIT nvmlInit;
|
NVML_INIT nvmlInit;
|
||||||
|
@ -116,6 +116,7 @@ static inline int CPU_ISSET (int num, cpu_set_t *cs) { return (cs->count & (1 <
|
|||||||
|
|
||||||
#include "ext_ADL.h"
|
#include "ext_ADL.h"
|
||||||
#include "ext_nvml.h"
|
#include "ext_nvml.h"
|
||||||
|
#include "ext_nvapi.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* shared stuff
|
* shared stuff
|
||||||
@ -1429,20 +1430,20 @@ void fsync (int fd);
|
|||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#ifdef HAVE_HWMON
|
||||||
|
|
||||||
int hm_get_adapter_index_nv (HM_ADAPTER_NV nvGPUHandle[DEVICES_MAX]);
|
int hm_get_adapter_index_nvml (HM_ADAPTER_NVML nvGPUHandle[DEVICES_MAX]);
|
||||||
|
|
||||||
int get_adapters_num_amd (void *adl, int *iNumberAdapters);
|
int get_adapters_num_adl (void *adl, int *iNumberAdapters);
|
||||||
|
|
||||||
int hm_get_adapter_index_amd (hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
int hm_get_adapter_index_adl (hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
||||||
|
|
||||||
LPAdapterInfo hm_get_adapter_info_amd (void *adl, int iNumberAdapters);
|
LPAdapterInfo hm_get_adapter_info_adl (void *adl, int iNumberAdapters);
|
||||||
|
|
||||||
u32 *hm_get_list_valid_adl_adapters (int iNumberAdapters, int *num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
u32 *hm_get_list_valid_adl_adapters (int iNumberAdapters, int *num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
||||||
|
|
||||||
int hm_get_overdrive_version (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
int hm_get_overdrive_version (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
||||||
int hm_check_fanspeed_control (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
int hm_check_fanspeed_control (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
||||||
|
|
||||||
// int hm_get_device_num (void *adl, HM_ADAPTER_AMD hm_adapter_index, int *hm_device_num);
|
// int hm_get_device_num (void *adl, HM_ADAPTER_ADL hm_adapter_index, int *hm_device_num);
|
||||||
// void hm_get_opencl_busid_devid (hm_attrs_t *hm_device, uint opencl_num_devices, cl_device_id *devices);
|
// void hm_get_opencl_busid_devid (hm_attrs_t *hm_device, uint opencl_num_devices, cl_device_id *devices);
|
||||||
|
|
||||||
int hm_get_threshold_slowdown_with_device_id (const uint device_id);
|
int hm_get_threshold_slowdown_with_device_id (const uint device_id);
|
||||||
@ -1455,7 +1456,7 @@ int hm_get_utilization_with_device_id (const uint device_id);
|
|||||||
int hm_get_memoryspeed_with_device_id (const uint device_id);
|
int hm_get_memoryspeed_with_device_id (const uint device_id);
|
||||||
int hm_get_corespeed_with_device_id (const uint device_id);
|
int hm_get_corespeed_with_device_id (const uint device_id);
|
||||||
int hm_get_throttle_with_device_id (const uint device_id);
|
int hm_get_throttle_with_device_id (const uint device_id);
|
||||||
int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed, const int fanpolicy);
|
int hm_set_fanspeed_with_device_id_adl (const uint device_id, const int fanspeed, const int fanpolicy);
|
||||||
|
|
||||||
void hm_device_val_to_str (char *target_buf, int max_buf_size, char *suffix, int value);
|
void hm_device_val_to_str (char *target_buf, int max_buf_size, char *suffix, int value);
|
||||||
#endif // HAVE_HWMON
|
#endif // HAVE_HWMON
|
||||||
|
@ -1087,8 +1087,9 @@ typedef struct
|
|||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
HM_ADAPTER_AMD amd;
|
HM_ADAPTER_ADL adl;
|
||||||
HM_ADAPTER_NV nv;
|
HM_ADAPTER_NVML nvml;
|
||||||
|
HM_ADAPTER_NVAPI nvapi;
|
||||||
|
|
||||||
} adapter_index;
|
} adapter_index;
|
||||||
|
|
||||||
@ -1168,8 +1169,9 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#ifdef HAVE_HWMON
|
||||||
void *hm_nv;
|
void *hm_adl;
|
||||||
void *hm_amd;
|
void *hm_nvml;
|
||||||
|
void *hm_nvapi;
|
||||||
hm_attrs_t hm_device[DEVICES_MAX];
|
hm_attrs_t hm_device[DEVICES_MAX];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -158,8 +158,8 @@ endif
|
|||||||
LINUX_32_OBJS := obj/ext_OpenCL.LINUX.32.o obj/shared.LINUX.32.o obj/rp_kernel_on_cpu.LINUX.32.o obj/ext_ADL.LINUX.32.o obj/ext_nvml.LINUX.32.o
|
LINUX_32_OBJS := obj/ext_OpenCL.LINUX.32.o obj/shared.LINUX.32.o obj/rp_kernel_on_cpu.LINUX.32.o obj/ext_ADL.LINUX.32.o obj/ext_nvml.LINUX.32.o
|
||||||
LINUX_64_OBJS := obj/ext_OpenCL.LINUX.64.o obj/shared.LINUX.64.o obj/rp_kernel_on_cpu.LINUX.64.o obj/ext_ADL.LINUX.64.o obj/ext_nvml.LINUX.64.o
|
LINUX_64_OBJS := obj/ext_OpenCL.LINUX.64.o obj/shared.LINUX.64.o obj/rp_kernel_on_cpu.LINUX.64.o obj/ext_ADL.LINUX.64.o obj/ext_nvml.LINUX.64.o
|
||||||
|
|
||||||
WIN_32_OBJS := obj/ext_OpenCL.WIN.32.o obj/shared.WIN.32.o obj/rp_kernel_on_cpu.WIN.32.o obj/ext_ADL.WIN.32.o obj/ext_nvml.WIN.32.o
|
WIN_32_OBJS := obj/ext_OpenCL.WIN.32.o obj/shared.WIN.32.o obj/rp_kernel_on_cpu.WIN.32.o obj/ext_ADL.WIN.32.o obj/ext_nvml.WIN.32.o obj/ext_nvapi.WIN.32.o
|
||||||
WIN_64_OBJS := obj/ext_OpenCL.WIN.64.o obj/shared.WIN.64.o obj/rp_kernel_on_cpu.WIN.64.o obj/ext_ADL.WIN.64.o obj/ext_nvml.WIN.64.o
|
WIN_64_OBJS := obj/ext_OpenCL.WIN.64.o obj/shared.WIN.64.o obj/rp_kernel_on_cpu.WIN.64.o obj/ext_ADL.WIN.64.o obj/ext_nvml.WIN.64.o obj/ext_nvapi.WIN.64.o
|
||||||
|
|
||||||
##
|
##
|
||||||
## Targets: Global
|
## Targets: Global
|
||||||
|
113
src/hashcat.c
113
src/hashcat.c
@ -4005,7 +4005,7 @@ static void *thread_monitor (void *p)
|
|||||||
{
|
{
|
||||||
if (device_param->device_vendor_id == VENDOR_ID_AMD)
|
if (device_param->device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
hm_set_fanspeed_with_device_id_amd (device_id, fan_speed_new, 1);
|
hm_set_fanspeed_with_device_id_adl (device_id, fan_speed_new, 1);
|
||||||
}
|
}
|
||||||
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
||||||
{
|
{
|
||||||
@ -13995,68 +13995,71 @@ int main (int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#ifdef HAVE_HWMON
|
||||||
hm_attrs_t hm_adapters_nv[DEVICES_MAX] = { { { 0 }, 0, 0, 0, 0, 0 } };
|
hm_attrs_t hm_adapters_adl[DEVICES_MAX] = { { { 0 }, 0, 0, 0, 0, 0 } };
|
||||||
hm_attrs_t hm_adapters_amd[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 } };
|
||||||
|
|
||||||
if (gpu_temp_disable == 0)
|
if (gpu_temp_disable == 0)
|
||||||
{
|
{
|
||||||
NVML_PTR *nvml = (NVML_PTR *) mymalloc (sizeof (NVML_PTR));
|
ADL_PTR *adl = (ADL_PTR *) mymalloc (sizeof (ADL_PTR));
|
||||||
ADL_PTR *adl = (ADL_PTR *) mymalloc (sizeof (ADL_PTR));
|
NVAPI_PTR *nvapi = (NVAPI_PTR *) mymalloc (sizeof (NVAPI_PTR));
|
||||||
|
NVML_PTR *nvml = (NVML_PTR *) mymalloc (sizeof (NVML_PTR));
|
||||||
|
|
||||||
data.hm_amd = NULL;
|
data.hm_adl = NULL;
|
||||||
data.hm_nv = NULL;
|
data.hm_nvapi = NULL;
|
||||||
|
data.hm_nvml = NULL;
|
||||||
|
|
||||||
if ((need_nvml == 1) && (nvml_init (nvml) == 0))
|
if ((need_nvml == 1) && (nvml_init (nvml) == 0))
|
||||||
{
|
{
|
||||||
data.hm_nv = nvml;
|
data.hm_nvml = nvml;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.hm_nv)
|
if (data.hm_nvml)
|
||||||
{
|
{
|
||||||
if (hm_NVML_nvmlInit (data.hm_nv) == NVML_SUCCESS)
|
if (hm_NVML_nvmlInit (data.hm_nvml) == NVML_SUCCESS)
|
||||||
{
|
{
|
||||||
HM_ADAPTER_NV nvGPUHandle[DEVICES_MAX] = { 0 };
|
HM_ADAPTER_NVML nvmlGPUHandle[DEVICES_MAX] = { 0 };
|
||||||
|
|
||||||
int tmp_in = hm_get_adapter_index_nv (nvGPUHandle);
|
int tmp_in = hm_get_adapter_index_nvml (nvmlGPUHandle);
|
||||||
|
|
||||||
int tmp_out = 0;
|
int tmp_out = 0;
|
||||||
|
|
||||||
for (int i = 0; i < tmp_in; i++)
|
for (int i = 0; i < tmp_in; i++)
|
||||||
{
|
{
|
||||||
hm_adapters_nv[tmp_out++].adapter_index.nv = nvGPUHandle[i];
|
hm_adapters_nvml[tmp_out++].adapter_index.nvml = nvmlGPUHandle[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < tmp_out; i++)
|
for (int i = 0; i < tmp_out; i++)
|
||||||
{
|
{
|
||||||
unsigned int speed;
|
unsigned int speed;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetFanSpeed (data.hm_nv, 0, hm_adapters_nv[i].adapter_index.nv, &speed) == NVML_SUCCESS) hm_adapters_nv[i].fan_get_supported = 1;
|
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;
|
||||||
|
|
||||||
hm_NVML_nvmlDeviceSetComputeMode (data.hm_nv, 1, hm_adapters_nv[i].adapter_index.nv, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
|
hm_NVML_nvmlDeviceSetComputeMode (data.hm_nvml, 1, hm_adapters_nvml[i].adapter_index.nvml, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
|
||||||
|
|
||||||
hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nv, 1, hm_adapters_nv[i].adapter_index.nv, NVML_GOM_ALL_ON);
|
hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nvml, 1, hm_adapters_nvml[i].adapter_index.nvml, NVML_GOM_ALL_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((need_adl == 1) && (adl_init (adl) == 0))
|
if ((need_adl == 1) && (adl_init (adl) == 0))
|
||||||
{
|
{
|
||||||
data.hm_amd = adl;
|
data.hm_adl = adl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
if (hm_ADL_Main_Control_Create (data.hm_amd, ADL_Main_Memory_Alloc, 0) == ADL_OK)
|
if (hm_ADL_Main_Control_Create (data.hm_adl, ADL_Main_Memory_Alloc, 0) == ADL_OK)
|
||||||
{
|
{
|
||||||
// total number of adapters
|
// total number of adapters
|
||||||
|
|
||||||
int hm_adapters_num;
|
int hm_adapters_num;
|
||||||
|
|
||||||
if (get_adapters_num_amd (data.hm_amd, &hm_adapters_num) != 0) return (-1);
|
if (get_adapters_num_adl (data.hm_adl, &hm_adapters_num) != 0) return (-1);
|
||||||
|
|
||||||
// adapter info
|
// adapter info
|
||||||
|
|
||||||
LPAdapterInfo lpAdapterInfo = hm_get_adapter_info_amd (data.hm_amd, hm_adapters_num);
|
LPAdapterInfo lpAdapterInfo = hm_get_adapter_info_adl (data.hm_adl, hm_adapters_num);
|
||||||
|
|
||||||
if (lpAdapterInfo == NULL) return (-1);
|
if (lpAdapterInfo == NULL) return (-1);
|
||||||
|
|
||||||
@ -14070,12 +14073,12 @@ int main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
hc_thread_mutex_lock (mux_adl);
|
hc_thread_mutex_lock (mux_adl);
|
||||||
|
|
||||||
// hm_get_opencl_busid_devid (hm_adapters_amd, devices_all_cnt, devices_all);
|
// hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
|
||||||
|
|
||||||
hm_get_adapter_index_amd (hm_adapters_amd, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
|
hm_get_adapter_index_adl (hm_adapters_adl, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
|
||||||
|
|
||||||
hm_get_overdrive_version (data.hm_amd, hm_adapters_amd, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
|
hm_get_overdrive_version (data.hm_adl, hm_adapters_adl, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
|
||||||
hm_check_fanspeed_control (data.hm_amd, hm_adapters_amd, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
|
hm_check_fanspeed_control (data.hm_adl, hm_adapters_adl, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
|
||||||
|
|
||||||
hc_thread_mutex_unlock (mux_adl);
|
hc_thread_mutex_unlock (mux_adl);
|
||||||
}
|
}
|
||||||
@ -14085,7 +14088,7 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.hm_amd == NULL && data.hm_nv == NULL)
|
if (data.hm_adl == NULL && data.hm_nvml == NULL)
|
||||||
{
|
{
|
||||||
gpu_temp_disable = 1;
|
gpu_temp_disable = 1;
|
||||||
}
|
}
|
||||||
@ -14174,7 +14177,7 @@ int main (int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#ifdef HAVE_HWMON
|
||||||
if (gpu_temp_disable == 0 && data.hm_amd == NULL && data.hm_nv == NULL)
|
if (gpu_temp_disable == 0 && data.hm_adl == NULL && data.hm_nvml == NULL)
|
||||||
{
|
{
|
||||||
log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
|
log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
|
||||||
}
|
}
|
||||||
@ -14221,12 +14224,12 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (device_param->device_vendor_id == VENDOR_ID_NV)
|
if (device_param->device_vendor_id == VENDOR_ID_NV)
|
||||||
{
|
{
|
||||||
memcpy (&data.hm_device[device_id], &hm_adapters_nv[platform_devices_id], sizeof (hm_attrs_t));
|
memcpy (&data.hm_device[device_id], &hm_adapters_nvml[platform_devices_id], sizeof (hm_attrs_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_param->device_vendor_id == VENDOR_ID_AMD)
|
if (device_param->device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
memcpy (&data.hm_device[device_id], &hm_adapters_amd[platform_devices_id], sizeof (hm_attrs_t));
|
memcpy (&data.hm_device[device_id], &hm_adapters_adl[platform_devices_id], sizeof (hm_attrs_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14263,7 +14266,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
int powertune_supported = 0;
|
int powertune_supported = 0;
|
||||||
|
|
||||||
if ((ADL_rc = hm_ADL_Overdrive6_PowerControl_Caps (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &powertune_supported)) != ADL_OK)
|
if ((ADL_rc = hm_ADL_Overdrive6_PowerControl_Caps (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &powertune_supported)) != ADL_OK)
|
||||||
{
|
{
|
||||||
log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
|
log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
|
||||||
|
|
||||||
@ -14278,9 +14281,9 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
|
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
|
||||||
|
|
||||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &powertune)) == ADL_OK)
|
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &powertune)) == ADL_OK)
|
||||||
{
|
{
|
||||||
ADL_rc = hm_ADL_Overdrive_PowerControl_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &od_power_control_status[device_id]);
|
ADL_rc = hm_ADL_Overdrive_PowerControl_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &od_power_control_status[device_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ADL_rc != ADL_OK)
|
if (ADL_rc != ADL_OK)
|
||||||
@ -14290,7 +14293,7 @@ int main (int argc, char **argv)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, powertune.iMaxValue)) != ADL_OK)
|
if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adapter_index.adl, powertune.iMaxValue)) != ADL_OK)
|
||||||
{
|
{
|
||||||
log_error ("ERROR: Failed to set new ADL PowerControl values");
|
log_error ("ERROR: Failed to set new ADL PowerControl values");
|
||||||
|
|
||||||
@ -14303,7 +14306,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
od_clock_mem_status[device_id].state.iNumberOfPerformanceLevels = 2;
|
od_clock_mem_status[device_id].state.iNumberOfPerformanceLevels = 2;
|
||||||
|
|
||||||
if ((ADL_rc = hm_ADL_Overdrive_StateInfo_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, 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].adapter_index.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");
|
log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
|
||||||
|
|
||||||
@ -14314,7 +14317,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
ADLOD6Capabilities caps = {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
|
ADLOD6Capabilities caps = {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
|
||||||
|
|
||||||
if ((ADL_rc = hm_ADL_Overdrive_Capabilities_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &caps)) != ADL_OK)
|
if ((ADL_rc = hm_ADL_Overdrive_Capabilities_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &caps)) != ADL_OK)
|
||||||
{
|
{
|
||||||
log_error ("ERROR: Failed to get ADL device capabilities");
|
log_error ("ERROR: Failed to get ADL device capabilities");
|
||||||
|
|
||||||
@ -14351,7 +14354,7 @@ int main (int argc, char **argv)
|
|||||||
performance_state->aLevels[0].iMemoryClock = memory_clock_profile_max;
|
performance_state->aLevels[0].iMemoryClock = memory_clock_profile_max;
|
||||||
performance_state->aLevels[1].iMemoryClock = memory_clock_profile_max;
|
performance_state->aLevels[1].iMemoryClock = memory_clock_profile_max;
|
||||||
|
|
||||||
if ((ADL_rc = hm_ADL_Overdrive_State_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
|
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)
|
||||||
{
|
{
|
||||||
log_info ("ERROR: Failed to set ADL performance state");
|
log_info ("ERROR: Failed to set ADL performance state");
|
||||||
|
|
||||||
@ -14368,14 +14371,14 @@ int main (int argc, char **argv)
|
|||||||
// powertune set
|
// powertune set
|
||||||
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
|
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
|
||||||
|
|
||||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &powertune)) != ADL_OK)
|
if ((ADL_rc = hm_ADL_Overdrive_PowerControlInfo_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &powertune)) != ADL_OK)
|
||||||
{
|
{
|
||||||
log_error ("ERROR: Failed to get current ADL PowerControl settings");
|
log_error ("ERROR: Failed to get current ADL PowerControl settings");
|
||||||
|
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, powertune.iMaxValue)) != ADL_OK)
|
if ((ADL_rc = hm_ADL_Overdrive_PowerControl_Set (data.hm_adl, data.hm_device[device_id].adapter_index.adl, powertune.iMaxValue)) != ADL_OK)
|
||||||
{
|
{
|
||||||
log_error ("ERROR: Failed to set new ADL PowerControl values");
|
log_error ("ERROR: Failed to set new ADL PowerControl values");
|
||||||
|
|
||||||
@ -14393,7 +14396,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
int powertune_supported = 0;
|
int powertune_supported = 0;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data.hm_nv, 0, data.hm_device[device_id].adapter_index.nv, &limit) == NVML_SUCCESS)
|
if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].adapter_index.nvml, &limit) == NVML_SUCCESS)
|
||||||
{
|
{
|
||||||
powertune_supported = 1;
|
powertune_supported = 1;
|
||||||
}
|
}
|
||||||
@ -14405,11 +14408,11 @@ int main (int argc, char **argv)
|
|||||||
unsigned int minLimit;
|
unsigned int minLimit;
|
||||||
unsigned int maxLimit;
|
unsigned int maxLimit;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data.hm_nv, 0, data.hm_device[device_id].adapter_index.nv, &minLimit, &maxLimit) == NVML_SUCCESS)
|
if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data.hm_nvml, 0, data.hm_device[device_id].adapter_index.nvml, &minLimit, &maxLimit) == NVML_SUCCESS)
|
||||||
{
|
{
|
||||||
if (maxLimit > 0)
|
if (maxLimit > 0)
|
||||||
{
|
{
|
||||||
if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nv, 0, data.hm_device[device_id].adapter_index.nv, maxLimit) == NVML_SUCCESS)
|
if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].adapter_index.nvml, maxLimit) == NVML_SUCCESS)
|
||||||
{
|
{
|
||||||
// now we can be sure we need to reset later
|
// now we can be sure we need to reset later
|
||||||
|
|
||||||
@ -15748,7 +15751,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (device_param->device_vendor_id == VENDOR_ID_AMD)
|
if (device_param->device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
rc = hm_set_fanspeed_with_device_id_amd (device_id, fanspeed, 1);
|
rc = hm_set_fanspeed_with_device_id_adl (device_id, fanspeed, 1);
|
||||||
}
|
}
|
||||||
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
||||||
{
|
{
|
||||||
@ -17928,7 +17931,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (device_param->device_vendor_id == VENDOR_ID_AMD)
|
if (device_param->device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
rc = hm_set_fanspeed_with_device_id_amd (device_id, fanspeed, 0);
|
rc = hm_set_fanspeed_with_device_id_adl (device_id, fanspeed, 0);
|
||||||
}
|
}
|
||||||
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
||||||
{
|
{
|
||||||
@ -17964,7 +17967,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
int powertune_supported = 0;
|
int powertune_supported = 0;
|
||||||
|
|
||||||
if ((hm_ADL_Overdrive6_PowerControl_Caps (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &powertune_supported)) != ADL_OK)
|
if ((hm_ADL_Overdrive6_PowerControl_Caps (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &powertune_supported)) != ADL_OK)
|
||||||
{
|
{
|
||||||
log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
|
log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
|
||||||
|
|
||||||
@ -17975,7 +17978,7 @@ int main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
// powercontrol settings
|
// powercontrol settings
|
||||||
|
|
||||||
if ((hm_ADL_Overdrive_PowerControl_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, od_power_control_status[device_id])) != ADL_OK)
|
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)
|
||||||
{
|
{
|
||||||
log_info ("ERROR: Failed to restore the ADL PowerControl values");
|
log_info ("ERROR: Failed to restore the ADL PowerControl values");
|
||||||
|
|
||||||
@ -17993,7 +17996,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[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;
|
performance_state->aLevels[1].iMemoryClock = od_clock_mem_status[device_id].state.aLevels[1].iMemoryClock;
|
||||||
|
|
||||||
if ((hm_ADL_Overdrive_State_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
|
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)
|
||||||
{
|
{
|
||||||
log_info ("ERROR: Failed to restore ADL performance state");
|
log_info ("ERROR: Failed to restore ADL performance state");
|
||||||
|
|
||||||
@ -18011,7 +18014,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (limit > 0)
|
if (limit > 0)
|
||||||
{
|
{
|
||||||
hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nv, 0, data.hm_device[device_id].adapter_index.nv, limit);
|
hm_NVML_nvmlDeviceSetPowerManagementLimit (data.hm_nvml, 0, data.hm_device[device_id].adapter_index.nvml, limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18021,22 +18024,22 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (gpu_temp_disable == 0)
|
if (gpu_temp_disable == 0)
|
||||||
{
|
{
|
||||||
if (data.hm_nv)
|
if (data.hm_nvml)
|
||||||
{
|
{
|
||||||
hm_NVML_nvmlShutdown (data.hm_nv);
|
hm_NVML_nvmlShutdown (data.hm_nvml);
|
||||||
|
|
||||||
nvml_close (data.hm_nv);
|
nvml_close (data.hm_nvml);
|
||||||
|
|
||||||
data.hm_nv = NULL;
|
data.hm_nvml = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
hm_ADL_Main_Control_Destroy (data.hm_amd);
|
hm_ADL_Main_Control_Destroy (data.hm_adl);
|
||||||
|
|
||||||
adl_close (data.hm_amd);
|
adl_close (data.hm_adl);
|
||||||
|
|
||||||
data.hm_amd = NULL;
|
data.hm_adl = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // HAVE_HWMON
|
#endif // HAVE_HWMON
|
||||||
|
82
src/shared.c
82
src/shared.c
@ -2672,17 +2672,17 @@ void fsync (int fd)
|
|||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#ifdef HAVE_HWMON
|
||||||
|
|
||||||
int hm_get_adapter_index_nv (HM_ADAPTER_NV nvGPUHandle[DEVICES_MAX])
|
int hm_get_adapter_index_nvml (HM_ADAPTER_NVML nvGPUHandle[DEVICES_MAX])
|
||||||
{
|
{
|
||||||
int pGpuCount = 0;
|
int pGpuCount = 0;
|
||||||
|
|
||||||
for (uint i = 0; i < DEVICES_MAX; i++)
|
for (uint i = 0; i < DEVICES_MAX; i++)
|
||||||
{
|
{
|
||||||
if (hm_NVML_nvmlDeviceGetHandleByIndex (data.hm_nv, 1, i, &nvGPUHandle[i]) != NVML_SUCCESS) break;
|
if (hm_NVML_nvmlDeviceGetHandleByIndex (data.hm_nvml, 1, i, &nvGPUHandle[i]) != NVML_SUCCESS) break;
|
||||||
|
|
||||||
// can be used to determine if the device by index matches the cuda device by index
|
// can be used to determine if the device by index matches the cuda device by index
|
||||||
// char name[100]; memset (name, 0, sizeof (name));
|
// char name[100]; memset (name, 0, sizeof (name));
|
||||||
// hm_NVML_nvmlDeviceGetName (data.hm_nv, nvGPUHandle[i], name, sizeof (name) - 1);
|
// hm_NVML_nvmlDeviceGetName (data.hm_nvml, nvGPUHandle[i], name, sizeof (name) - 1);
|
||||||
|
|
||||||
pGpuCount++;
|
pGpuCount++;
|
||||||
}
|
}
|
||||||
@ -2697,7 +2697,7 @@ int hm_get_adapter_index_nv (HM_ADAPTER_NV nvGPUHandle[DEVICES_MAX])
|
|||||||
return (pGpuCount);
|
return (pGpuCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_adapters_num_amd (void *adl, int *iNumberAdapters)
|
int get_adapters_num_adl (void *adl, int *iNumberAdapters)
|
||||||
{
|
{
|
||||||
if (hm_ADL_Adapter_NumberOfAdapters_Get ((ADL_PTR *) adl, iNumberAdapters) != ADL_OK) return -1;
|
if (hm_ADL_Adapter_NumberOfAdapters_Get ((ADL_PTR *) adl, iNumberAdapters) != ADL_OK) return -1;
|
||||||
|
|
||||||
@ -2747,7 +2747,7 @@ int hm_show_performance_level (HM_LIB hm_dll, int iAdapterIndex)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LPAdapterInfo hm_get_adapter_info_amd (void *adl, int iNumberAdapters)
|
LPAdapterInfo hm_get_adapter_info_adl (void *adl, int iNumberAdapters)
|
||||||
{
|
{
|
||||||
size_t AdapterInfoSize = iNumberAdapters * sizeof (AdapterInfo);
|
size_t AdapterInfoSize = iNumberAdapters * sizeof (AdapterInfo);
|
||||||
|
|
||||||
@ -2760,7 +2760,7 @@ LPAdapterInfo hm_get_adapter_info_amd (void *adl, int iNumberAdapters)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
//
|
//
|
||||||
// does not help at all, since AMD does not assign different bus id, device id when we have multi GPU setups
|
// does not help at all, since ADL does not assign different bus id, device id when we have multi GPU setups
|
||||||
//
|
//
|
||||||
|
|
||||||
int hm_get_opencl_device_index (hm_attrs_t *hm_device, uint num_adl_adapters, int bus_num, int dev_num)
|
int hm_get_opencl_device_index (hm_attrs_t *hm_device, uint num_adl_adapters, int bus_num, int dev_num)
|
||||||
@ -3012,7 +3012,7 @@ int hm_get_overdrive_version (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_d
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hm_get_adapter_index_amd (hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo)
|
int hm_get_adapter_index_adl (hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < num_adl_adapters; i++)
|
for (int i = 0; i < num_adl_adapters; i++)
|
||||||
{
|
{
|
||||||
@ -3030,7 +3030,7 @@ int hm_get_adapter_index_amd (hm_attrs_t *hm_device, u32 *valid_adl_device_list,
|
|||||||
|
|
||||||
int opencl_device_index = i;
|
int opencl_device_index = i;
|
||||||
|
|
||||||
hm_device[opencl_device_index].adapter_index.amd = info.iAdapterIndex;
|
hm_device[opencl_device_index].adapter_index.adl = info.iAdapterIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
return num_adl_adapters;
|
return num_adl_adapters;
|
||||||
@ -3042,7 +3042,7 @@ int hm_get_threshold_slowdown_with_device_id (const uint device_id)
|
|||||||
|
|
||||||
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
if (data.hm_device[device_id].od_version == 5)
|
if (data.hm_device[device_id].od_version == 5)
|
||||||
{
|
{
|
||||||
@ -3053,7 +3053,7 @@ int hm_get_threshold_slowdown_with_device_id (const uint device_id)
|
|||||||
int CurrentValue = 0;
|
int CurrentValue = 0;
|
||||||
int DefaultValue = 0;
|
int DefaultValue = 0;
|
||||||
|
|
||||||
if (hm_ADL_Overdrive6_TargetTemperatureData_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &CurrentValue, &DefaultValue) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive6_TargetTemperatureData_Get (data.hm_adl, data.hm_device[device_id].adapter_index.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.
|
// the return value has never been tested since hm_ADL_Overdrive6_TargetTemperatureData_Get() never worked on any system. expect problems.
|
||||||
|
|
||||||
@ -3066,7 +3066,7 @@ int hm_get_threshold_slowdown_with_device_id (const uint device_id)
|
|||||||
{
|
{
|
||||||
int target = 0;
|
int target = 0;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetTemperatureThreshold (data.hm_nv, 1, data.hm_device[device_id].adapter_index.nv, NVML_TEMPERATURE_THRESHOLD_SLOWDOWN, (unsigned int *) &target) != NVML_SUCCESS) return -1;
|
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;
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
@ -3080,7 +3080,7 @@ int hm_get_threshold_shutdown_with_device_id (const uint device_id)
|
|||||||
|
|
||||||
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
if (data.hm_device[device_id].od_version == 5)
|
if (data.hm_device[device_id].od_version == 5)
|
||||||
{
|
{
|
||||||
@ -3097,7 +3097,7 @@ int hm_get_threshold_shutdown_with_device_id (const uint device_id)
|
|||||||
{
|
{
|
||||||
int target = 0;
|
int target = 0;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetTemperatureThreshold (data.hm_nv, 1, data.hm_device[device_id].adapter_index.nv, NVML_TEMPERATURE_THRESHOLD_SHUTDOWN, (unsigned int *) &target) != NVML_SUCCESS) return -1;
|
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;
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
@ -3111,7 +3111,7 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
|||||||
|
|
||||||
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
if (data.hm_device[device_id].od_version == 5)
|
if (data.hm_device[device_id].od_version == 5)
|
||||||
{
|
{
|
||||||
@ -3119,7 +3119,7 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
|||||||
|
|
||||||
Temperature.iSize = sizeof (ADLTemperature);
|
Temperature.iSize = sizeof (ADLTemperature);
|
||||||
|
|
||||||
if (hm_ADL_Overdrive5_Temperature_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, 0, &Temperature) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive5_Temperature_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, 0, &Temperature) != ADL_OK) return -1;
|
||||||
|
|
||||||
return Temperature.iTemperature / 1000;
|
return Temperature.iTemperature / 1000;
|
||||||
}
|
}
|
||||||
@ -3127,7 +3127,7 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
|||||||
{
|
{
|
||||||
int Temperature = 0;
|
int Temperature = 0;
|
||||||
|
|
||||||
if (hm_ADL_Overdrive6_Temperature_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &Temperature) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive6_Temperature_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &Temperature) != ADL_OK) return -1;
|
||||||
|
|
||||||
return Temperature / 1000;
|
return Temperature / 1000;
|
||||||
}
|
}
|
||||||
@ -3138,7 +3138,7 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
|||||||
{
|
{
|
||||||
int temperature = 0;
|
int temperature = 0;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetTemperature (data.hm_nv, 1, data.hm_device[device_id].adapter_index.nv, NVML_TEMPERATURE_GPU, (uint *) &temperature) != NVML_SUCCESS) return -1;
|
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;
|
||||||
|
|
||||||
return temperature;
|
return temperature;
|
||||||
}
|
}
|
||||||
@ -3154,7 +3154,7 @@ int hm_get_fanpolicy_with_device_id (const uint device_id)
|
|||||||
{
|
{
|
||||||
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
if (data.hm_device[device_id].od_version == 5)
|
if (data.hm_device[device_id].od_version == 5)
|
||||||
{
|
{
|
||||||
@ -3165,7 +3165,7 @@ int hm_get_fanpolicy_with_device_id (const uint device_id)
|
|||||||
lpFanSpeedValue.iSize = sizeof (lpFanSpeedValue);
|
lpFanSpeedValue.iSize = sizeof (lpFanSpeedValue);
|
||||||
lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
||||||
|
|
||||||
if (hm_ADL_Overdrive5_FanSpeed_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive5_FanSpeed_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||||
|
|
||||||
return (lpFanSpeedValue.iFanSpeed & ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED) ? 0 : 1;
|
return (lpFanSpeedValue.iFanSpeed & ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED) ? 0 : 1;
|
||||||
}
|
}
|
||||||
@ -3199,7 +3199,7 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
|||||||
{
|
{
|
||||||
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
if (data.hm_device[device_id].od_version == 5)
|
if (data.hm_device[device_id].od_version == 5)
|
||||||
{
|
{
|
||||||
@ -3211,7 +3211,7 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
|||||||
lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
||||||
lpFanSpeedValue.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
|
lpFanSpeedValue.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
|
||||||
|
|
||||||
if (hm_ADL_Overdrive5_FanSpeed_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive5_FanSpeed_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||||
|
|
||||||
return lpFanSpeedValue.iFanSpeed;
|
return lpFanSpeedValue.iFanSpeed;
|
||||||
}
|
}
|
||||||
@ -3221,7 +3221,7 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
|||||||
|
|
||||||
memset (&faninfo, 0, sizeof (faninfo));
|
memset (&faninfo, 0, sizeof (faninfo));
|
||||||
|
|
||||||
if (hm_ADL_Overdrive6_FanSpeed_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &faninfo) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive6_FanSpeed_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &faninfo) != ADL_OK) return -1;
|
||||||
|
|
||||||
return faninfo.iFanSpeedPercent;
|
return faninfo.iFanSpeedPercent;
|
||||||
}
|
}
|
||||||
@ -3232,7 +3232,7 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
|||||||
{
|
{
|
||||||
int speed = 0;
|
int speed = 0;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetFanSpeed (data.hm_nv, 0, data.hm_device[device_id].adapter_index.nv, (uint *) &speed) != NVML_SUCCESS) return -1;
|
if (hm_NVML_nvmlDeviceGetFanSpeed (data.hm_nvml, 0, data.hm_device[device_id].adapter_index.nvml, (uint *) &speed) != NVML_SUCCESS) return -1;
|
||||||
|
|
||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
@ -3247,13 +3247,13 @@ int hm_get_buslanes_with_device_id (const uint device_id)
|
|||||||
|
|
||||||
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
ADLPMActivity PMActivity;
|
ADLPMActivity PMActivity;
|
||||||
|
|
||||||
PMActivity.iSize = sizeof (ADLPMActivity);
|
PMActivity.iSize = sizeof (ADLPMActivity);
|
||||||
|
|
||||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &PMActivity) != ADL_OK) return -1;
|
||||||
|
|
||||||
return PMActivity.iCurrentBusLanes;
|
return PMActivity.iCurrentBusLanes;
|
||||||
}
|
}
|
||||||
@ -3263,7 +3263,7 @@ int hm_get_buslanes_with_device_id (const uint device_id)
|
|||||||
{
|
{
|
||||||
unsigned int currLinkWidth;
|
unsigned int currLinkWidth;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (data.hm_nv, 1, data.hm_device[device_id].adapter_index.nv, &currLinkWidth) != NVML_SUCCESS) return -1;
|
if (hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, &currLinkWidth) != NVML_SUCCESS) return -1;
|
||||||
|
|
||||||
return currLinkWidth;
|
return currLinkWidth;
|
||||||
}
|
}
|
||||||
@ -3277,13 +3277,13 @@ int hm_get_utilization_with_device_id (const uint device_id)
|
|||||||
|
|
||||||
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
ADLPMActivity PMActivity;
|
ADLPMActivity PMActivity;
|
||||||
|
|
||||||
PMActivity.iSize = sizeof (ADLPMActivity);
|
PMActivity.iSize = sizeof (ADLPMActivity);
|
||||||
|
|
||||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &PMActivity) != ADL_OK) return -1;
|
||||||
|
|
||||||
return PMActivity.iActivityPercent;
|
return PMActivity.iActivityPercent;
|
||||||
}
|
}
|
||||||
@ -3293,7 +3293,7 @@ int hm_get_utilization_with_device_id (const uint device_id)
|
|||||||
{
|
{
|
||||||
nvmlUtilization_t utilization;
|
nvmlUtilization_t utilization;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetUtilizationRates (data.hm_nv, 1, data.hm_device[device_id].adapter_index.nv, &utilization) != NVML_SUCCESS) return -1;
|
if (hm_NVML_nvmlDeviceGetUtilizationRates (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, &utilization) != NVML_SUCCESS) return -1;
|
||||||
|
|
||||||
return utilization.gpu;
|
return utilization.gpu;
|
||||||
}
|
}
|
||||||
@ -3307,13 +3307,13 @@ int hm_get_memoryspeed_with_device_id (const uint device_id)
|
|||||||
|
|
||||||
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
ADLPMActivity PMActivity;
|
ADLPMActivity PMActivity;
|
||||||
|
|
||||||
PMActivity.iSize = sizeof (ADLPMActivity);
|
PMActivity.iSize = sizeof (ADLPMActivity);
|
||||||
|
|
||||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &PMActivity) != ADL_OK) return -1;
|
||||||
|
|
||||||
return PMActivity.iMemoryClock / 100;
|
return PMActivity.iMemoryClock / 100;
|
||||||
}
|
}
|
||||||
@ -3323,7 +3323,7 @@ int hm_get_memoryspeed_with_device_id (const uint device_id)
|
|||||||
{
|
{
|
||||||
unsigned int clock;
|
unsigned int clock;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetClockInfo (data.hm_nv, 1, data.hm_device[device_id].adapter_index.nv, NVML_CLOCK_MEM, &clock) != NVML_SUCCESS) return -1;
|
if (hm_NVML_nvmlDeviceGetClockInfo (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, NVML_CLOCK_MEM, &clock) != NVML_SUCCESS) return -1;
|
||||||
|
|
||||||
return clock;
|
return clock;
|
||||||
}
|
}
|
||||||
@ -3337,13 +3337,13 @@ int hm_get_corespeed_with_device_id (const uint device_id)
|
|||||||
|
|
||||||
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
|
||||||
{
|
{
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
ADLPMActivity PMActivity;
|
ADLPMActivity PMActivity;
|
||||||
|
|
||||||
PMActivity.iSize = sizeof (ADLPMActivity);
|
PMActivity.iSize = sizeof (ADLPMActivity);
|
||||||
|
|
||||||
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &PMActivity) != ADL_OK) return -1;
|
||||||
|
|
||||||
return PMActivity.iEngineClock / 100;
|
return PMActivity.iEngineClock / 100;
|
||||||
}
|
}
|
||||||
@ -3353,7 +3353,7 @@ int hm_get_corespeed_with_device_id (const uint device_id)
|
|||||||
{
|
{
|
||||||
unsigned int clock;
|
unsigned int clock;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetClockInfo (data.hm_nv, 1, data.hm_device[device_id].adapter_index.nv, NVML_CLOCK_SM, &clock) != NVML_SUCCESS) return -1;
|
if (hm_NVML_nvmlDeviceGetClockInfo (data.hm_nvml, 1, data.hm_device[device_id].adapter_index.nvml, NVML_CLOCK_SM, &clock) != NVML_SUCCESS) return -1;
|
||||||
|
|
||||||
return clock;
|
return clock;
|
||||||
}
|
}
|
||||||
@ -3375,8 +3375,8 @@ int hm_get_throttle_with_device_id (const uint device_id)
|
|||||||
unsigned long long clocksThrottleReasons = 0;
|
unsigned long long clocksThrottleReasons = 0;
|
||||||
unsigned long long supportedThrottleReasons = 0;
|
unsigned long long supportedThrottleReasons = 0;
|
||||||
|
|
||||||
if (hm_NVML_nvmlDeviceGetCurrentClocksThrottleReasons (data.hm_nv, 1, data.hm_device[device_id].adapter_index.nv, &clocksThrottleReasons) != NVML_SUCCESS) return -1;
|
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_nv, 1, data.hm_device[device_id].adapter_index.nv, &supportedThrottleReasons) != 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;
|
||||||
|
|
||||||
clocksThrottleReasons &= supportedThrottleReasons;
|
clocksThrottleReasons &= supportedThrottleReasons;
|
||||||
|
|
||||||
@ -3386,11 +3386,11 @@ int hm_get_throttle_with_device_id (const uint device_id)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed, const int fanpolicy)
|
int hm_set_fanspeed_with_device_id_adl (const uint device_id, const int fanspeed, const int fanpolicy)
|
||||||
{
|
{
|
||||||
if (data.hm_device[device_id].fan_set_supported == 1)
|
if (data.hm_device[device_id].fan_set_supported == 1)
|
||||||
{
|
{
|
||||||
if (data.hm_amd)
|
if (data.hm_adl)
|
||||||
{
|
{
|
||||||
if (data.hm_device[device_id].od_version == 5)
|
if (data.hm_device[device_id].od_version == 5)
|
||||||
{
|
{
|
||||||
@ -3403,7 +3403,7 @@ int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed
|
|||||||
lpFanSpeedValue.iFlags = (fanpolicy == 1) ? ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED : 0;
|
lpFanSpeedValue.iFlags = (fanpolicy == 1) ? ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED : 0;
|
||||||
lpFanSpeedValue.iFanSpeed = fanspeed;
|
lpFanSpeedValue.iFanSpeed = fanspeed;
|
||||||
|
|
||||||
if (hm_ADL_Overdrive5_FanSpeed_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive5_FanSpeed_Set (data.hm_adl, data.hm_device[device_id].adapter_index.adl, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3416,7 +3416,7 @@ int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed
|
|||||||
fan_speed_value.iSpeedType = ADL_OD6_FANSPEED_TYPE_PERCENT;
|
fan_speed_value.iSpeedType = ADL_OD6_FANSPEED_TYPE_PERCENT;
|
||||||
fan_speed_value.iFanSpeed = fanspeed;
|
fan_speed_value.iFanSpeed = fanspeed;
|
||||||
|
|
||||||
if (hm_ADL_Overdrive6_FanSpeed_Set (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &fan_speed_value) != ADL_OK) return -1;
|
if (hm_ADL_Overdrive6_FanSpeed_Set (data.hm_adl, data.hm_device[device_id].adapter_index.adl, &fan_speed_value) != ADL_OK) return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user