summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/amd/amd_gpu/gpu.cpp
diff options
context:
space:
mode:
authorpsychocrypt <psychocryptHPC@gmail.com>2018-04-08 20:40:54 +0200
committerpsychocrypt <psychocryptHPC@gmail.com>2018-04-08 20:52:30 +0200
commit1b18f598aa1190a0e6126ed2c70e052e9403d180 (patch)
tree626314a2add2f76649ca31c4b7e0a731f6d80f9b /xmrstak/backend/amd/amd_gpu/gpu.cpp
parenta57976439b1322eecb5e29198f3d9676d6f06909 (diff)
downloadxmr-stak-1b18f598aa1190a0e6126ed2c70e052e9403d180.zip
xmr-stak-1b18f598aa1190a0e6126ed2c70e052e9403d180.tar.gz
refactor scratchpad creation
Use the maximum scratchpad size from before and after the fork.
Diffstat (limited to 'xmrstak/backend/amd/amd_gpu/gpu.cpp')
-rw-r--r--xmrstak/backend/amd/amd_gpu/gpu.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp
index b9cc9b6..79e80bd 100644
--- a/xmrstak/backend/amd/amd_gpu/gpu.cpp
+++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp
@@ -308,9 +308,10 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_
return ERR_OCL_API;
}
- size_t scratchPadSize = cn_select_memory(::jconf::inst()->GetMiningAlgo());
- int threadMemMask = cn_select_mask(::jconf::inst()->GetMiningAlgo());
- int hashIterations = cn_select_iter(::jconf::inst()->GetMiningAlgo());
+ size_t scratchPadSize = std::max(
+ cn_select_memory(::jconf::inst()->GetMiningAlgo()),
+ cn_select_memory(::jconf::inst()->GetMiningAlgoRoot())
+ );
size_t g_thd = ctx->rawIntensity;
ctx->ExtraBuffers[0] = clCreateBuffer(opencl_ctx, CL_MEM_READ_WRITE, scratchPadSize * g_thd, NULL, &ret);
@@ -382,6 +383,7 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_
for(int ii = 0; ii < num_algos; ++ii)
{
+ // scratchpad size for the selected mining algorithm
size_t hashMemSize = cn_select_memory(miner_algo[ii]);
int threadMemMask = cn_select_mask(miner_algo[ii]);
int hashIterations = cn_select_iter(miner_algo[ii]);
@@ -493,7 +495,7 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_
p_id++;
}
- if((ret = clGetProgramInfo(ctx->Program[ii], CL_PROGRAM_BINARIES, num_devices * sizeof(char*), all_programs.data(),NULL)) != CL_SUCCESS)
+ if((ret = clGetProgramInfo(ctx->Program[ii], CL_PROGRAM_BINARIES, num_devices * sizeof(char*), all_programs.data(),NULL)) != CL_SUCCESS)
{
printer::inst()->print_msg(L1,"Error %s when calling clGetProgramInfo.", err_to_str(ret));
return ERR_OCL_API;
OpenPOWER on IntegriCloud