diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp index 2fe0350a7595edb33cb4d7852f5d5e1d50c465b9..7c7aff788ad60b52024a1db0f5919b4e6b981ecb 100644 --- a/xmrstak/backend/amd/amd_gpu/gpu.cpp +++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp @@ -396,12 +396,26 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_ int threadMemMask = cn_select_mask(miner_algo[ii]); int hashIterations = cn_select_iter(miner_algo[ii]); + size_t mem_chunk_exp = 1u << ctx->memChunk; + size_t strided_index = ctx->stridedIndex; + /* Adjust the config settings to a valid combination + * this is required if the dev pool is mining monero + * but the user tuned there settings for another currency + */ + if(miner_algo[ii] == cryptonight_monero_v8) + { + if(ctx->memChunk < 2) + mem_chunk_exp = 1u << 2; + if(strided_index == 1) + strided_index = 0; + } + std::string options; options += " -DITERATIONS=" + std::to_string(hashIterations); options += " -DMASK=" + std::to_string(threadMemMask); options += " -DWORKSIZE=" + std::to_string(ctx->workSize); - options += " -DSTRIDED_INDEX=" + std::to_string(ctx->stridedIndex); - options += " -DMEM_CHUNK_EXPONENT=" + std::to_string(1u << ctx->memChunk); + options += " -DSTRIDED_INDEX=" + std::to_string(strided_index); + options += " -DMEM_CHUNK_EXPONENT=" + std::to_string(mem_chunk_exp); options += " -DCOMP_MODE=" + std::to_string(ctx->compMode ? 1u : 0u); options += " -DMEMORY=" + std::to_string(hashMemSize); options += " -DALGO=" + std::to_string(miner_algo[ii]); @@ -931,20 +945,6 @@ size_t InitOpenCL(GpuContext* ctx, size_t num_gpus, size_t platform_idx) printer::inst()->print_msg(L0, "WARNING %s: gpu %d intensity is not a multiple of 'worksize', auto reduce intensity to %d", backendName.c_str(), ctx[i].deviceIdx, int(reduced_intensity)); } - if(useCryptonight_v8) - { - if(ctx[i].stridedIndex == 1) - { - printer::inst()->print_msg(L0, "ERROR %s: gpu %d stridedIndex is not allowed to be `true` or `1` for the selected currency", backendName.c_str(), ctx[i].deviceIdx); - return ERR_STUPID_PARAMS; - } - if(ctx[i].stridedIndex == 2 && ctx[i].memChunk < 2) - { - printer::inst()->print_msg(L0, "ERROR %s: gpu %d memChunk bust be >= 2 for the selected currency", backendName.c_str(), ctx[i].deviceIdx); - return ERR_STUPID_PARAMS; - } - } - if((ret = InitOpenCLGpu(opencl_ctx, &ctx[i], source_code.c_str())) != ERR_SUCCESS) { return ret; diff --git a/xmrstak/backend/amd/config.tpl b/xmrstak/backend/amd/config.tpl index b852a7e81435a0010c1e2195a8017440a6018a47..49033c81bc82bd7a6d62eacaf5b00ca31b73e0f2 100644 --- a/xmrstak/backend/amd/config.tpl +++ b/xmrstak/backend/amd/config.tpl @@ -10,7 +10,7 @@ R"===(// generated by XMRSTAK_VERSION * 2 = chunked memory, chunk size is controlled by 'mem_chunk' * required: intensity must be a multiple of worksize * 1 or true = use 16byte contiguous memory per thread, the next memory block has offset of intensity blocks - * (not allowed for cryptonight_v8 and monero) + * (for cryptonight_v8 and monero it is equal to strided_index = 0) * 0 or false = use a contiguous block of memory per thread * mem_chunk - range 0 to 18: set the number of elements (16byte) per chunk * this value is only used if 'strided_index' == 2