diff options
Diffstat (limited to 'xmrstak/backend/amd')
-rw-r--r-- | xmrstak/backend/amd/amd_gpu/gpu.cpp | 6 | ||||
-rw-r--r-- | xmrstak/backend/amd/minethd.cpp | 29 |
2 files changed, 14 insertions, 21 deletions
diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp index 4a82fab..2973db4 100644 --- a/xmrstak/backend/amd/amd_gpu/gpu.cpp +++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp @@ -940,7 +940,7 @@ size_t XMRSetJob(GpuContext* ctx, uint8_t* input, size_t input_len, uint64_t tar /// @todo only activate if currency is monero int cn_kernel_offset = 0; - if((miner_algo == cryptonight_monero || miner_algo == cryptonight_aeon ) && version >= 7) + if(miner_algo == cryptonight_monero || miner_algo == cryptonight_aeon) { cn_kernel_offset = 6; } @@ -966,7 +966,7 @@ size_t XMRSetJob(GpuContext* ctx, uint8_t* input, size_t input_len, uint64_t tar return(ERR_OCL_API); } - if((miner_algo == cryptonight_monero || miner_algo == cryptonight_aeon ) && version >= 7) + if(miner_algo == cryptonight_monero || miner_algo == cryptonight_aeon ) { // Input if ((ret = clSetKernelArg(ctx->Kernels[1 + cn_kernel_offset], 3, sizeof(cl_mem), &ctx->InputBuffer)) != CL_SUCCESS) @@ -1134,7 +1134,7 @@ size_t XMRRunJob(GpuContext* ctx, cl_uint* HashOutput, xmrstak_algo miner_algo, size_t tmpNonce = ctx->Nonce; /// @todo only activate if currency is monero int cn_kernel_offset = 0; - if((miner_algo == cryptonight_monero || miner_algo == cryptonight_aeon) && version >= 7) + if(miner_algo == cryptonight_monero || miner_algo == cryptonight_aeon) { cn_kernel_offset = 6; } diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp index 775aa08..9357f9a 100644 --- a/xmrstak/backend/amd/minethd.cpp +++ b/xmrstak/backend/amd/minethd.cpp @@ -191,10 +191,10 @@ void minethd::work_main() uint64_t iCount = 0; cryptonight_ctx* cpu_ctx; cpu_ctx = cpu::minethd::minethd_alloc_ctx(); - auto miner_algo = ::jconf::inst()->GetMiningAlgo(); // start with root algorithm and switch later if fork version is reached - cn_hash_fun hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, ::jconf::inst()->GetMiningAlgoRoot()); + auto miner_algo = ::jconf::inst()->GetMiningAlgoRoot(); + cn_hash_fun hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo); globalStates::inst().iConsumeCnt++; @@ -213,16 +213,18 @@ void minethd::work_main() std::this_thread::sleep_for(std::chrono::milliseconds(100)); consume_work(); - uint8_t new_version = oWork.getVersion(); - const bool time_to_fork = - ((miner_algo == cryptonight_monero || miner_algo == cryptonight_aeon) && version < 7 && new_version >= 7) || - (miner_algo == cryptonight_heavy && version < 3 && new_version >= 3); - if(time_to_fork) + continue; + } + + uint8_t new_version = oWork.getVersion(); + if(new_version != version) + { + if(new_version >= ::jconf::inst()->GetMiningForkHeight()) { + miner_algo = ::jconf::inst()->GetMiningAlgo(); hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo); } version = new_version; - continue; } uint32_t h_per_round = pGpuCtx->rawIntensity; @@ -230,7 +232,7 @@ void minethd::work_main() assert(sizeof(job_result::sJobID) == sizeof(pool_job::sJobID)); uint64_t target = oWork.iTarget; - /// \todo add monero hard for version + XMRSetJob(pGpuCtx, oWork.bWorkBlob, oWork.iWorkSize, target, miner_algo, version); if(oWork.bNiceHash) @@ -274,15 +276,6 @@ void minethd::work_main() } consume_work(); - uint8_t new_version = oWork.getVersion(); - const bool time_to_fork = - ((miner_algo == cryptonight_monero || miner_algo == cryptonight_aeon) && version < 7 && new_version >= 7) || - (miner_algo == cryptonight_heavy && version < 3 && new_version >= 3); - if(time_to_fork) - { - hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo); - } - version = new_version; } } |