summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/amd/minethd.cpp
diff options
context:
space:
mode:
authorfireice-uk <fireice-uk@users.noreply.github.com>2017-10-13 16:35:10 +0100
committerfireice-uk <fireice-uk@users.noreply.github.com>2017-10-22 13:12:52 +0100
commitf13f70c28eb9e4b38d3b4932f5845f1d5cc01906 (patch)
treedc2b85e4ddd9b02e35729502dd6ae96fc2443568 /xmrstak/backend/amd/minethd.cpp
parent610f4f0fa72c60daa14dc0661f58ba23563afb61 (diff)
downloadxmr-stak-f13f70c28eb9e4b38d3b4932f5845f1d5cc01906.zip
xmr-stak-f13f70c28eb9e4b38d3b4932f5845f1d5cc01906.tar.gz
Implement pool-controlled nonce allocation
Diffstat (limited to 'xmrstak/backend/amd/minethd.cpp')
-rw-r--r--xmrstak/backend/amd/minethd.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp
index 5ca10d3..048c3f0 100644
--- a/xmrstak/backend/amd/minethd.cpp
+++ b/xmrstak/backend/amd/minethd.cpp
@@ -167,13 +167,11 @@ void minethd::consume_work()
void minethd::work_main()
{
uint64_t iCount = 0;
-
cryptonight_ctx* cpu_ctx;
cpu_ctx = cpu::minethd::minethd_alloc_ctx();
cn_hash_fun hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/);
-
+ pGpuCtx->Nonce = *(uint32_t*)(oWork.bWorkBlob + 39);
globalStates::inst().iConsumeCnt++;
- uint32_t* piNonce = (uint32_t*)(oWork.bWorkBlob + 39);
while (bQuit == 0)
{
@@ -190,10 +188,8 @@ void minethd::work_main()
continue;
}
- if(oWork.bNiceHash)
- pGpuCtx->Nonce = calc_nicehash_nonce(*piNonce, oWork.iResumeCnt);
- else
- pGpuCtx->Nonce = calc_start_nonce(oWork.iResumeCnt);
+ uint32_t h_per_round = pGpuCtx->rawIntensity;
+ size_t round_ctr = 0;
assert(sizeof(job_result::sJobID) == sizeof(pool_job::sJobID));
uint32_t target = oWork.iTarget32;
@@ -201,6 +197,15 @@ void minethd::work_main()
while(globalStates::inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
{
+ //Allocate a new nonce every 16 rounds
+ if((++round_ctr & 0xF) == 0)
+ {
+ if(oWork.bNiceHash)
+ pGpuCtx->Nonce = globalStates::inst().calc_start_nonce(pGpuCtx->Nonce & 0xFF000000u, h_per_round * 16);
+ else
+ pGpuCtx->Nonce = globalStates::inst().calc_start_nonce(0, h_per_round * 16);
+ }
+
cl_uint results[0x100];
memset(results,0,sizeof(cl_uint)*(0x100));
OpenPOWER on IntegriCloud