From d0ad5164229e2e6f4d1dd4d8ff8f79acbe40742b Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Sat, 16 Nov 2019 12:41:59 +0100 Subject: [PATCH] Add some accel and thread limits to -m 21700 and -m 21800 for a smoother benchmark and checkpoint experience --- src/modules/module_21700.c | 21 +++++++++++++++++++-- src/modules/module_21800.c | 21 +++++++++++++++++++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/modules/module_21700.c b/src/modules/module_21700.c index 63e2c4e1f..277eb9af5 100644 --- a/src/modules/module_21700.c +++ b/src/modules/module_21700.c @@ -82,6 +82,23 @@ typedef struct electrum_hook_salt static const char *SIGNATURE_ELECTRUM = "$electrum$4*"; +#define M21700_MAX_ACCEL 1 +#define M21700_MAX_THREADS 8 + +u32 module_kernel_accel_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_accel_max = (user_options->kernel_accel_chgd == true) ? user_options->kernel_accel : M21700_MAX_ACCEL; + + return kernel_accel_max; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : M21700_MAX_THREADS; + + return kernel_threads_max; +} + void module_hook23 (hc_device_param_t *device_param, const void *hook_salts_buf, const u32 salt_pos, const u64 pw_pos) { electrum_hook_t *hook_items = (electrum_hook_t *) device_param->hooks_buf; @@ -371,11 +388,11 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_hook_size = module_hook_size; module_ctx->module_jit_build_options = module_jit_build_options; module_ctx->module_jit_cache_disable = MODULE_DEFAULT; - module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = module_kernel_accel_max; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_loops_max = MODULE_DEFAULT; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; - module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; module_ctx->module_kern_type = module_kern_type; module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; diff --git a/src/modules/module_21800.c b/src/modules/module_21800.c index d092ef0dd..0b7550087 100644 --- a/src/modules/module_21800.c +++ b/src/modules/module_21800.c @@ -79,6 +79,23 @@ typedef struct electrum_hook_salt static const char *SIGNATURE_ELECTRUM = "$electrum$5*"; +#define M21800_MAX_ACCEL 1 +#define M21800_MAX_THREADS 8 + +u32 module_kernel_accel_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_accel_max = (user_options->kernel_accel_chgd == true) ? user_options->kernel_accel : M21800_MAX_ACCEL; + + return kernel_accel_max; +} + +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : M21800_MAX_THREADS; + + return kernel_threads_max; +} + void module_hook23 (hc_device_param_t *device_param, const void *hook_salts_buf, const u32 salt_pos, const u64 pw_pos) { electrum_hook_t *hook_items = (electrum_hook_t *) device_param->hooks_buf; @@ -499,11 +516,11 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_hook_size = module_hook_size; module_ctx->module_jit_build_options = module_jit_build_options; module_ctx->module_jit_cache_disable = MODULE_DEFAULT; - module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = module_kernel_accel_max; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_loops_max = MODULE_DEFAULT; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; - module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; module_ctx->module_kern_type = module_kern_type; module_ctx->module_kern_type_dynamic = MODULE_DEFAULT;