From 292db293a7f3586564ec906aca76ba232dd62657 Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Sat, 24 Aug 2019 21:07:39 +0200 Subject: [PATCH] AMD: optimize auto adjustement solve #2517 In the case we can utilize more than 75% of the compute units we will not enforce a multiple of the compute units. --- xmrstak/backend/amd/autoAdjust.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xmrstak/backend/amd/autoAdjust.hpp b/xmrstak/backend/amd/autoAdjust.hpp index 858c03844..595f0bc5d 100644 --- a/xmrstak/backend/amd/autoAdjust.hpp +++ b/xmrstak/backend/amd/autoAdjust.hpp @@ -210,8 +210,11 @@ class autoAdjust size_t possibleIntensity = std::min(maxThreads, maxIntensity); // map intensity to a multiple of the compute unit count, default_workSize is the number of threads per work group size_t intensity = (possibleIntensity / (default_workSize * ctx.computeUnits)) * ctx.computeUnits * default_workSize; - // in the case we use two threads per gpu we can be relax and need no multiple of the number of compute units - if(numThreads == 2) + + size_t computeUnitUtilization = ((possibleIntensity * 100) / (default_workSize * ctx.computeUnits)) % 100; + // in the case we use two threads per gpu or if we can utilize over 75% of the compute units + // we can be relax and need no multiple of the number of compute units + if(numThreads == 2 || computeUnitUtilization >= 75) intensity = (possibleIntensity / default_workSize) * default_workSize; //If the intensity is 0, then it's because the multiple of the unit count is greater than intensity