1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-02-02 19:01:09 +00:00

Added support for --powertune-enable for AMD-GPU-PRO driver

This commit is contained in:
jsteube 2016-11-10 17:05:26 +01:00
parent 779662ea23
commit 12ea82b821
2 changed files with 262 additions and 208 deletions

View File

@ -16,6 +16,8 @@
- Reduce max. number of allowed function calls per rule from 256 to 32 to save GPU memory - Reduce max. number of allowed function calls per rule from 256 to 32 to save GPU memory
- Status display shows what's the base and modifier keyspace currently in use - Status display shows what's the base and modifier keyspace currently in use
- Added a workaround for some OpenCL kernel to compile with amd-gpu-pro - Added a workaround for some OpenCL kernel to compile with amd-gpu-pro
- Added hardware management support (temperature, clocks, fans) for AMD-GPU-PRO driver
- Added support for --powertune-enable for AMD-GPU-PRO driver
- Added option --keep-guessing to continue cracking hashes even after they have been cracked (to find collisions) - Added option --keep-guessing to continue cracking hashes even after they have been cracked (to find collisions)
- Fixed a bug when cracking a large salted hashlist: If a word is rejected this produces so high CPU load that cracking process doesn't start - Fixed a bug when cracking a large salted hashlist: If a word is rejected this produces so high CPU load that cracking process doesn't start

View File

@ -420,6 +420,36 @@ static int hm_SYSFS_get_pp_dpm_pcie (hashcat_ctx_t *hashcat_ctx, const int devic
return 0; return 0;
} }
static int hm_SYSFS_set_power_dpm_force_performance_level (hashcat_ctx_t *hashcat_ctx, const int device_id, char *val)
{
char *syspath = hm_SYSFS_get_syspath_device (hashcat_ctx, device_id);
if (syspath == NULL) return -1;
char *path = hcmalloc (hashcat_ctx, HCBUFSIZ_TINY);
snprintf (path, HCBUFSIZ_TINY - 1, "%s/power_dpm_force_performance_level", syspath);
FILE *fd = fopen (path, "w");
if (fd == NULL)
{
event_log_error (hashcat_ctx, "%s: %s", path, strerror (errno));
return -1;
}
fprintf (fd, "%s", val);
fclose (fd);
hcfree (syspath);
hcfree (path);
return 0;
}
// nvml functions // nvml functions
static int nvml_init (hashcat_ctx_t *hashcat_ctx) static int nvml_init (hashcat_ctx_t *hashcat_ctx)
@ -3500,6 +3530,8 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
* powertune on user request * powertune on user request
*/ */
if (user_options->powertune_enable == true)
{
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{ {
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -3507,6 +3539,8 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (device_param->skipped) continue; if (device_param->skipped) continue;
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_AMD) if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
{
if (hwmon_ctx->hm_adl)
{ {
/** /**
* Temporary fix: * Temporary fix:
@ -3646,6 +3680,12 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
} }
} }
if (hwmon_ctx->hm_sysfs)
{
hm_SYSFS_set_power_dpm_force_performance_level (hashcat_ctx, device_id, "high");
}
}
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV) if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
{ {
// first backup current value, we will restore it later // first backup current value, we will restore it later
@ -3681,12 +3721,13 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
} }
} }
} }
}
/** /**
* Store initial fanspeed if gpu_temp_retain is enabled * Store initial fanspeed if gpu_temp_retain is enabled
*/ */
if (user_options->gpu_temp_retain) if (user_options->gpu_temp_retain > 0)
{ {
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{ {
@ -3765,7 +3806,7 @@ void hwmon_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
// reset default fan speed // reset default fan speed
if (user_options->gpu_temp_retain) if (user_options->gpu_temp_retain > 0)
{ {
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{ {
@ -3809,6 +3850,8 @@ void hwmon_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
// reset power tuning // reset power tuning
if (user_options->powertune_enable == true)
{
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{ {
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -3816,6 +3859,8 @@ void hwmon_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
if (device_param->skipped) continue; if (device_param->skipped) continue;
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_AMD) if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
{
if (hwmon_ctx->hm_adl)
{ {
if (hwmon_ctx->hm_device[device_id].od_version == 6) if (hwmon_ctx->hm_device[device_id].od_version == 6)
{ {
@ -3864,6 +3909,12 @@ void hwmon_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
} }
} }
if (hwmon_ctx->hm_sysfs)
{
hm_SYSFS_set_power_dpm_force_performance_level (hashcat_ctx, device_id, "auto");
}
}
if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV) if (opencl_ctx->devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
{ {
unsigned int power_limit = hwmon_ctx->nvml_power_limit[device_id]; unsigned int power_limit = hwmon_ctx->nvml_power_limit[device_id];
@ -3874,6 +3925,7 @@ void hwmon_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
} }
} }
} }
}
// unload shared libraries // unload shared libraries