Browse Source

Removed --nscrypt option and introduced use_nscrypt flag that is kernel dependant.

nfactor-troky^2
unknown 11 years ago
parent
commit
f8579404bc
  1. 6
      driver-opencl.c
  2. 2
      miner.h
  3. 3
      ocl.c
  4. 4
      scrypt.c
  5. 5
      sgminer.c

6
driver-opencl.c

@ -1024,7 +1024,7 @@ static cl_int queue_scrypt_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_u
uint32_t timestamp; uint32_t timestamp;
cl_uint nfactor = 10; // scrypt default cl_uint nfactor = 10; // scrypt default
if (opt_nscrypt) { if (use_nscrypt) {
timestamp = bswap_32(*((uint32_t *)(blk->work->data + 17*4))); timestamp = bswap_32(*((uint32_t *)(blk->work->data + 17*4)));
nfactor = vert_GetNfactor(timestamp) + 1; 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[0]);
CL_SET_VARG(4, &midstate[16]); CL_SET_VARG(4, &midstate[16]);
CL_SET_ARG(le_target); CL_SET_ARG(le_target);
if (opt_nscrypt) { if (use_nscrypt) {
CL_SET_ARG(nfactor); 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 minthreads, __maybe_unused int *intensity, __maybe_unused int *xintensity, __maybe_unused int *rawintensity)
{ {
unsigned int threads = 0; unsigned int threads = 0;
if (opt_nscrypt) { if (use_nscrypt) {
// new intensity calculation based on shader count // new intensity calculation based on shader count
threads = (compute_shaders * minthreads << (MAX_INTENSITY-19)) >> (MAX_INTENSITY - *intensity); threads = (compute_shaders * minthreads << (MAX_INTENSITY-19)) >> (MAX_INTENSITY - *intensity);

2
miner.h

@ -981,7 +981,7 @@ extern bool opt_restart;
extern bool opt_worktime; extern bool opt_worktime;
extern int swork_id; extern int swork_id;
extern int opt_tcp_keepalive; extern int opt_tcp_keepalive;
extern bool opt_nscrypt; extern bool use_nscrypt;
#if LOCK_TRACKING #if LOCK_TRACKING
extern pthread_mutex_t lockstat_lock; extern pthread_mutex_t lockstat_lock;

3
ocl.c

@ -458,6 +458,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
applog(LOG_WARNING, "Kernel nscrypt is experimental."); applog(LOG_WARNING, "Kernel nscrypt is experimental.");
strcpy(filename, NSCRYPT_KERNNAME".cl"); strcpy(filename, NSCRYPT_KERNNAME".cl");
strcpy(binaryfilename, NSCRYPT_KERNNAME); strcpy(binaryfilename, NSCRYPT_KERNNAME);
use_nscrypt = true;
break; break;
case KL_NONE: /* Shouldn't happen */ case KL_NONE: /* Shouldn't happen */
break; break;
@ -782,7 +783,7 @@ built:
return NULL; 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 ipt = (bsize / cgpu->lookup_gap + (bsize % cgpu->lookup_gap > 0));
size_t bufsize = 128 * ipt * cgpu->thread_concurrency; size_t bufsize = 128 * ipt * cgpu->thread_concurrency;

4
scrypt.c

@ -414,7 +414,7 @@ void scrypt_regenhash(struct work *work)
uint32_t *nonce = (uint32_t *)(work->data + 76); uint32_t *nonce = (uint32_t *)(work->data + 76);
uint32_t *ohash = (uint32_t *)(work->hash); uint32_t *ohash = (uint32_t *)(work->hash);
if (opt_nscrypt) { if (use_nscrypt) {
timestamp = bswap_32(*((uint32_t *)(work->data + 17*4))); timestamp = bswap_32(*((uint32_t *)(work->data + 17*4)));
nfactor = vert_GetNfactor(timestamp) + 1; nfactor = vert_GetNfactor(timestamp) + 1;
} }
@ -422,7 +422,7 @@ void scrypt_regenhash(struct work *work)
be32enc_vect(data, (const uint32_t *)work->data, 19); be32enc_vect(data, (const uint32_t *)work->data, 19);
data[19] = htobe32(*nonce); data[19] = htobe32(*nonce);
if (opt_nscrypt) { if (use_nscrypt) {
scratchbuf = (char *)alloca((1 << nfactor) * 128 + 512); scratchbuf = (char *)alloca((1 << nfactor) * 128 + 512);
scrypt_1024_1_1_256_sp(data, scratchbuf, ohash, (1 << nfactor)); scrypt_1024_1_1_256_sp(data, scratchbuf, ohash, (1 << nfactor));
} }

5
sgminer.c

@ -101,7 +101,7 @@ int opt_dynamic_interval = 7;
int opt_g_threads = -1; int opt_g_threads = -1;
int gpu_threads; int gpu_threads;
bool opt_restart = true; bool opt_restart = true;
bool opt_nscrypt = false; bool use_nscrypt = false;
struct list_head scan_devices; struct list_head scan_devices;
static bool devices_enabled[MAX_DEVICES]; static bool devices_enabled[MAX_DEVICES];
@ -1270,9 +1270,6 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--sched-stop", OPT_WITH_ARG("--sched-stop",
set_schedtime, NULL, &schedstop, set_schedtime, NULL, &schedstop,
"Set a time of day in HH:MM to stop mining (will quit without a start time)"), "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", OPT_WITH_ARG("--shaders",
set_shaders, NULL, NULL, set_shaders, NULL, NULL,
"GPU shaders per card for tuning scrypt, comma separated"), "GPU shaders per card for tuning scrypt, comma separated"),

Loading…
Cancel
Save