From 964a901f2afe933a7c9b4cd43ebd95e885f9628c Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Thu, 26 May 2016 12:40:12 +0200 Subject: [PATCH] Allow numbers not power of 2 in autotune --- src/hashcat.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hashcat.c b/src/hashcat.c index 41c70d0cf..ac5d95fac 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -2979,10 +2979,13 @@ static void autotune (hc_device_param_t *device_param) if ((kernel_loops_min < kernel_loops_max) && (kernel_accel_min < kernel_accel_max)) { - for (u32 f = 2; f < 1024; f++) + u32 kernel_accel_orig = kernel_accel; + u32 kernel_loops_orig = kernel_loops; + + for (u32 f = 1; f < 1024; f++) { - const u32 kernel_accel_try = kernel_accel * f; - const u32 kernel_loops_try = kernel_loops / f; + const u32 kernel_accel_try = (float) kernel_accel_orig * f; + const u32 kernel_loops_try = (float) kernel_loops_orig / f; if (kernel_accel_try > kernel_accel_max) break; if (kernel_loops_try < kernel_loops_min) break; @@ -2991,6 +2994,8 @@ static void autotune (hc_device_param_t *device_param) if (diff_new > diff) break; + diff_new = diff; + double exec_ms = try_run (device_param, kernel_accel_try, kernel_loops_try); for (int i = 0; i < VERIFIER_CNT; i++)