From 307dda8377052d80bd54d4f52e67add9749f2077 Mon Sep 17 00:00:00 2001 From: psychocrypt <psychocryptHPC@gmail.com> Date: Fri, 30 Nov 2018 21:20:06 +0100 Subject: [PATCH] OpenCL: comp mode optimization Disable compatibility mode if intensity is a multiple of worksize. In that case enabled compaibility mode will only slow down the miner. --- xmrstak/backend/amd/amd_gpu/gpu.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp index 42a461f..0c84d48 100644 --- a/xmrstak/backend/amd/amd_gpu/gpu.cpp +++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp @@ -411,13 +411,16 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_ strided_index = 0; } + // if intensity is a multiple of worksize than comp mode is not needed + int needCompMode = ctx->compMode && ctx->rawIntensity % ctx->workSize != 0 ? 1 : 0; + std::string options; options += " -DITERATIONS=" + std::to_string(hashIterations); options += " -DMASK=" + std::to_string(threadMemMask) + "U"; options += " -DWORKSIZE=" + std::to_string(ctx->workSize) + "U"; options += " -DSTRIDED_INDEX=" + std::to_string(strided_index); options += " -DMEM_CHUNK_EXPONENT=" + std::to_string(mem_chunk_exp) + "U"; - options += " -DCOMP_MODE=" + std::to_string(ctx->compMode ? 1u : 0u); + options += " -DCOMP_MODE=" + std::to_string(needCompMode); options += " -DMEMORY=" + std::to_string(hashMemSize) + "LLU"; options += " -DALGO=" + std::to_string(miner_algo[ii]); options += " -DCN_UNROLL=" + std::to_string(ctx->unroll); -- GitLab