diff --git a/kernel/marucoin-mod.cl b/kernel/marucoin-mod.cl index a5513634..1618efce 100644 --- a/kernel/marucoin-mod.cl +++ b/kernel/marucoin-mod.cl @@ -75,7 +75,9 @@ typedef long sph_s64; #define SPH_GROESTL_BIG_ENDIAN 0 #define SPH_CUBEHASH_UNROLL 0 #define SPH_KECCAK_UNROLL 0 +#if !defined SPH_HAMSI_EXPAND_BIG #define SPH_HAMSI_EXPAND_BIG 4 +#endif #include "blake.cl" #include "bmw.cl" diff --git a/kernel/marucoin-modold.cl b/kernel/marucoin-modold.cl index c6db8017..83d6e64b 100644 --- a/kernel/marucoin-modold.cl +++ b/kernel/marucoin-modold.cl @@ -75,7 +75,9 @@ typedef long sph_s64; #define SPH_GROESTL_BIG_ENDIAN 0 #define SPH_CUBEHASH_UNROLL 0 #define SPH_KECCAK_UNROLL 0 +#if !defined SPH_HAMSI_EXPAND_BIG #define SPH_HAMSI_EXPAND_BIG 4 +#endif #include "blake.cl" #include "bmw.cl" diff --git a/kernel/marucoin.cl b/kernel/marucoin.cl index 65263c91..c0bb7753 100644 --- a/kernel/marucoin.cl +++ b/kernel/marucoin.cl @@ -74,7 +74,9 @@ typedef long sph_s64; #define SPH_GROESTL_BIG_ENDIAN 0 #define SPH_CUBEHASH_UNROLL 0 #define SPH_KECCAK_UNROLL 0 -#define SPH_HAMSI_EXPAND_BIG 1 +#if !defined SPH_HAMSI_EXPAND_BIG +#define SPH_HAMSI_EXPAND_BIG 4 +#endif #include "blake.cl" #include "bmw.cl" diff --git a/miner.h b/miner.h index 800eb561..fc753c9e 100644 --- a/miner.h +++ b/miner.h @@ -956,6 +956,7 @@ extern bool opt_worktime; extern int swork_id; extern int opt_tcp_keepalive; extern bool opt_incognito; +extern int opt_hamsi_expand_big; #if LOCK_TRACKING extern pthread_mutex_t lockstat_lock; diff --git a/ocl.c b/ocl.c index 8085a6a6..126978dc 100644 --- a/ocl.c +++ b/ocl.c @@ -396,7 +396,8 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize, algorithm_t *alg build_data->patch_bfi = needs_bfi_patch(build_data); set_base_compiler_options(build_data); - append_scrypt_compiler_options(build_data, cgpu->lookup_gap, cgpu->thread_concurrency, algorithm->nfactor); + append_scrypt_compiler_options(build_data, cgpu->lookup_gap, cgpu->thread_concurrency, algorithm->nfactor); + append_hamsi_compiler_options(build_data, opt_hamsi_expand_big); if (!(clState->program = build_opencl_kernel(build_data, filename))) return NULL; diff --git a/ocl/build_kernel.c b/ocl/build_kernel.c index 84223e75..a8969d90 100644 --- a/ocl/build_kernel.c +++ b/ocl/build_kernel.c @@ -107,6 +107,16 @@ void append_scrypt_compiler_options(build_kernel_data *data, int lookup_gap, uns strcat(data->compiler_options, buf); } +// TODO: move away, specific +void append_hamsi_compiler_options(build_kernel_data *data, int expand_big) +{ + char buf[255]; + sprintf(buf, " -D SPH_HAMSI_EXPAND_BIG=%d", + expand_big); + + strcat(data->compiler_options, buf); +} + cl_program build_opencl_kernel(build_kernel_data *data, const char *filename) { int pl; diff --git a/ocl/build_kernel.h b/ocl/build_kernel.h index 5c756533..52c6233a 100644 --- a/ocl/build_kernel.h +++ b/ocl/build_kernel.h @@ -27,5 +27,6 @@ cl_program build_opencl_kernel(build_kernel_data *data, const char *filename); bool save_opencl_kernel(build_kernel_data *data, cl_program program); void set_base_compiler_options(build_kernel_data *data); void append_scrypt_compiler_options(build_kernel_data *data, int lookup_gap, unsigned int thread_concurrency, unsigned int nfactor); +void append_hamsi_compiler_options(build_kernel_data *data, int expand_big); #endif /* BUILD_KERNEL_H */ diff --git a/sgminer.c b/sgminer.c index 63737961..72366d08 100644 --- a/sgminer.c +++ b/sgminer.c @@ -108,6 +108,7 @@ time_t last_getwork; int nDevs; int opt_dynamic_interval = 7; int opt_g_threads = -1; +int opt_hamsi_expand_big = 4; bool opt_restart = true; struct list_head scan_devices; @@ -1343,6 +1344,9 @@ static struct opt_table opt_config_table[] = { OPT_WITH_ARG("--lookup-gap", set_lookup_gap, NULL, NULL, "Set GPU lookup gap for scrypt mining, comma separated"), + OPT_WITH_ARG("--hamsi-expand-big", + set_int_1_to_10, opt_show_intval, &opt_hamsi_expand_big, + "Set SPH_HAMSI_EXPAND_BIG for X13 algorithms (1 or 4 are common)"), #ifdef HAVE_CURSES OPT_WITHOUT_ARG("--incognito", opt_set_bool, &opt_incognito,