From 29f0b2714c8b92a2c8379f3de3ed2a2794c3fd8e Mon Sep 17 00:00:00 2001 From: ckolivas Date: Wed, 15 Feb 2012 08:51:59 +1100 Subject: [PATCH] The amount of work scanned can fluctuate when intensity changes and since we do this one cycle behind, we increment the work more than enough to prevent repeating work. --- device-gpu.c | 9 ++++++++- miner.h | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/device-gpu.c b/device-gpu.c index c42b6028..5f933d50 100644 --- a/device-gpu.c +++ b/device-gpu.c @@ -1217,8 +1217,12 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work, ++gpu->intensity; } } + if (!work->blk.nonce) + gpu->max_hashes = 0; set_threads_hashes(clState->preferred_vwidth, &threads, &hashes, globalThreads, localThreads[0], gpu->intensity); + if (hashes > gpu->max_hashes) + gpu->max_hashes = hashes; status = thrdata->queue_kernel_parameters(clState, &work->blk); if (unlikely(status != CL_SUCCESS)) { applog(LOG_ERR, "Error: clSetKernelArg of all params failed."); @@ -1259,7 +1263,10 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work, return 0; } - work->blk.nonce += hashes; + /* The amount of work scanned can fluctuate when intensity changes + * and since we do this one cycle behind, we increment the work more + * than enough to prevent repeating work */ + work->blk.nonce += gpu->max_hashes; return hashes; } diff --git a/miner.h b/miner.h index b19a3573..6e6dad57 100644 --- a/miner.h +++ b/miner.h @@ -228,9 +228,10 @@ struct cgpu_info { int threads; struct thr_info *thread; + unsigned int max_hashes; int virtual_gpu; - bool dynamic; int intensity; + bool dynamic; float temp; int cutofftemp;