From 449617d717c9741ae98dea0ccc41420d7b7a5bfe Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 20 Dec 2019 21:10:13 +0700 Subject: [PATCH] Allow use old CUDA plugin. --- src/backend/cuda/wrappers/CudaLib.cpp | 5 +++-- src/backend/opencl/OclLaunchData.cpp | 5 ++--- src/crypto/rx/RxAlgo.cpp | 10 ---------- src/crypto/rx/RxAlgo.h | 10 +++++++++- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/backend/cuda/wrappers/CudaLib.cpp b/src/backend/cuda/wrappers/CudaLib.cpp index 379244571..189c6b2a1 100644 --- a/src/backend/cuda/wrappers/CudaLib.cpp +++ b/src/backend/cuda/wrappers/CudaLib.cpp @@ -28,6 +28,7 @@ #include "backend/cuda/wrappers/CudaLib.h" +#include "crypto/rx/RxAlgo.h" namespace xmrig { @@ -163,7 +164,7 @@ bool xmrig::CudaLib::rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datase bool xmrig::CudaLib::setJob(nvid_ctx *ctx, const void *data, size_t size, const Algorithm &algorithm) noexcept { - return pSetJob(ctx, data, size, algorithm); + return pSetJob(ctx, data, size, RxAlgo::id(algorithm)); } @@ -187,7 +188,7 @@ const char *xmrig::CudaLib::pluginVersion() noexcept int xmrig::CudaLib::deviceInfo(nvid_ctx *ctx, int32_t blocks, int32_t threads, const Algorithm &algorithm, int32_t dataset_host) noexcept { - return pDeviceInfo(ctx, blocks, threads, algorithm, dataset_host); + return pDeviceInfo(ctx, blocks, threads, RxAlgo::id(algorithm), dataset_host); } diff --git a/src/backend/opencl/OclLaunchData.cpp b/src/backend/opencl/OclLaunchData.cpp index 70465a566..2af6d1019 100644 --- a/src/backend/opencl/OclLaunchData.cpp +++ b/src/backend/opencl/OclLaunchData.cpp @@ -27,7 +27,6 @@ #include "backend/opencl/OclLaunchData.h" #include "backend/common/Tags.h" #include "backend/opencl/OclConfig.h" -#include "crypto/rx/RxAlgo.h" xmrig::OclLaunchData::OclLaunchData(const Miner *miner, const Algorithm &algorithm, const OclConfig &config, const OclPlatform &platform, const OclThread &thread, const OclDevice &device, int64_t affinity) : @@ -44,8 +43,8 @@ xmrig::OclLaunchData::OclLaunchData(const Miner *miner, const Algorithm &algorit bool xmrig::OclLaunchData::isEqual(const OclLaunchData &other) const { - return (RxAlgo::id(other.algorithm) == RxAlgo::id(algorithm) && - other.thread == thread); + return (other.algorithm == algorithm && + other.thread == thread); } diff --git a/src/crypto/rx/RxAlgo.cpp b/src/crypto/rx/RxAlgo.cpp index b08b3b8e2..7f82227ec 100644 --- a/src/crypto/rx/RxAlgo.cpp +++ b/src/crypto/rx/RxAlgo.cpp @@ -37,16 +37,6 @@ xmrig::Algorithm::Id xmrig::RxAlgo::apply(Algorithm::Id algorithm) } -xmrig::Algorithm::Id xmrig::RxAlgo::id(Algorithm::Id algorithm) -{ - if (algorithm == Algorithm::RX_SFX || algorithm == Algorithm::RX_V) { - return Algorithm::RX_0; - } - - return algorithm; -} - - const RandomX_ConfigurationBase *xmrig::RxAlgo::base(Algorithm::Id algorithm) { switch (algorithm) { diff --git a/src/crypto/rx/RxAlgo.h b/src/crypto/rx/RxAlgo.h index ff2750c62..d2b30988b 100644 --- a/src/crypto/rx/RxAlgo.h +++ b/src/crypto/rx/RxAlgo.h @@ -46,12 +46,20 @@ class RxAlgo { public: static Algorithm::Id apply(Algorithm::Id algorithm); - static Algorithm::Id id(Algorithm::Id algorithm); static const RandomX_ConfigurationBase *base(Algorithm::Id algorithm); static uint32_t programCount(Algorithm::Id algorithm); static uint32_t programIterations(Algorithm::Id algorithm); static uint32_t programSize(Algorithm::Id algorithm); static uint32_t version(Algorithm::Id algorithm); + + static inline Algorithm::Id id(Algorithm::Id algorithm) + { + if (algorithm == Algorithm::RX_SFX || algorithm == Algorithm::RX_V) { + return Algorithm::RX_0; + } + + return algorithm; + } };