Skip to content

Commit

Permalink
AMD: optimize auto adjustement
Browse files Browse the repository at this point in the history
solve fireice-uk#2517

In the case we can utilize more than 75% of the compute units we will
not enforce a multiple of the compute units.
  • Loading branch information
psychocrypt committed Aug 24, 2019
1 parent bb189ad commit 292db29
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions xmrstak/backend/amd/autoAdjust.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 292db29

Please sign in to comment.