From f8579404bc6aac1310c58595c006ab224c81189e Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Feb 2014 00:08:37 +0100 Subject: [PATCH] Removed --nscrypt option and introduced use_nscrypt flag that is kernel dependant. --- driver-opencl.c | 6 +++--- miner.h | 2 +- ocl.c | 3 ++- scrypt.c | 4 ++-- sgminer.c | 5 +---- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/driver-opencl.c b/driver-opencl.c index dbfb5697..006be853 100644 --- a/driver-opencl.c +++ b/driver-opencl.c @@ -1024,7 +1024,7 @@ static cl_int queue_scrypt_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_u uint32_t timestamp; cl_uint nfactor = 10; // scrypt default - if (opt_nscrypt) { + if (use_nscrypt) { timestamp = bswap_32(*((uint32_t *)(blk->work->data + 17*4))); nfactor = vert_GetNfactor(timestamp) + 1; } @@ -1039,7 +1039,7 @@ static cl_int queue_scrypt_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_u CL_SET_VARG(4, &midstate[0]); CL_SET_VARG(4, &midstate[16]); CL_SET_ARG(le_target); - if (opt_nscrypt) { + if (use_nscrypt) { CL_SET_ARG(nfactor); } @@ -1050,7 +1050,7 @@ static void set_threads_hashes(unsigned int vectors, unsigned int compute_shader unsigned int minthreads, __maybe_unused int *intensity, __maybe_unused int *xintensity, __maybe_unused int *rawintensity) { unsigned int threads = 0; - if (opt_nscrypt) { + if (use_nscrypt) { // new intensity calculation based on shader count threads = (compute_shaders * minthreads << (MAX_INTENSITY-19)) >> (MAX_INTENSITY - *intensity); diff --git a/miner.h b/miner.h index 197da518..8a532792 100644 --- a/miner.h +++ b/miner.h @@ -981,7 +981,7 @@ extern bool opt_restart; extern bool opt_worktime; extern int swork_id; extern int opt_tcp_keepalive; -extern bool opt_nscrypt; +extern bool use_nscrypt; #if LOCK_TRACKING extern pthread_mutex_t lockstat_lock; diff --git a/ocl.c b/ocl.c index 6e71b22a..0105321f 100644 --- a/ocl.c +++ b/ocl.c @@ -458,6 +458,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) applog(LOG_WARNING, "Kernel nscrypt is experimental."); strcpy(filename, NSCRYPT_KERNNAME".cl"); strcpy(binaryfilename, NSCRYPT_KERNNAME); + use_nscrypt = true; break; case KL_NONE: /* Shouldn't happen */ break; @@ -782,7 +783,7 @@ built: return NULL; } - cl_uint bsize = opt_nscrypt ? 2048 : 1024; + cl_uint bsize = use_nscrypt ? 2048 : 1024; size_t ipt = (bsize / cgpu->lookup_gap + (bsize % cgpu->lookup_gap > 0)); size_t bufsize = 128 * ipt * cgpu->thread_concurrency; diff --git a/scrypt.c b/scrypt.c index ea3f5a39..34cc5db0 100644 --- a/scrypt.c +++ b/scrypt.c @@ -414,7 +414,7 @@ void scrypt_regenhash(struct work *work) uint32_t *nonce = (uint32_t *)(work->data + 76); uint32_t *ohash = (uint32_t *)(work->hash); - if (opt_nscrypt) { + if (use_nscrypt) { timestamp = bswap_32(*((uint32_t *)(work->data + 17*4))); nfactor = vert_GetNfactor(timestamp) + 1; } @@ -422,7 +422,7 @@ void scrypt_regenhash(struct work *work) be32enc_vect(data, (const uint32_t *)work->data, 19); data[19] = htobe32(*nonce); - if (opt_nscrypt) { + if (use_nscrypt) { scratchbuf = (char *)alloca((1 << nfactor) * 128 + 512); scrypt_1024_1_1_256_sp(data, scratchbuf, ohash, (1 << nfactor)); } diff --git a/sgminer.c b/sgminer.c index 7bcba15a..c9e6a107 100644 --- a/sgminer.c +++ b/sgminer.c @@ -101,7 +101,7 @@ int opt_dynamic_interval = 7; int opt_g_threads = -1; int gpu_threads; bool opt_restart = true; -bool opt_nscrypt = false; +bool use_nscrypt = false; struct list_head scan_devices; static bool devices_enabled[MAX_DEVICES]; @@ -1270,9 +1270,6 @@ static struct opt_table opt_config_table[] = { OPT_WITH_ARG("--sched-stop", set_schedtime, NULL, &schedstop, "Set a time of day in HH:MM to stop mining (will quit without a start time)"), - OPT_WITHOUT_ARG("--nscrypt", - opt_set_bool, &opt_nscrypt, - "Use the scrypt-vert algorithm for mining (NO scyrpt!)"), OPT_WITH_ARG("--shaders", set_shaders, NULL, NULL, "GPU shaders per card for tuning scrypt, comma separated"),