summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/amd/minethd.cpp
diff options
context:
space:
mode:
authorfireice-uk <fireice-uk@users.noreply.github.com>2018-04-18 21:28:09 +0100
committerGitHub <noreply@github.com>2018-04-18 21:28:09 +0100
commit26a5d65f12b2f19a0a3ece39a2bc64718796367b (patch)
treeb0132803b520fed0dcb2ea42ba5ab8f0a464fc12 /xmrstak/backend/amd/minethd.cpp
parente10e8e67492cf3118af8b7d7609937e85e572305 (diff)
parent27da3b0831e047a247f78ec299ba74b04f45bd5a (diff)
downloadxmr-stak-26a5d65f12b2f19a0a3ece39a2bc64718796367b.zip
xmr-stak-26a5d65f12b2f19a0a3ece39a2bc64718796367b.tar.gz
Merge pull request #1459 from fireice-uk/dev2.4.3
release 2.4.3
Diffstat (limited to 'xmrstak/backend/amd/minethd.cpp')
-rw-r--r--xmrstak/backend/amd/minethd.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp
index cab5ad9..4353e3d 100644
--- a/xmrstak/backend/amd/minethd.cpp
+++ b/xmrstak/backend/amd/minethd.cpp
@@ -137,6 +137,8 @@ std::vector<iBackend*>* minethd::thread_starter(uint32_t threadOffset, miner_wor
for (i = 0; i < n; i++)
{
jconf::inst()->GetThreadConfig(i, cfg);
+
+ const std::string backendName = xmrstak::params::inst().openCLVendor;
if(cfg.cpu_aff >= 0)
{
@@ -144,10 +146,10 @@ std::vector<iBackend*>* minethd::thread_starter(uint32_t threadOffset, miner_wor
printer::inst()->print_msg(L1, "WARNING on macOS thread affinity is only advisory.");
#endif
- printer::inst()->print_msg(L1, "Starting AMD GPU thread %d, affinity: %d.", i, (int)cfg.cpu_aff);
+ printer::inst()->print_msg(L1, "Starting %s GPU (OpenCL) thread %d, affinity: %d.", backendName.c_str(), i, (int)cfg.cpu_aff);
}
else
- printer::inst()->print_msg(L1, "Starting AMD GPU thread %d, no affinity.", i);
+ printer::inst()->print_msg(L1, "Starting %s GPU (OpenCL) thread %d, no affinity.", backendName.c_str(), i);
minethd* thd = new minethd(pWork, i + threadOffset, &vGpuData[i], cfg);
pvThreads->push_back(thd);
@@ -193,12 +195,13 @@ void minethd::work_main()
cpu_ctx = cpu::minethd::minethd_alloc_ctx();
// start with root algorithm and switch later if fork version is reached
- auto miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
+ auto miner_algo = ::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgoRoot();
cn_hash_fun hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
globalStates::inst().iConsumeCnt++;
uint8_t version = 0;
+ size_t lastPoolId = 0;
while (bQuit == 0)
{
@@ -217,13 +220,20 @@ void minethd::work_main()
}
uint8_t new_version = oWork.getVersion();
- if(new_version != version)
+ if(new_version != version || oWork.iPoolId != lastPoolId)
{
- if(new_version >= ::jconf::inst()->GetMiningForkVersion())
+ coinDescription coinDesc = ::jconf::inst()->GetCurrentCoinSelection().GetDescription(oWork.iPoolId);
+ if(new_version >= coinDesc.GetMiningForkVersion())
+ {
+ miner_algo = coinDesc.GetMiningAlgo();
+ hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
+ }
+ else
{
- miner_algo = ::jconf::inst()->GetMiningAlgo();
+ miner_algo = coinDesc.GetMiningAlgoRoot();
hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
}
+ lastPoolId = oWork.iPoolId;
version = new_version;
}
@@ -233,7 +243,7 @@ void minethd::work_main()
assert(sizeof(job_result::sJobID) == sizeof(pool_job::sJobID));
uint64_t target = oWork.iTarget;
- XMRSetJob(pGpuCtx, oWork.bWorkBlob, oWork.iWorkSize, target, miner_algo, version);
+ XMRSetJob(pGpuCtx, oWork.bWorkBlob, oWork.iWorkSize, target, miner_algo);
if(oWork.bNiceHash)
pGpuCtx->Nonce = *(uint32_t*)(oWork.bWorkBlob + 39);
@@ -249,7 +259,7 @@ void minethd::work_main()
cl_uint results[0x100];
memset(results,0,sizeof(cl_uint)*(0x100));
- XMRRunJob(pGpuCtx, results, miner_algo, version);
+ XMRRunJob(pGpuCtx, results, miner_algo);
for(size_t i = 0; i < results[0xFF]; i++)
{
OpenPOWER on IntegriCloud