Use RxAlgo:base instead of switch.
This commit is contained in:
parent
bee01544c5
commit
8a69c23646
3 changed files with 8 additions and 23 deletions
|
@ -28,6 +28,7 @@
|
||||||
#include "backend/opencl/wrappers/OclDevice.h"
|
#include "backend/opencl/wrappers/OclDevice.h"
|
||||||
#include "crypto/common/Algorithm.h"
|
#include "crypto/common/Algorithm.h"
|
||||||
#include "crypto/randomx/randomx.h"
|
#include "crypto/randomx/randomx.h"
|
||||||
|
#include "crypto/rx/RxAlgo.h"
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
@ -40,26 +41,7 @@ bool ocl_generic_rx_generator(const OclDevice &device, const Algorithm &algorith
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t mem = device.globalMemSize();
|
const size_t mem = device.globalMemSize();
|
||||||
|
auto config = RxAlgo::base(algorithm);
|
||||||
RandomX_ConfigurationBase* config = nullptr;
|
|
||||||
|
|
||||||
switch (algorithm) {
|
|
||||||
case Algorithm::RX_0:
|
|
||||||
config = &RandomX_MoneroConfig;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Algorithm::RX_LOKI:
|
|
||||||
config = &RandomX_LokiConfig;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Algorithm::RX_WOW:
|
|
||||||
config = &RandomX_WowneroConfig;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool gcnAsm = false;
|
bool gcnAsm = false;
|
||||||
|
|
||||||
switch (device.type()) {
|
switch (device.type()) {
|
||||||
|
@ -70,6 +52,9 @@ bool ocl_generic_rx_generator(const OclDevice &device, const Algorithm &algorith
|
||||||
case OclDevice::Vega_20:
|
case OclDevice::Vega_20:
|
||||||
gcnAsm = true;
|
gcnAsm = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must have space for dataset, scratchpads and 128 MB of free memory
|
// Must have space for dataset, scratchpads and 128 MB of free memory
|
||||||
|
|
|
@ -37,7 +37,7 @@ xmrig::Algorithm::Id xmrig::RxAlgo::apply(Algorithm::Id algorithm)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RandomX_ConfigurationBase *xmrig::RxAlgo::base(Algorithm::Id algorithm)
|
const RandomX_ConfigurationBase *xmrig::RxAlgo::base(Algorithm::Id algorithm)
|
||||||
{
|
{
|
||||||
switch (algorithm) {
|
switch (algorithm) {
|
||||||
case Algorithm::RX_WOW:
|
case Algorithm::RX_WOW:
|
||||||
|
|
|
@ -46,7 +46,7 @@ class RxAlgo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Algorithm::Id apply(Algorithm::Id algorithm);
|
static Algorithm::Id apply(Algorithm::Id algorithm);
|
||||||
static RandomX_ConfigurationBase *base(Algorithm::Id algorithm);
|
static const RandomX_ConfigurationBase *base(Algorithm::Id algorithm);
|
||||||
static uint32_t programCount(Algorithm::Id algorithm);
|
static uint32_t programCount(Algorithm::Id algorithm);
|
||||||
static uint32_t programIterations(Algorithm::Id algorithm);
|
static uint32_t programIterations(Algorithm::Id algorithm);
|
||||||
static uint32_t programSize(Algorithm::Id algorithm);
|
static uint32_t programSize(Algorithm::Id algorithm);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue