Make sure not to try and submit work for nonces higher than already submitted in current work item. This reduces rejects substantially.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
diff --git a/findnonce.c b/findnonce.c
index de9890e..06882b5 100644
--- a/findnonce.c
+++ b/findnonce.c
@@ -157,7 +157,6 @@ static void *postcalc_hash(void *userdata)
cl_uint A, B, C, D, E, F, G, H;
cl_uint W[16];
cl_uint nonce;
- cl_uint best_g;
uint32_t end;
int entry = 0;
@@ -172,7 +171,6 @@ cycle:
if (entry == MAXBUFFERS)
goto out;
- best_g = ~0;
end = start + 1026;
for (nonce = start; nonce != end; nonce+=1) {
@@ -206,20 +204,21 @@ cycle:
FR(48); PFR(56);
if (unlikely(H == 0xA41F32E7)) {
- if (unlikely(submit_nonce(thr, work, nonce) == false)) {
- applog(LOG_ERR, "Failed to submit work, exiting");
- break;
- }
G += 0x1f83d9ab;
G = ByteReverse(G);
- if (G < best_g)
- best_g = G;
+ if (G < thr->best_g) {
+ if (unlikely(submit_nonce(thr, work, nonce) == false)) {
+ applog(LOG_ERR, "Failed to submit work, exiting");
+ break;
+ }
+ thr->best_g = G;
+ }
}
}
- if (unlikely(best_g == ~0)) {
+ if (unlikely(thr->best_g == ~0)) {
if (opt_debug)
applog(LOG_DEBUG, "No best_g found! Error in OpenCL code?");
hw_errors++;
diff --git a/main.c b/main.c
index eb111fe..1c9268c 100644
--- a/main.c
+++ b/main.c
@@ -1727,6 +1727,7 @@ static void *gpuminer_thread(void *userdata)
"gpu mining thread %d", mythr->id);
goto out;
}
+ mythr->best_g = ~0;
mythr->cgpu->getworks++;
work->thr_id = thr_id;
requested = false;
diff --git a/miner.h b/miner.h
index 53a537e..358590f 100644
--- a/miner.h
+++ b/miner.h
@@ -145,6 +145,7 @@ struct thr_info {
struct thread_q *q;
struct cgpu_info *cgpu;
struct timeval last;
+ cl_uint best_g;
};
static inline uint32_t swab32(uint32_t v)