Skip to content

Commit

Permalink
Merge pull request #2194 from psychocrypt/fix-openclWorksizeMessage
Browse files Browse the repository at this point in the history
OpenCL: fix work size message
  • Loading branch information
fireice-uk authored Feb 1, 2019
2 parents 3e4dc4d + 4524b87 commit 40df1cc
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions xmrstak/backend/amd/amd_gpu/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,21 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_
return ERR_OCL_API;
}

/* Some kernel spawn 8 times more threads than the user is configuring.
* To give the user the correct maximum work size we divide the hardware specific max by 8.
*/
MaximumWorkSize /= 8;
auto neededAlgorithms = ::jconf::inst()->GetCurrentCoinSelection().GetAllAlgorithms();
bool useCryptonight_gpu = std::find(neededAlgorithms.begin(), neededAlgorithms.end(), cryptonight_gpu) != neededAlgorithms.end();

if(useCryptonight_gpu)
{
// work cn_1 we use 16x more threads than configured by the user
MaximumWorkSize /= 16;
}
else
{
/* Some kernel spawn 8 times more threads than the user is configuring.
* To give the user the correct maximum work size we divide the hardware specific max by 8.
*/
MaximumWorkSize /= 8;
}
printer::inst()->print_msg(L1,"Device %lu work size %lu / %lu.", ctx->deviceIdx, ctx->workSize, MaximumWorkSize);
#if defined(CL_VERSION_2_0) && !defined(CONF_ENFORCE_OpenCL_1_2)
const cl_queue_properties CommandQueueProperties[] = { 0, 0, 0 };
Expand Down Expand Up @@ -316,8 +327,6 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_
return ERR_OCL_API;
}

auto neededAlgorithms = ::jconf::inst()->GetCurrentCoinSelection().GetAllAlgorithms();

size_t scratchPadSize = 0;
for(const auto algo : neededAlgorithms)
{
Expand Down

0 comments on commit 40df1cc

Please sign in to comment.