Browse Source

diff: show by default, rework shares diff storage

This will allow later more gpu candidates.

Note: This is an unfinished work, we keep the previous behavior for now
To finish this, all algos solutions should be migrated and submitted nonces attributes stored.
Its required to handle the different share diff per nonce and fix the possible solved count error (if 1/2 nonces is solved).
2upstream
Tanguy Pruvot 8 years ago
parent
commit
9eead77027
  1. 2
      Algo256/blake256.cu
  2. 14
      Algo256/blake2s.cu
  3. 2
      Algo256/decred.cu
  4. 2
      Algo256/vanilla.cu
  5. 2
      JHA/jackpotcoin.cu
  6. 2
      README.txt
  7. 19
      bignum.cpp
  8. 57
      ccminer.cpp
  9. 2
      lbry/lbry.cu
  10. 2
      lyra2/lyra2RE.cu
  11. 2
      lyra2/lyra2REv2.cu
  12. 14
      miner.h
  13. 8
      myriadgroestl.cpp
  14. 2
      quark/nist5.cu
  15. 2
      qubit/deep.cu
  16. 2
      qubit/qubit.cu
  17. 2
      sia.cu
  18. 2
      skein.cu
  19. 21
      skein2.cpp
  20. 2
      x11/c11.cu
  21. 2
      x11/fresh.cu
  22. 2
      x11/s3.cu
  23. 2
      x11/sib.cu
  24. 6
      x11/veltor.cu
  25. 2
      x11/x11.cu
  26. 2
      x11/x11evo.cu
  27. 2
      x13/x13.cu
  28. 2
      x15/x14.cu
  29. 2
      x15/x15.cu
  30. 2
      x17/x17.cu
  31. 2
      zr5.cu

2
Algo256/blake256.cu

@ -544,7 +544,7 @@ extern "C" int scanhash_blake256(int thr_id, struct work* work, uint32_t max_non
blake256hash(vhashcpu, endiandata, blakerounds); blake256hash(vhashcpu, endiandata, blakerounds);
if (vhashcpu[6] <= Htarg && fulltest(vhashcpu, ptarget)) { if (vhashcpu[6] <= Htarg && fulltest(vhashcpu, ptarget)) {
pdata[21] = extra_results[0]; pdata[21] = extra_results[0];
if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio) { if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio[0]) {
work_set_target_ratio(work, vhashcpu); work_set_target_ratio(work, vhashcpu);
xchg(pdata[21], pdata[19]); xchg(pdata[21], pdata[19]);
} }

14
Algo256/blake2s.cu

@ -468,22 +468,30 @@ extern "C" int scanhash_blake2s(int thr_id, struct work *work, uint32_t max_nonc
if (vhashcpu[7] <= target.y && fulltest(vhashcpu, ptarget)) { if (vhashcpu[7] <= target.y && fulltest(vhashcpu, ptarget)) {
work_set_target_ratio(work, vhashcpu); work_set_target_ratio(work, vhashcpu);
pdata[19] = work->nonces[0] = swab32_if(foundNonce, !swap); work->nonces[0] = swab32_if(foundNonce, !swap);
work->valid_nonces = 1;
#if NBN > 1 #if NBN > 1
if (extra_results[0] != UINT32_MAX) { if (extra_results[0] != UINT32_MAX) {
endiandata[19] = swab32_if(extra_results[0], swap); endiandata[19] = swab32_if(extra_results[0], swap);
blake2s_hash_end(vhashcpu, endiandata); blake2s_hash_end(vhashcpu, endiandata);
if (vhashcpu[7] <= target.y && fulltest(vhashcpu, ptarget)) { if (vhashcpu[7] <= target.y && fulltest(vhashcpu, ptarget)) {
work->nonces[1] = swab32_if(extra_results[0], !swap); work->nonces[1] = swab32_if(extra_results[0], !swap);
if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio) { if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio[0]) {
work->shareratio[1] = work->shareratio[0];
work->sharediff[1] = work->sharediff[0];
work_set_target_ratio(work, vhashcpu); work_set_target_ratio(work, vhashcpu);
xchg(work->nonces[1], pdata[19]); xchg(work->nonces[0], work->nonces[1]);
} else {
bn_set_target_ratio(work, vhashcpu, 1);
} }
work->valid_nonces++;
pdata[19] = max(work->nonces[0], work->nonces[1]);
return 2; return 2;
} }
extra_results[0] = UINT32_MAX; extra_results[0] = UINT32_MAX;
} }
#endif #endif
pdata[19] = max(work->nonces[0], work->nonces[1]);
return 1; return 1;
} else { } else {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", foundNonce); gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", foundNonce);

2
Algo256/decred.cu

@ -419,7 +419,7 @@ extern "C" int scanhash_decred(int thr_id, struct work* work, uint32_t max_nonce
work->nonces[1] = swab32(h_resNonce[thr_id][j]); work->nonces[1] = swab32(h_resNonce[thr_id][j]);
if(!opt_quiet) if(!opt_quiet)
gpulog(LOG_NOTICE, thr_id, "second nonce found %u / %08x - %u / %08x", i, work->nonces[0], j, work->nonces[1]); gpulog(LOG_NOTICE, thr_id, "second nonce found %u / %08x - %u / %08x", i, work->nonces[0], j, work->nonces[1]);
if(bn_hash_target_ratio(vhash, ptarget) > work->shareratio) { if(bn_hash_target_ratio(vhash, ptarget) > work->shareratio[0]) {
work_set_target_ratio(work, vhash); work_set_target_ratio(work, vhash);
xchg(work->nonces[1], work->nonces[0]); xchg(work->nonces[1], work->nonces[0]);
} }

2
Algo256/vanilla.cu

@ -438,7 +438,7 @@ extern "C" int scanhash_vanilla(int thr_id, struct work* work, uint32_t max_nonc
be32enc(&endiandata[19], h_resNonce[thr_id][1]); be32enc(&endiandata[19], h_resNonce[thr_id][1]);
vanillahash(vhashcpu, endiandata, blakerounds); vanillahash(vhashcpu, endiandata, blakerounds);
pdata[21] = h_resNonce[thr_id][1]; pdata[21] = h_resNonce[thr_id][1];
if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio) { if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio[0]) {
work_set_target_ratio(work, vhashcpu); work_set_target_ratio(work, vhashcpu);
xchg(pdata[19], pdata[21]); xchg(pdata[19], pdata[21]);
} }

2
JHA/jackpotcoin.cu

@ -232,7 +232,7 @@ extern "C" int scanhash_jackpot(int thr_id, struct work *work, uint32_t max_nonc
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
nist5hash(vhash64, endiandata); nist5hash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
README.txt

@ -157,7 +157,7 @@ its command line interface and options.
--plimit=150W set the gpu power limit, allow multiple values for N cards --plimit=150W set the gpu power limit, allow multiple values for N cards
--tlimit=85 Set the gpu thermal limit (windows only) --tlimit=85 Set the gpu thermal limit (windows only)
--keep-clocks prevent reset clocks and/or power limit on exit --keep-clocks prevent reset clocks and/or power limit on exit
--show-diff display submitted block and net difficulty --hide-diff hide submitted block and net difficulty
-B, --background run the miner in the background -B, --background run the miner in the background
--benchmark run in offline benchmark mode --benchmark run in offline benchmark mode
--cputest debug hashes from cpu algorithms --cputest debug hashes from cpu algorithms

19
bignum.cpp

@ -70,17 +70,24 @@ extern "C" double bn_hash_target_ratio(uint32_t* hash, uint32_t* target)
} }
// store ratio in work struct // store ratio in work struct
extern "C" void bn_store_hash_target_ratio(uint32_t* hash, uint32_t* target, struct work* work) extern "C" void bn_store_hash_target_ratio(uint32_t* hash, uint32_t* target, struct work* work, int nonce)
{ {
// only if the option is enabled (to reduce cpu usage) // only if the option is enabled (to reduce cpu usage)
if (opt_showdiff) { if (!opt_showdiff) return;
work->shareratio = bn_hash_target_ratio(hash, target);
work->sharediff = work->targetdiff * work->shareratio; work->shareratio[nonce] = bn_hash_target_ratio(hash, target);
} work->sharediff[nonce] = work->targetdiff * work->shareratio[nonce];
}
// new method to save all nonce(s) share diff/ration
extern "C" void bn_set_target_ratio(struct work* work, uint32_t* hash, int nonce)
{
bn_store_hash_target_ratio(hash, work->target, work, nonce);
} }
// compat (only store single nonce share diff per work)
extern "C" void work_set_target_ratio(struct work* work, uint32_t* hash) extern "C" void work_set_target_ratio(struct work* work, uint32_t* hash)
{ {
bn_store_hash_target_ratio(hash, work->target, work); bn_store_hash_target_ratio(hash, work->target, work, 0);
} }

57
ccminer.cpp

@ -82,7 +82,7 @@ bool opt_debug_diff = false;
bool opt_debug_threads = false; bool opt_debug_threads = false;
bool opt_protocol = false; bool opt_protocol = false;
bool opt_benchmark = false; bool opt_benchmark = false;
bool opt_showdiff = false; bool opt_showdiff = true;
// todo: limit use of these flags, // todo: limit use of these flags,
// prefer the pools[] attributes // prefer the pools[] attributes
@ -321,7 +321,7 @@ Options:\n\
--syslog-prefix=... allow to change syslog tool name\n" --syslog-prefix=... allow to change syslog tool name\n"
#endif #endif
"\ "\
--show-diff display submitted block and net difficulty\n\ --hide-diff hide submitted block and net difficulty (old mode)\n\
-B, --background run the miner in the background\n\ -B, --background run the miner in the background\n\
--benchmark run in offline benchmark mode\n\ --benchmark run in offline benchmark mode\n\
--cputest debug hashes from cpu algorithms\n\ --cputest debug hashes from cpu algorithms\n\
@ -384,6 +384,7 @@ struct option options[] = {
{ "retry-pause", 1, NULL, 'R' }, { "retry-pause", 1, NULL, 'R' },
{ "scantime", 1, NULL, 's' }, { "scantime", 1, NULL, 's' },
{ "show-diff", 0, NULL, 1013 }, { "show-diff", 0, NULL, 1013 },
{ "hide-diff", 0, NULL, 1014 },
{ "statsavg", 1, NULL, 'N' }, { "statsavg", 1, NULL, 'N' },
{ "gpu-clock", 1, NULL, 1070 }, { "gpu-clock", 1, NULL, 1070 },
{ "mem-clock", 1, NULL, 1071 }, { "mem-clock", 1, NULL, 1071 },
@ -871,7 +872,7 @@ bool sia_submit(CURL *curl, struct pool_infos *pool, struct work *work)
applog(LOG_ERR, "submit err %ld %s", errcode, curl_err_str); applog(LOG_ERR, "submit err %ld %s", errcode, curl_err_str);
res = 0; res = 0;
} }
share_result(res, work->pooln, work->sharediff, res ? NULL : (char*) all_data.buf); share_result(res, work->pooln, work->sharediff[0], res ? NULL : (char*) all_data.buf);
curl_slist_free_all(headers); curl_slist_free_all(headers);
return true; return true;
@ -943,6 +944,7 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
struct pool_infos *pool = &pools[work->pooln]; struct pool_infos *pool = &pools[work->pooln];
json_t *val, *res, *reason; json_t *val, *res, *reason;
bool stale_work = false; bool stale_work = false;
int idnonce = 0;
/* discard if a newer block was received */ /* discard if a newer block was received */
stale_work = work->height && work->height < g_work.height; stale_work = work->height && work->height < g_work.height;
@ -1057,7 +1059,7 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
} }
// store to keep/display the solved ratio/diff // store to keep/display the solved ratio/diff
stratum.sharediff = work->sharediff; stratum.sharediff = work->sharediff[idnonce];
if (net_diff && stratum.sharediff > net_diff && (opt_debug || opt_debug_diff)) if (net_diff && stratum.sharediff > net_diff && (opt_debug || opt_debug_diff))
applog(LOG_INFO, "share diff: %.5f, possible block found!!!", applog(LOG_INFO, "share diff: %.5f, possible block found!!!",
@ -1069,13 +1071,13 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
if (opt_vote) { // ALGO_HEAVY ALGO_DECRED if (opt_vote) { // ALGO_HEAVY ALGO_DECRED
nvotestr = bin2hex((const uchar*)(&nvote), 2); nvotestr = bin2hex((const uchar*)(&nvote), 2);
sprintf(s, "{\"method\": \"mining.submit\", \"params\": [" sprintf(s, "{\"method\": \"mining.submit\", \"params\": ["
"\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}", "\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":%d}",
pool->user, work->job_id + 8, xnonce2str, ntimestr, noncestr, nvotestr); pool->user, work->job_id + 8, xnonce2str, ntimestr, noncestr, nvotestr, 10+idnonce);
free(nvotestr); free(nvotestr);
} else { } else {
sprintf(s, "{\"method\": \"mining.submit\", \"params\": [" sprintf(s, "{\"method\": \"mining.submit\", \"params\": ["
"\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}", "\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":%d}",
pool->user, work->job_id + 8, xnonce2str, ntimestr, noncestr); pool->user, work->job_id + 8, xnonce2str, ntimestr, noncestr, 10+idnonce);
} }
free(xnonce2str); free(xnonce2str);
free(ntimestr); free(ntimestr);
@ -1120,7 +1122,7 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
/* build JSON-RPC request */ /* build JSON-RPC request */
sprintf(s, sprintf(s,
"{\"method\": \"getwork\", \"params\": [\"%s\"], \"id\":4}\r\n", "{\"method\": \"getwork\", \"params\": [\"%s\"], \"id\":10}\r\n",
str); str);
/* issue JSON-RPC request */ /* issue JSON-RPC request */
@ -1132,7 +1134,7 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
res = json_object_get(val, "result"); res = json_object_get(val, "result");
reason = json_object_get(val, "reject-reason"); reason = json_object_get(val, "reject-reason");
if (!share_result(json_is_true(res), work->pooln, work->sharediff, if (!share_result(json_is_true(res), work->pooln, work->sharediff[0],
reason ? json_string_value(reason) : NULL)) reason ? json_string_value(reason) : NULL))
{ {
if (check_dups) if (check_dups)
@ -2398,12 +2400,23 @@ static void *miner_thread(void *userdata)
/* record scanhash elapsed time */ /* record scanhash elapsed time */
gettimeofday(&tv_end, NULL); gettimeofday(&tv_end, NULL);
// todo: update all algos to use work->nonces // todo: update all algos to use work->nonces and pdata[19] as counter
if (opt_algo != ALGO_SIA) // reversed endian switch (opt_algo) {
work.nonces[0] = nonceptr[0]; case ALGO_BLAKE2S:
if (opt_algo != ALGO_DECRED && opt_algo != ALGO_BLAKE2S && opt_algo != ALGO_LBRY && opt_algo != ALGO_SIA) { case ALGO_DECRED:
if (opt_algo != ALGO_VELTOR) case ALGO_LBRY:
work.nonces[1] = nonceptr[2]; case ALGO_SIA:
case ALGO_VELTOR:
// migrated algos
break;
case ALGO_ZR5:
// algos with only work.nonces[1] set
work.nonces[0] = nonceptr[0];
break;
default:
// algos with 2 results in pdata and work.nonces unset
work.nonces[0] = nonceptr[0];
work.nonces[1] = nonceptr[2];
} }
if (rc > 0 && opt_debug) if (rc > 0 && opt_debug)
@ -2686,6 +2699,7 @@ static bool stratum_handle_response(char *buf)
json_t *val, *err_val, *res_val, *id_val; json_t *val, *err_val, *res_val, *id_val;
json_error_t err; json_error_t err;
struct timeval tv_answer, diff; struct timeval tv_answer, diff;
int num = 0;
bool ret = false; bool ret = false;
val = JSON_LOADS(buf, &err); val = JSON_LOADS(buf, &err);
@ -2701,10 +2715,14 @@ static bool stratum_handle_response(char *buf)
if (!id_val || json_is_null(id_val) || !res_val) if (!id_val || json_is_null(id_val) || !res_val)
goto out; goto out;
// ignore subscribe late answer (yaamp) // ignore late login answers
if (json_integer_value(id_val) < 4) num = (int) json_integer_value(id_val);
if (num < 4)
goto out; goto out;
// todo: use request id to index nonce diff data
// num = num % 10;
gettimeofday(&tv_answer, NULL); gettimeofday(&tv_answer, NULL);
timeval_subtract(&diff, &tv_answer, &stratum.tv_submit); timeval_subtract(&diff, &tv_answer, &stratum.tv_submit);
// store time required to the pool to answer to a submit // store time required to the pool to answer to a submit
@ -3316,6 +3334,9 @@ void parse_arg(int key, char *arg)
case 1013: case 1013:
opt_showdiff = true; opt_showdiff = true;
break; break;
case 1014:
opt_showdiff = false;
break;
case 'S': case 'S':
case 1018: case 1018:
applog(LOG_INFO, "Now logging to syslog..."); applog(LOG_INFO, "Now logging to syslog...");

2
lbry/lbry.cu

@ -171,7 +171,7 @@ extern "C" int scanhash_lbry(int thr_id, struct work *work, uint32_t max_nonce,
endiandata[LBC_NONCE_OFT32] = swab32_if(resNonces[1], !swap); endiandata[LBC_NONCE_OFT32] = swab32_if(resNonces[1], !swap);
lbry_hash(vhash, endiandata); lbry_hash(vhash, endiandata);
work->nonces[1] = swab32_if(resNonces[1], swap); work->nonces[1] = swab32_if(resNonces[1], swap);
if (bn_hash_target_ratio(vhash, ptarget) > work->shareratio) { if (bn_hash_target_ratio(vhash, ptarget) > work->shareratio[0]) {
work_set_target_ratio(work, vhash); work_set_target_ratio(work, vhash);
xchg(work->nonces[0], work->nonces[1]); xchg(work->nonces[0], work->nonces[1]);
} }

2
lyra2/lyra2RE.cu

@ -165,7 +165,7 @@ extern "C" int scanhash_lyra2(int thr_id, struct work* work, uint32_t max_nonce,
if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) { if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) {
if (opt_debug) if (opt_debug)
gpulog(LOG_BLUE, thr_id, "found second nonce %08x", secNonce); gpulog(LOG_BLUE, thr_id, "found second nonce %08x", secNonce);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
lyra2/lyra2REv2.cu

@ -177,7 +177,7 @@ extern "C" int scanhash_lyra2v2(int thr_id, struct work* work, uint32_t max_nonc
be32enc(&endiandata[19], foundNonces[1]); be32enc(&endiandata[19], foundNonces[1]);
lyra2v2_hash(vhash64, endiandata); lyra2v2_hash(vhash64, endiandata);
pdata[21] = foundNonces[1]; pdata[21] = foundNonces[1];
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) { if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0]) {
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
xchg(pdata[19], pdata[21]); xchg(pdata[19], pdata[21]);
} }

14
miner.h

@ -569,7 +569,8 @@ extern void get_currentalgo(char* buf, int sz);
double bn_convert_nbits(const uint32_t nbits); double bn_convert_nbits(const uint32_t nbits);
void bn_nbits_to_uchar(const uint32_t nBits, uchar *target); void bn_nbits_to_uchar(const uint32_t nBits, uchar *target);
double bn_hash_target_ratio(uint32_t* hash, uint32_t* target); double bn_hash_target_ratio(uint32_t* hash, uint32_t* target);
void bn_store_hash_target_ratio(uint32_t* hash, uint32_t* target, struct work* work); void bn_store_hash_target_ratio(uint32_t* hash, uint32_t* target, struct work* work, int nonce);
void bn_set_target_ratio(struct work* work, uint32_t* hash, int nonce);
void work_set_target_ratio(struct work* work, uint32_t* hash); void work_set_target_ratio(struct work* work, uint32_t* hash);
// bench // bench
@ -632,6 +633,7 @@ struct tx {
uint32_t len; uint32_t len;
}; };
#define MAX_NONCES 2
struct work { struct work {
uint32_t data[48]; uint32_t data[48];
uint32_t target[8]; uint32_t target[8];
@ -646,13 +648,15 @@ struct work {
uint64_t u64[1]; uint64_t u64[1];
} noncerange; } noncerange;
uint32_t nonces[2]; uint8_t pooln;
uint8_t valid_nonces;
uint32_t nonces[MAX_NONCES];
double sharediff[MAX_NONCES];
double shareratio[MAX_NONCES];
double targetdiff; double targetdiff;
double shareratio;
double sharediff;
uint32_t height; uint32_t height;
uint8_t pooln;
uint32_t scanned_from; uint32_t scanned_from;
uint32_t scanned_to; uint32_t scanned_to;

8
myriadgroestl.cpp

@ -81,15 +81,15 @@ int scanhash_myriad(int thr_id, struct work *work, uint32_t max_nonce, unsigned
myriadhash(vhash, endiandata); myriadhash(vhash, endiandata);
if (vhash[7] <= ptarget[7] && fulltest(vhash, ptarget)) { if (vhash[7] <= ptarget[7] && fulltest(vhash, ptarget)) {
work_set_target_ratio(work, vhash); work_set_target_ratio(work, vhash);
work->nonces[0] = foundNonces[0];
pdata[19] = foundNonces[0]; pdata[19] = foundNonces[0];
// search for another nonce // search for another nonce
if (foundNonces[1] != UINT32_MAX) { if (foundNonces[1] != UINT32_MAX) {
endiandata[19] = swab32(foundNonces[1]); endiandata[19] = swab32(foundNonces[1]);
myriadhash(vhash, endiandata); myriadhash(vhash, endiandata);
pdata[21] = foundNonces[1]; pdata[21] = foundNonces[1]; // to drop
if(bn_hash_target_ratio(vhash, ptarget) > work->shareratio) { work->nonces[1] = foundNonces[1];
work_set_target_ratio(work, vhash); bn_set_target_ratio(work, vhash, 1);
}
return 2; return 2;
} }
return 1; return 1;

2
quark/nist5.cu

@ -128,7 +128,7 @@ extern "C" int scanhash_nist5(int thr_id, struct work *work, uint32_t max_nonce,
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
nist5hash(vhash64, endiandata); nist5hash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
qubit/deep.cu

@ -110,7 +110,7 @@ extern "C" int scanhash_deep(int thr_id, struct work* work, uint32_t max_nonce,
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
deephash(vhash64, endiandata); deephash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
qubit/qubit.cu

@ -127,7 +127,7 @@ extern "C" int scanhash_qubit(int thr_id, struct work* work, uint32_t max_nonce,
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
qubithash(vhash64, endiandata); qubithash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
sia.cu

@ -258,7 +258,7 @@ int scanhash_sia(int thr_id, struct work *work, uint32_t max_nonce, unsigned lon
swab256(vhashcpu, hash); swab256(vhashcpu, hash);
if (fulltest(vhashcpu, ptarget)) { if (fulltest(vhashcpu, ptarget)) {
work->nonces[1] = secNonce; work->nonces[1] = secNonce;
if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio) { if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio[0]) {
work_set_target_ratio(work, vhashcpu); work_set_target_ratio(work, vhashcpu);
xchg(work->nonces[0], work->nonces[1]); xchg(work->nonces[0], work->nonces[1]);
} }

2
skein.cu

@ -439,7 +439,7 @@ extern "C" int scanhash_skeincoin(int thr_id, struct work* work, uint32_t max_no
// todo: use 19 20 21... zr5 pok to adapt... // todo: use 19 20 21... zr5 pok to adapt...
endiandata[19] = swab32_if(secNonce, swap); endiandata[19] = swab32_if(secNonce, swap);
skeincoinhash(vhash, endiandata); skeincoinhash(vhash, endiandata);
if (bn_hash_target_ratio(vhash, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash); work_set_target_ratio(work, vhash);
pdata[19+res*2] = swab32_if(secNonce, !swap); pdata[19+res*2] = swab32_if(secNonce, !swap);
res++; res++;

21
skein2.cpp

@ -93,27 +93,24 @@ int scanhash_skein2(int thr_id, struct work* work, uint32_t max_nonce, unsigned
uint32_t foundNonce = cuda_check_hash(thr_id, throughput, pdata[19], d_hash[thr_id]); uint32_t foundNonce = cuda_check_hash(thr_id, throughput, pdata[19], d_hash[thr_id]);
if (foundNonce != UINT32_MAX) if (foundNonce != UINT32_MAX)
{ {
uint32_t _ALIGN(64) vhash64[8]; uint32_t _ALIGN(64) vhash[8];
endiandata[19] = swab32_if(foundNonce, swap); endiandata[19] = swab32_if(foundNonce, swap);
skein2hash(vhash64, endiandata); skein2hash(vhash, endiandata);
if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) { if (vhash[7] <= ptarget[7] && fulltest(vhash, ptarget)) {
int res = 1; int res = 1;
uint32_t secNonce = cuda_check_hash_suppl(thr_id, throughput, pdata[19], d_hash[thr_id], 1); uint32_t secNonce = cuda_check_hash_suppl(thr_id, throughput, pdata[19], d_hash[thr_id], 1);
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash);
if (secNonce != 0) { if (secNonce != 0) {
if (!opt_quiet)
applog(LOG_BLUE, "GPU #%d: found second nonce %08x !", dev_id, swab32(secNonce));
endiandata[19] = swab32_if(secNonce, swap); endiandata[19] = swab32_if(secNonce, swap);
skein2hash(vhash64, endiandata); skein2hash(vhash, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) bn_set_target_ratio(work, vhash, 1);
work_set_target_ratio(work, vhash64); pdata[21] = work->nonces[1] = swab32_if(secNonce, !swap);
pdata[21] = swab32_if(secNonce, !swap); gpulog(LOG_DEBUG, thr_id, "found second nonce %08x!", swab32(secNonce));
res++; res++;
} }
pdata[19] = swab32_if(foundNonce, !swap); pdata[19] = work->nonces[0] = swab32_if(foundNonce, !swap);
return res; return res;
} else { } else {
gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", foundNonce); gpulog(LOG_WARNING, thr_id, "result for %08x does not validate on CPU!", foundNonce);

2
x11/c11.cu

@ -197,7 +197,7 @@ extern "C" int scanhash_c11(int thr_id, struct work* work, uint32_t max_nonce, u
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
c11hash(vhash64, endiandata); c11hash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
x11/fresh.cu

@ -140,7 +140,7 @@ extern "C" int scanhash_fresh(int thr_id, struct work* work, uint32_t max_nonce,
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
fresh_hash(vhash64, endiandata); fresh_hash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
x11/s3.cu

@ -135,7 +135,7 @@ extern "C" int scanhash_s3(int thr_id, struct work* work, uint32_t max_nonce, un
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
s3hash(vhash64, endiandata); s3hash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
x11/sib.cu

@ -193,7 +193,7 @@ extern "C" int scanhash_sib(int thr_id, struct work* work, uint32_t max_nonce, u
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
sibhash(vhash64, endiandata); sibhash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

6
x11/veltor.cu

@ -125,15 +125,17 @@ extern "C" int scanhash_veltor(int thr_id, struct work* work, uint32_t max_nonce
if (vhash[7] <= Htarg && fulltest(vhash, ptarget)) { if (vhash[7] <= Htarg && fulltest(vhash, ptarget)) {
int res = 1; int res = 1;
// check if there was another one... // check if there was another one...
uint32_t secNonce = cuda_check_hash_suppl(thr_id, throughput, pdata[19], d_hash[thr_id], 1); uint32_t secNonce = cuda_check_hash_suppl(thr_id, throughput, pdata[19], d_hash[thr_id], res);
work_set_target_ratio(work, vhash); work_set_target_ratio(work, vhash);
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
veltorhash(vhash, endiandata); veltorhash(vhash, endiandata);
work->nonces[1] = secNonce; work->nonces[1] = secNonce;
if (bn_hash_target_ratio(vhash, ptarget) > work->shareratio) { if (bn_hash_target_ratio(vhash, ptarget) > work->shareratio[0]) {
work_set_target_ratio(work, vhash); work_set_target_ratio(work, vhash);
xchg(work->nonces[1], work->nonces[0]); xchg(work->nonces[1], work->nonces[0]);
} else {
bn_set_target_ratio(work, vhash, res);
} }
res++; res++;
} }

2
x11/x11.cu

@ -185,7 +185,7 @@ extern "C" int scanhash_x11(int thr_id, struct work* work, uint32_t max_nonce, u
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
x11hash(vhash64, endiandata); x11hash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
x11/x11evo.cu

@ -366,7 +366,7 @@ extern "C" int scanhash_x11evo(int thr_id, struct work* work, uint32_t max_nonce
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
x11evo_hash(vhash64, endiandata); x11evo_hash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
x13/x13.cu

@ -201,7 +201,7 @@ extern "C" int scanhash_x13(int thr_id, struct work* work, uint32_t max_nonce, u
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
x13hash(vhash, endiandata); x13hash(vhash, endiandata);
pdata[21] = secNonce; pdata[21] = secNonce;
if (bn_hash_target_ratio(vhash, ptarget) > work->shareratio) { if (bn_hash_target_ratio(vhash, ptarget) > work->shareratio[0]) {
work_set_target_ratio(work, vhash); work_set_target_ratio(work, vhash);
xchg(pdata[19], pdata[21]); xchg(pdata[19], pdata[21]);
} }

2
x15/x14.cu

@ -215,7 +215,7 @@ extern "C" int scanhash_x14(int thr_id, struct work* work, uint32_t max_nonce,
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
x14hash(vhash64, endiandata); x14hash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
x15/x15.cu

@ -221,7 +221,7 @@ extern "C" int scanhash_x15(int thr_id, struct work* work, uint32_t max_nonce,
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
x15hash(vhash64, endiandata); x15hash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
x17/x17.cu

@ -245,7 +245,7 @@ extern "C" int scanhash_x17(int thr_id, struct work* work, uint32_t max_nonce, u
if (secNonce != 0) { if (secNonce != 0) {
be32enc(&endiandata[19], secNonce); be32enc(&endiandata[19], secNonce);
x17hash(vhash64, endiandata); x17hash(vhash64, endiandata);
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
res++; res++;

2
zr5.cu

@ -458,7 +458,7 @@ extern "C" int scanhash_zr5(int thr_id, struct work *work,
tmpdata[0] = pok; tmpdata[19] = secNonce; tmpdata[0] = pok; tmpdata[19] = secNonce;
zr5hash(vhash64, tmpdata); zr5hash(vhash64, tmpdata);
if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) { if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) {
if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio) if (bn_hash_target_ratio(vhash64, ptarget) > work->shareratio[0])
work_set_target_ratio(work, vhash64); work_set_target_ratio(work, vhash64);
pdata[21] = secNonce; pdata[21] = secNonce;
pdata[22] = pok; pdata[22] = pok;

Loading…
Cancel
Save