Cleanup MoneroOcean patchset
This commit is contained in:
parent
42235a56da
commit
30fdc92884
28 changed files with 6138 additions and 6122 deletions
|
@ -24,6 +24,7 @@ option(WITH_NVML "Enable NVML (NVIDIA Management Library) support (on
|
||||||
option(WITH_ADL "Enable ADL (AMD Display Library) or sysfs support (only if OpenCL backend enabled)" ON)
|
option(WITH_ADL "Enable ADL (AMD Display Library) or sysfs support (only if OpenCL backend enabled)" ON)
|
||||||
option(WITH_STRICT_CACHE "Enable strict checks for OpenCL cache" ON)
|
option(WITH_STRICT_CACHE "Enable strict checks for OpenCL cache" ON)
|
||||||
option(WITH_INTERLEAVE_DEBUG_LOG "Enable debug log for threads interleave" OFF)
|
option(WITH_INTERLEAVE_DEBUG_LOG "Enable debug log for threads interleave" OFF)
|
||||||
|
option(WITH_BENCHMARK "Enable Benchmark module and algo-perf feature (for MoneroOcean)" ON)
|
||||||
|
|
||||||
option(BUILD_STATIC "Build static binary" OFF)
|
option(BUILD_STATIC "Build static binary" OFF)
|
||||||
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
|
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
|
||||||
|
@ -100,7 +101,6 @@ set(SOURCES
|
||||||
src/core/config/ConfigTransform.cpp
|
src/core/config/ConfigTransform.cpp
|
||||||
src/core/Controller.cpp
|
src/core/Controller.cpp
|
||||||
src/core/Miner.cpp
|
src/core/Miner.cpp
|
||||||
src/core/Benchmark.cpp
|
|
||||||
src/net/JobResults.cpp
|
src/net/JobResults.cpp
|
||||||
src/net/Network.cpp
|
src/net/Network.cpp
|
||||||
src/net/strategies/DonateStrategy.cpp
|
src/net/strategies/DonateStrategy.cpp
|
||||||
|
@ -121,6 +121,13 @@ set(SOURCES_CRYPTO
|
||||||
src/crypto/common/VirtualMemory.cpp
|
src/crypto/common/VirtualMemory.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (WITH_BENCHMARK)
|
||||||
|
list(APPEND SOURCES
|
||||||
|
src/core/Benchmark.cpp
|
||||||
|
)
|
||||||
|
add_definitions(/DXMRIG_FEATURE_BENCHMARK)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (WITH_HWLOC)
|
if (WITH_HWLOC)
|
||||||
list(APPEND HEADERS_CRYPTO
|
list(APPEND HEADERS_CRYPTO
|
||||||
src/crypto/common/NUMAMemoryPool.h
|
src/crypto/common/NUMAMemoryPool.h
|
||||||
|
|
|
@ -40,11 +40,8 @@ if (WITH_RANDOMX)
|
||||||
src/crypto/rx/RxDataset.cpp
|
src/crypto/rx/RxDataset.cpp
|
||||||
src/crypto/rx/RxQueue.cpp
|
src/crypto/rx/RxQueue.cpp
|
||||||
src/crypto/rx/RxVm.cpp
|
src/crypto/rx/RxVm.cpp
|
||||||
|
|
||||||
src/crypto/defyx/align.h
|
src/crypto/defyx/align.h
|
||||||
src/crypto/defyx/brg_endian.h
|
src/crypto/defyx/brg_endian.h
|
||||||
src/crypto/defyx/defyx.cpp
|
|
||||||
src/crypto/defyx/defyx.h
|
|
||||||
src/crypto/defyx/KangarooTwelve.c
|
src/crypto/defyx/KangarooTwelve.c
|
||||||
src/crypto/defyx/KangarooTwelve.h
|
src/crypto/defyx/KangarooTwelve.h
|
||||||
src/crypto/defyx/KeccakP-1600-reference.c
|
src/crypto/defyx/KeccakP-1600-reference.c
|
||||||
|
|
|
@ -91,6 +91,7 @@ int xmrig::App::exec()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
m_controller->pre_start();
|
m_controller->pre_start();
|
||||||
m_controller->config()->benchmark().set_controller(m_controller);
|
m_controller->config()->benchmark().set_controller(m_controller);
|
||||||
|
|
||||||
|
@ -99,6 +100,9 @@ int xmrig::App::exec()
|
||||||
} else {
|
} else {
|
||||||
m_controller->start();
|
m_controller->start();
|
||||||
}
|
}
|
||||||
|
# else
|
||||||
|
m_controller->start();
|
||||||
|
# endif
|
||||||
|
|
||||||
rc = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
rc = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||||
uv_loop_close(uv_default_loop());
|
uv_loop_close(uv_default_loop());
|
||||||
|
|
|
@ -138,8 +138,8 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<CpuThreads> &threads, uint32
|
||||||
count += threads.move("rx/wow", std::move(wow));
|
count += threads.move("rx/wow", std::move(wow));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!threads.isExist(Algorithm::DEFYX)) {
|
if (!threads.isExist(Algorithm::RX_DEFYX)) {
|
||||||
count += generate("defyx", threads, Algorithm::DEFYX, limit);
|
count += generate("defyx", threads, Algorithm::RX_DEFYX, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
count += generate("rx", threads, Algorithm::RX_0, limit);
|
count += generate("rx", threads, Algorithm::RX_0, limit);
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
|
|
||||||
#ifdef XMRIG_ALGO_RANDOMX
|
#ifdef XMRIG_ALGO_RANDOMX
|
||||||
# include "crypto/randomx/randomx.h"
|
# include "crypto/randomx/randomx.h"
|
||||||
# include "crypto/defyx/defyx.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -253,27 +252,22 @@ void xmrig::CpuWorker<N>::start()
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
if (job.algorithm().family() == Algorithm::RANDOM_X) {
|
if (job.algorithm().family() == Algorithm::RANDOM_X) {
|
||||||
|
|
||||||
if (job.algorithm() == Algorithm::DEFYX) {
|
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
|
if (job.algorithm() == Algorithm::RX_DEFYX) {
|
||||||
defyx_calculate_hash_first(m_vm, tempHash, m_job.blob(), job.size());
|
defyx_calculate_hash_first(m_vm, tempHash, m_job.blob(), job.size());
|
||||||
}
|
|
||||||
|
|
||||||
if (!nextRound(m_job)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
defyx_calculate_hash_next(m_vm, tempHash, m_job.blob(), job.size(), m_hash);
|
|
||||||
} else {
|
} else {
|
||||||
if (first) {
|
|
||||||
first = false;
|
|
||||||
randomx_calculate_hash_first(m_vm, tempHash, m_job.blob(), job.size());
|
randomx_calculate_hash_first(m_vm, tempHash, m_job.blob(), job.size());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!nextRound(m_job)) {
|
if (!nextRound(m_job)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (job.algorithm() == Algorithm::RX_DEFYX) {
|
||||||
|
defyx_calculate_hash_next(m_vm, tempHash, m_job.blob(), job.size(), m_hash);
|
||||||
|
} else {
|
||||||
randomx_calculate_hash_next(m_vm, tempHash, m_job.blob(), job.size(), m_hash);
|
randomx_calculate_hash_next(m_vm, tempHash, m_job.blob(), job.size(), m_hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,11 @@
|
||||||
#define ALGO_RX_ARQMA 23
|
#define ALGO_RX_ARQMA 23
|
||||||
#define ALGO_RX_SFX 24
|
#define ALGO_RX_SFX 24
|
||||||
#define ALGO_RX_KEVA 25
|
#define ALGO_RX_KEVA 25
|
||||||
#define ALGO_AR2_CHUKWA 26
|
#define ALGO_RX_DEFYX 26
|
||||||
#define ALGO_AR2_WRKZ 27
|
#define ALGO_AR2_CHUKWA 27
|
||||||
#define ALGO_ASTROBWT_DERO 28
|
#define ALGO_AR2_WRKZ 28
|
||||||
#define ALGO_KAWPOW_RVN 29
|
#define ALGO_ASTROBWT_DERO 29
|
||||||
|
#define ALGO_KAWPOW_RVN 30
|
||||||
|
|
||||||
#define FAMILY_UNKNOWN 0
|
#define FAMILY_UNKNOWN 0
|
||||||
#define FAMILY_CN 1
|
#define FAMILY_CN 1
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -111,13 +111,14 @@ static AlgoName const algorithm_names[] = {
|
||||||
{ "RandomWOW", nullptr, Algorithm::RX_WOW },
|
{ "RandomWOW", nullptr, Algorithm::RX_WOW },
|
||||||
{ "randomx/loki", "rx/loki", Algorithm::RX_LOKI },
|
{ "randomx/loki", "rx/loki", Algorithm::RX_LOKI },
|
||||||
{ "RandomXL", nullptr, Algorithm::RX_LOKI },
|
{ "RandomXL", nullptr, Algorithm::RX_LOKI },
|
||||||
{ "DefyX", "defyx", Algorithm::DEFYX },
|
|
||||||
{ "randomx/arq", "rx/arq", Algorithm::RX_ARQ },
|
{ "randomx/arq", "rx/arq", Algorithm::RX_ARQ },
|
||||||
{ "RandomARQ", nullptr, Algorithm::RX_ARQ },
|
{ "RandomARQ", nullptr, Algorithm::RX_ARQ },
|
||||||
{ "randomx/sfx", "rx/sfx", Algorithm::RX_SFX },
|
{ "randomx/sfx", "rx/sfx", Algorithm::RX_SFX },
|
||||||
{ "RandomSFX", nullptr, Algorithm::RX_SFX },
|
{ "RandomSFX", nullptr, Algorithm::RX_SFX },
|
||||||
{ "randomx/keva", "rx/keva", Algorithm::RX_KEVA },
|
{ "randomx/keva", "rx/keva", Algorithm::RX_KEVA },
|
||||||
{ "RandomKEVA", nullptr, Algorithm::RX_KEVA },
|
{ "RandomKEVA", nullptr, Algorithm::RX_KEVA },
|
||||||
|
{ "defyx", "defyx", Algorithm::RX_DEFYX },
|
||||||
|
{ "DefyX", nullptr, Algorithm::RX_DEFYX },
|
||||||
# endif
|
# endif
|
||||||
# ifdef XMRIG_ALGO_ARGON2
|
# ifdef XMRIG_ALGO_ARGON2
|
||||||
{ "argon2/chukwa", nullptr, Algorithm::AR2_CHUKWA },
|
{ "argon2/chukwa", nullptr, Algorithm::AR2_CHUKWA },
|
||||||
|
@ -159,9 +160,7 @@ size_t xmrig::Algorithm::l2() const
|
||||||
|
|
||||||
case RX_WOW:
|
case RX_WOW:
|
||||||
case RX_KEVA:
|
case RX_KEVA:
|
||||||
return 0x20000;
|
case RX_DEFYX:
|
||||||
|
|
||||||
case DEFYX:
|
|
||||||
return 0x20000;
|
return 0x20000;
|
||||||
|
|
||||||
case RX_ARQ:
|
case RX_ARQ:
|
||||||
|
@ -212,10 +211,8 @@ size_t xmrig::Algorithm::l3() const
|
||||||
case RX_KEVA:
|
case RX_KEVA:
|
||||||
return oneMiB;
|
return oneMiB;
|
||||||
|
|
||||||
case DEFYX:
|
|
||||||
return oneMiB / 4;
|
|
||||||
|
|
||||||
case RX_ARQ:
|
case RX_ARQ:
|
||||||
|
case RX_DEFYX:
|
||||||
return oneMiB / 4;
|
return oneMiB / 4;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -340,10 +337,10 @@ xmrig::Algorithm::Family xmrig::Algorithm::family(Id id)
|
||||||
case RX_0:
|
case RX_0:
|
||||||
case RX_WOW:
|
case RX_WOW:
|
||||||
case RX_LOKI:
|
case RX_LOKI:
|
||||||
case DEFYX:
|
|
||||||
case RX_ARQ:
|
case RX_ARQ:
|
||||||
case RX_SFX:
|
case RX_SFX:
|
||||||
case RX_KEVA:
|
case RX_KEVA:
|
||||||
|
case RX_DEFYX:
|
||||||
return RANDOM_X;
|
return RANDOM_X;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,10 @@ public:
|
||||||
RX_0, // "rx/0" RandomX (reference configuration).
|
RX_0, // "rx/0" RandomX (reference configuration).
|
||||||
RX_WOW, // "rx/wow" RandomWOW (Wownero).
|
RX_WOW, // "rx/wow" RandomWOW (Wownero).
|
||||||
RX_LOKI, // "rx/loki" RandomXL (Loki).
|
RX_LOKI, // "rx/loki" RandomXL (Loki).
|
||||||
DEFYX, // "defyx" DefyX (Scala).
|
|
||||||
RX_ARQ, // "rx/arq" RandomARQ (Arqma).
|
RX_ARQ, // "rx/arq" RandomARQ (Arqma).
|
||||||
RX_SFX, // "rx/sfx" RandomSFX (Safex Cash).
|
RX_SFX, // "rx/sfx" RandomSFX (Safex Cash).
|
||||||
RX_KEVA, // "rx/keva" RandomKEVA (Keva).
|
RX_KEVA, // "rx/keva" RandomKEVA (Keva).
|
||||||
|
RX_DEFYX, // "defyx" DefyX (Scala).
|
||||||
AR2_CHUKWA, // "argon2/chukwa" Argon2id (Chukwa).
|
AR2_CHUKWA, // "argon2/chukwa" Argon2id (Chukwa).
|
||||||
AR2_WRKZ, // "argon2/wrkz" Argon2id (WRKZ)
|
AR2_WRKZ, // "argon2/wrkz" Argon2id (WRKZ)
|
||||||
ASTROBWT_DERO, // "astrobwt" AstroBWT (Dero)
|
ASTROBWT_DERO, // "astrobwt" AstroBWT (Dero)
|
||||||
|
|
|
@ -52,20 +52,32 @@
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
const char *BaseConfig::kAlgoPerf = "algo-perf";
|
||||||
|
#endif
|
||||||
const char *BaseConfig::kApi = "api";
|
const char *BaseConfig::kApi = "api";
|
||||||
const char *BaseConfig::kApiId = "id";
|
const char *BaseConfig::kApiId = "id";
|
||||||
const char *BaseConfig::kApiWorkerId = "worker-id";
|
const char *BaseConfig::kApiWorkerId = "worker-id";
|
||||||
const char *BaseConfig::kAutosave = "autosave";
|
const char *BaseConfig::kAutosave = "autosave";
|
||||||
const char *BaseConfig::kBackground = "background";
|
const char *BaseConfig::kBackground = "background";
|
||||||
|
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
const char *BaseConfig::kBenchAlgoTime = "bench-algo-time";
|
||||||
|
#endif
|
||||||
const char *BaseConfig::kColors = "colors";
|
const char *BaseConfig::kColors = "colors";
|
||||||
const char *BaseConfig::kDryRun = "dry-run";
|
const char *BaseConfig::kDryRun = "dry-run";
|
||||||
const char *BaseConfig::kHttp = "http";
|
const char *BaseConfig::kHttp = "http";
|
||||||
const char *BaseConfig::kLogFile = "log-file";
|
const char *BaseConfig::kLogFile = "log-file";
|
||||||
const char *BaseConfig::kPrintTime = "print-time";
|
const char *BaseConfig::kPrintTime = "print-time";
|
||||||
|
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
const char *BaseConfig::kRebenchAlgo = "rebench-algo";
|
||||||
|
#endif
|
||||||
const char *BaseConfig::kSyslog = "syslog";
|
const char *BaseConfig::kSyslog = "syslog";
|
||||||
const char *BaseConfig::kTitle = "title";
|
const char *BaseConfig::kTitle = "title";
|
||||||
const char *BaseConfig::kUserAgent = "user-agent";
|
const char *BaseConfig::kUserAgent = "user-agent";
|
||||||
const char *BaseConfig::kVerbose = "verbose";
|
const char *BaseConfig::kVerbose = "verbose";
|
||||||
|
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
const char *BaseConfig::kVersion = "version";
|
||||||
|
#endif
|
||||||
const char *BaseConfig::kWatch = "watch";
|
const char *BaseConfig::kWatch = "watch";
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,6 +100,9 @@ bool xmrig::BaseConfig::read(const IJsonReader &reader, const char *fileName)
|
||||||
m_autoSave = reader.getBool(kAutosave, m_autoSave);
|
m_autoSave = reader.getBool(kAutosave, m_autoSave);
|
||||||
m_background = reader.getBool(kBackground, m_background);
|
m_background = reader.getBool(kBackground, m_background);
|
||||||
m_dryRun = reader.getBool(kDryRun, m_dryRun);
|
m_dryRun = reader.getBool(kDryRun, m_dryRun);
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
m_rebenchAlgo = reader.getBool(kRebenchAlgo, m_rebenchAlgo);
|
||||||
|
# endif
|
||||||
m_syslog = reader.getBool(kSyslog, m_syslog);
|
m_syslog = reader.getBool(kSyslog, m_syslog);
|
||||||
m_watch = reader.getBool(kWatch, m_watch);
|
m_watch = reader.getBool(kWatch, m_watch);
|
||||||
m_logFile = reader.getString(kLogFile);
|
m_logFile = reader.getString(kLogFile);
|
||||||
|
@ -95,14 +110,15 @@ bool xmrig::BaseConfig::read(const IJsonReader &reader, const char *fileName)
|
||||||
m_printTime = std::min(reader.getUint(kPrintTime, m_printTime), 3600U);
|
m_printTime = std::min(reader.getUint(kPrintTime, m_printTime), 3600U);
|
||||||
m_title = reader.getValue(kTitle);
|
m_title = reader.getValue(kTitle);
|
||||||
|
|
||||||
m_rebenchAlgo = reader.getBool("rebench-algo", m_rebenchAlgo);
|
|
||||||
m_benchAlgoTime = reader.getInt("bench-algo-time", m_benchAlgoTime);
|
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
m_tls = reader.getValue(kTls);
|
m_tls = reader.getValue(kTls);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
Log::setColors(reader.getBool(kColors, Log::isColors()));
|
Log::setColors(reader.getBool(kColors, Log::isColors()));
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
m_version = reader.getUint(kVersion);
|
||||||
|
m_benchAlgoTime = reader.getInt(kBenchAlgoTime, m_benchAlgoTime);
|
||||||
|
# endif
|
||||||
setVerbose(reader.getValue(kVerbose));
|
setVerbose(reader.getValue(kVerbose));
|
||||||
|
|
||||||
const auto &api = reader.getObject(kApi);
|
const auto &api = reader.getObject(kApi);
|
||||||
|
|
|
@ -46,20 +46,32 @@ class IJsonReader;
|
||||||
class BaseConfig : public IConfig
|
class BaseConfig : public IConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
static const char *kAlgoPerf;
|
||||||
|
# endif
|
||||||
static const char *kApi;
|
static const char *kApi;
|
||||||
static const char *kApiId;
|
static const char *kApiId;
|
||||||
static const char *kApiWorkerId;
|
static const char *kApiWorkerId;
|
||||||
static const char *kAutosave;
|
static const char *kAutosave;
|
||||||
static const char *kBackground;
|
static const char *kBackground;
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
static const char *kBenchAlgoTime;
|
||||||
|
# endif
|
||||||
static const char *kColors;
|
static const char *kColors;
|
||||||
static const char *kDryRun;
|
static const char *kDryRun;
|
||||||
static const char *kHttp;
|
static const char *kHttp;
|
||||||
static const char *kLogFile;
|
static const char *kLogFile;
|
||||||
static const char *kPrintTime;
|
static const char *kPrintTime;
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
static const char *kRebenchAlgo;
|
||||||
|
# endif
|
||||||
static const char *kSyslog;
|
static const char *kSyslog;
|
||||||
static const char *kTitle;
|
static const char *kTitle;
|
||||||
static const char *kUserAgent;
|
static const char *kUserAgent;
|
||||||
static const char *kVerbose;
|
static const char *kVerbose;
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
static const char *kVersion;
|
||||||
|
# endif
|
||||||
static const char *kWatch;
|
static const char *kWatch;
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
|
@ -81,8 +93,10 @@ public:
|
||||||
inline const Title &title() const { return m_title; }
|
inline const Title &title() const { return m_title; }
|
||||||
inline uint32_t printTime() const { return m_printTime; }
|
inline uint32_t printTime() const { return m_printTime; }
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
inline bool isRebenchAlgo() const { return m_rebenchAlgo; }
|
inline bool isRebenchAlgo() const { return m_rebenchAlgo; }
|
||||||
inline int benchAlgoTime() const { return m_benchAlgoTime; }
|
inline int benchAlgoTime() const { return m_benchAlgoTime; }
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
inline const TlsConfig &tls() const { return m_tls; }
|
inline const TlsConfig &tls() const { return m_tls; }
|
||||||
|
@ -114,8 +128,11 @@ protected:
|
||||||
Title m_title;
|
Title m_title;
|
||||||
uint32_t m_printTime = 60;
|
uint32_t m_printTime = 60;
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
uint32_t m_version = 0;
|
||||||
bool m_rebenchAlgo = false;
|
bool m_rebenchAlgo = false;
|
||||||
int m_benchAlgoTime = 10;
|
int m_benchAlgoTime = 10;
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
TlsConfig m_tls;
|
TlsConfig m_tls;
|
||||||
|
|
|
@ -235,20 +235,30 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
|
||||||
case IConfig::PrintTimeKey: /* --print-time */
|
case IConfig::PrintTimeKey: /* --print-time */
|
||||||
case IConfig::HttpPort: /* --http-port */
|
case IConfig::HttpPort: /* --http-port */
|
||||||
case IConfig::DonateLevelKey: /* --donate-level */
|
case IConfig::DonateLevelKey: /* --donate-level */
|
||||||
|
# ifdef XMRIG_FEATURE_HTTP
|
||||||
case IConfig::DaemonPollKey: /* --daemon-poll-interval */
|
case IConfig::DaemonPollKey: /* --daemon-poll-interval */
|
||||||
|
# endif
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
case IConfig::BenchAlgoTimeKey: /* --bench-algo-time */
|
case IConfig::BenchAlgoTimeKey: /* --bench-algo-time */
|
||||||
|
# endif
|
||||||
return transformUint64(doc, key, static_cast<uint64_t>(strtol(arg, nullptr, 10)));
|
return transformUint64(doc, key, static_cast<uint64_t>(strtol(arg, nullptr, 10)));
|
||||||
|
|
||||||
case IConfig::BackgroundKey: /* --background */
|
case IConfig::BackgroundKey: /* --background */
|
||||||
case IConfig::SyslogKey: /* --syslog */
|
case IConfig::SyslogKey: /* --syslog */
|
||||||
case IConfig::KeepAliveKey: /* --keepalive */
|
case IConfig::KeepAliveKey: /* --keepalive */
|
||||||
case IConfig::NicehashKey: /* --nicehash */
|
case IConfig::NicehashKey: /* --nicehash */
|
||||||
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
case IConfig::TlsKey: /* --tls */
|
case IConfig::TlsKey: /* --tls */
|
||||||
|
# endif
|
||||||
case IConfig::DryRunKey: /* --dry-run */
|
case IConfig::DryRunKey: /* --dry-run */
|
||||||
|
# ifdef XMRIG_FEATURE_HTTP
|
||||||
case IConfig::HttpEnabledKey: /* --http-enabled */
|
case IConfig::HttpEnabledKey: /* --http-enabled */
|
||||||
case IConfig::DaemonKey: /* --daemon */
|
case IConfig::DaemonKey: /* --daemon */
|
||||||
case IConfig::RebenchAlgoKey: /* --rebench-algo */
|
# endif
|
||||||
case IConfig::VerboseKey: /* --verbose */
|
case IConfig::VerboseKey: /* --verbose */
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
case IConfig::RebenchAlgoKey: /* --rebench-algo */
|
||||||
|
# endif
|
||||||
return transformBoolean(doc, key, true);
|
return transformBoolean(doc, key, true);
|
||||||
|
|
||||||
case IConfig::ColorKey: /* --no-color */
|
case IConfig::ColorKey: /* --no-color */
|
||||||
|
@ -343,8 +353,10 @@ void xmrig::BaseTransform::transformUint64(rapidjson::Document &doc, int key, ui
|
||||||
return add(doc, Pools::kPools, Pool::kDaemonPollInterval, arg);
|
return add(doc, Pools::kPools, Pool::kDaemonPollInterval, arg);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
case IConfig::BenchAlgoTimeKey: /* --bench-algo-time */
|
case IConfig::BenchAlgoTimeKey: /* --bench-algo-time */
|
||||||
return set(doc, "bench-algo-time", arg);
|
return set(doc, "bench-algo-time", arg);
|
||||||
|
# endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -82,8 +82,10 @@ public:
|
||||||
NicehashKey = 1006,
|
NicehashKey = 1006,
|
||||||
PrintTimeKey = 1007,
|
PrintTimeKey = 1007,
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
RebenchAlgoKey = 10001,
|
RebenchAlgoKey = 10001,
|
||||||
BenchAlgoTimeKey = 10002,
|
BenchAlgoTimeKey = 10002,
|
||||||
|
# endif
|
||||||
|
|
||||||
// xmrig cpu
|
// xmrig cpu
|
||||||
CPUKey = 1024,
|
CPUKey = 1024,
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
"restricted": true
|
"restricted": true
|
||||||
},
|
},
|
||||||
"autosave": true,
|
"autosave": true,
|
||||||
"rebench-algo": false,
|
|
||||||
"bench-algo-time": 10,
|
|
||||||
"background": false,
|
"background": false,
|
||||||
"colors": true,
|
"colors": true,
|
||||||
"title": true,
|
"title": true,
|
||||||
|
@ -92,5 +90,7 @@
|
||||||
},
|
},
|
||||||
"user-agent": null,
|
"user-agent": null,
|
||||||
"verbose": 0,
|
"verbose": 0,
|
||||||
"watch": true
|
"watch": true,
|
||||||
|
"rebench-algo": false,
|
||||||
|
"bench-algo-time": 10
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "net/Network.h"
|
#include "net/Network.h"
|
||||||
#include "rapidjson/document.h"
|
#include "rapidjson/document.h"
|
||||||
#include "backend/common/interfaces/IBackend.h"
|
#include "backend/common/interfaces/IBackend.h"
|
||||||
|
#include "backend/common/Hashrate.h"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
@ -59,6 +60,7 @@ void Benchmark::finish() {
|
||||||
}
|
}
|
||||||
m_bench_algo = BenchAlgo::INVALID;
|
m_bench_algo = BenchAlgo::INVALID;
|
||||||
m_controller->miner()->pause(); // do not compute anything before job from the pool
|
m_controller->miner()->pause(); // do not compute anything before job from the pool
|
||||||
|
JobResults::stop();
|
||||||
JobResults::setListener(m_controller->network(), m_controller->config()->cpu().isHwAES());
|
JobResults::setListener(m_controller->network(), m_controller->config()->cpu().isHwAES());
|
||||||
m_controller->start();
|
m_controller->start();
|
||||||
}
|
}
|
||||||
|
@ -104,33 +106,39 @@ void Benchmark::read(const rapidjson::Value &value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Benchmark::get_algo_perf(Algorithm::Id algo) const {
|
double Benchmark::get_algo_perf(Algorithm::Id algo) const {
|
||||||
switch (algo) {
|
switch (algo) {
|
||||||
case Algorithm::CN_0: return m_bench_algo_perf[BenchAlgo::CN_R];
|
case Algorithm::CN_CCX: return m_bench_algo_perf[BenchAlgo::CN_CCX];
|
||||||
|
case Algorithm::CN_0: return m_bench_algo_perf[BenchAlgo::CN_CCX] / 2;
|
||||||
case Algorithm::CN_1: return m_bench_algo_perf[BenchAlgo::CN_R];
|
case Algorithm::CN_1: return m_bench_algo_perf[BenchAlgo::CN_R];
|
||||||
case Algorithm::CN_2: return m_bench_algo_perf[BenchAlgo::CN_R];
|
case Algorithm::CN_2: return m_bench_algo_perf[BenchAlgo::CN_R];
|
||||||
case Algorithm::CN_R: return m_bench_algo_perf[BenchAlgo::CN_R];
|
case Algorithm::CN_R: return m_bench_algo_perf[BenchAlgo::CN_R];
|
||||||
|
case Algorithm::CN_RTO: return m_bench_algo_perf[BenchAlgo::CN_R];
|
||||||
|
case Algorithm::CN_XAO: return m_bench_algo_perf[BenchAlgo::CN_R];
|
||||||
case Algorithm::CN_FAST: return m_bench_algo_perf[BenchAlgo::CN_R] * 2;
|
case Algorithm::CN_FAST: return m_bench_algo_perf[BenchAlgo::CN_R] * 2;
|
||||||
case Algorithm::CN_HALF: return m_bench_algo_perf[BenchAlgo::CN_R] * 2;
|
case Algorithm::CN_HALF: return m_bench_algo_perf[BenchAlgo::CN_R] * 2;
|
||||||
case Algorithm::CN_XAO: return m_bench_algo_perf[BenchAlgo::CN_R];
|
|
||||||
case Algorithm::CN_RTO: return m_bench_algo_perf[BenchAlgo::CN_R];
|
|
||||||
case Algorithm::CN_RWZ: return m_bench_algo_perf[BenchAlgo::CN_R] / 3 * 4;
|
case Algorithm::CN_RWZ: return m_bench_algo_perf[BenchAlgo::CN_R] / 3 * 4;
|
||||||
case Algorithm::CN_ZLS: return m_bench_algo_perf[BenchAlgo::CN_R] / 3 * 4;
|
case Algorithm::CN_ZLS: return m_bench_algo_perf[BenchAlgo::CN_R] / 3 * 4;
|
||||||
case Algorithm::CN_DOUBLE: return m_bench_algo_perf[BenchAlgo::CN_R] / 2;
|
case Algorithm::CN_DOUBLE: return m_bench_algo_perf[BenchAlgo::CN_R] / 2;
|
||||||
case Algorithm::CN_GPU: return m_bench_algo_perf[BenchAlgo::CN_GPU];
|
|
||||||
case Algorithm::CN_LITE_0: return m_bench_algo_perf[BenchAlgo::CN_LITE_1];
|
case Algorithm::CN_LITE_0: return m_bench_algo_perf[BenchAlgo::CN_LITE_1];
|
||||||
case Algorithm::CN_LITE_1: return m_bench_algo_perf[BenchAlgo::CN_LITE_1];
|
case Algorithm::CN_LITE_1: return m_bench_algo_perf[BenchAlgo::CN_LITE_1];
|
||||||
case Algorithm::CN_HEAVY_0: return m_bench_algo_perf[BenchAlgo::CN_HEAVY_TUBE];
|
case Algorithm::CN_HEAVY_0: return m_bench_algo_perf[BenchAlgo::CN_HEAVY_TUBE];
|
||||||
case Algorithm::CN_HEAVY_TUBE: return m_bench_algo_perf[BenchAlgo::CN_HEAVY_TUBE];
|
case Algorithm::CN_HEAVY_TUBE: return m_bench_algo_perf[BenchAlgo::CN_HEAVY_TUBE];
|
||||||
case Algorithm::CN_HEAVY_XHV: return m_bench_algo_perf[BenchAlgo::CN_HEAVY_TUBE];
|
case Algorithm::CN_HEAVY_XHV: return m_bench_algo_perf[BenchAlgo::CN_HEAVY_TUBE];
|
||||||
case Algorithm::CN_PICO_0: return m_bench_algo_perf[BenchAlgo::CN_PICO_0];
|
case Algorithm::CN_PICO_0: return m_bench_algo_perf[BenchAlgo::CN_PICO_0];
|
||||||
case Algorithm::RX_LOKI: return m_bench_algo_perf[BenchAlgo::RX_0];
|
case Algorithm::CN_PICO_TLO: return m_bench_algo_perf[BenchAlgo::CN_PICO_0];
|
||||||
case Algorithm::RX_WOW: return m_bench_algo_perf[BenchAlgo::RX_WOW];
|
case Algorithm::CN_GPU: return m_bench_algo_perf[BenchAlgo::CN_GPU];
|
||||||
case Algorithm::RX_0: return m_bench_algo_perf[BenchAlgo::RX_0];
|
|
||||||
case Algorithm::DEFYX: return m_bench_algo_perf[BenchAlgo::DEFYX];
|
|
||||||
case Algorithm::RX_ARQ: return m_bench_algo_perf[BenchAlgo::RX_ARQ];
|
|
||||||
case Algorithm::AR2_CHUKWA: return m_bench_algo_perf[BenchAlgo::AR2_CHUKWA];
|
case Algorithm::AR2_CHUKWA: return m_bench_algo_perf[BenchAlgo::AR2_CHUKWA];
|
||||||
|
case Algorithm::AR2_WRKZ: return m_bench_algo_perf[BenchAlgo::AR2_WRKZ];
|
||||||
case Algorithm::ASTROBWT_DERO: return m_bench_algo_perf[BenchAlgo::ASTROBWT_DERO];
|
case Algorithm::ASTROBWT_DERO: return m_bench_algo_perf[BenchAlgo::ASTROBWT_DERO];
|
||||||
|
case Algorithm::KAWPOW_RVN: return m_bench_algo_perf[BenchAlgo::KAWPOW_RVN];
|
||||||
|
case Algorithm::RX_0: return m_bench_algo_perf[BenchAlgo::RX_0];
|
||||||
|
case Algorithm::RX_LOKI: return m_bench_algo_perf[BenchAlgo::RX_0];
|
||||||
|
case Algorithm::RX_SFX: return m_bench_algo_perf[BenchAlgo::RX_0];
|
||||||
|
case Algorithm::RX_WOW: return m_bench_algo_perf[BenchAlgo::RX_WOW];
|
||||||
|
case Algorithm::RX_ARQ: return m_bench_algo_perf[BenchAlgo::RX_ARQ];
|
||||||
|
case Algorithm::RX_KEVA: return m_bench_algo_perf[BenchAlgo::RX_KEVA];
|
||||||
|
case Algorithm::RX_DEFYX: return m_bench_algo_perf[BenchAlgo::RX_DEFYX];
|
||||||
default: return 0.0f;
|
default: return 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,9 +197,23 @@ void Benchmark::onJobResult(const JobResult& result) {
|
||||||
LOG_ALERT(" ===> Starting benchmark of %s algo", Algorithm(ba2a[m_bench_algo]).shortName());
|
LOG_ALERT(" ===> Starting benchmark of %s algo", Algorithm(ba2a[m_bench_algo]).shortName());
|
||||||
m_bench_start = now; // time of measurements start (in ms)
|
m_bench_start = now; // time of measurements start (in ms)
|
||||||
} else if (now - m_bench_start > static_cast<unsigned>(m_controller->config()->benchAlgoTime()*1000)) { // end of benchmark round for m_bench_algo
|
} else if (now - m_bench_start > static_cast<unsigned>(m_controller->config()->benchAlgoTime()*1000)) { // end of benchmark round for m_bench_algo
|
||||||
const float hashrate = static_cast<float>(m_hash_count) * result.diff / (now - m_bench_start) * 1000.0f;
|
double t[3] = { 0.0 };
|
||||||
|
for (auto backend : m_controller->miner()->backends()) {
|
||||||
|
const Hashrate *hr = backend->hashrate();
|
||||||
|
if (!hr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
t[0] += hr->calc(Hashrate::ShortInterval);
|
||||||
|
t[1] += hr->calc(Hashrate::MediumInterval);
|
||||||
|
t[2] += hr->calc(Hashrate::LargeInterval);
|
||||||
|
}
|
||||||
|
double hashrate = 0.0f;
|
||||||
|
if (!(hashrate = t[2]))
|
||||||
|
if (!(hashrate = t[1]))
|
||||||
|
if (!(hashrate = t[0]))
|
||||||
|
hashrate = static_cast<double>(m_hash_count) * result.diff / (now - m_bench_start) * 1000.0f;
|
||||||
m_bench_algo_perf[m_bench_algo] = hashrate; // store hashrate result
|
m_bench_algo_perf[m_bench_algo] = hashrate; // store hashrate result
|
||||||
LOG_ALERT(" ===> %s hasrate: %f", Algorithm(ba2a[m_bench_algo]).shortName(), hashrate);
|
LOG_ALERT(" ===> %s hashrate: %f", Algorithm(ba2a[m_bench_algo]).shortName(), hashrate);
|
||||||
run_next_bench_algo(m_bench_algo);
|
run_next_bench_algo(m_bench_algo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,38 +31,46 @@ class Job;
|
||||||
class Benchmark : public IJobResultListener {
|
class Benchmark : public IJobResultListener {
|
||||||
|
|
||||||
enum BenchAlgo : int {
|
enum BenchAlgo : int {
|
||||||
AR2_CHUKWA, // "argon2/chukwa"
|
|
||||||
RX_0, // "rx/0" RandomX (Monero).
|
|
||||||
RX_WOW, // "rx/wow" RandomWOW (Wownero).
|
|
||||||
DEFYX, // "defyx DefyX.
|
|
||||||
RX_ARQ, // "rx/arq" RandomARQ (Arqma).
|
|
||||||
CN_R, // "cn/r" CryptoNightR (Monero's variant 4).
|
CN_R, // "cn/r" CryptoNightR (Monero's variant 4).
|
||||||
CN_GPU, // "cn/gpu" CryptoNight-GPU (Ryo).
|
|
||||||
CN_LITE_1, // "cn-lite/1" CryptoNight-Lite variant 1.
|
CN_LITE_1, // "cn-lite/1" CryptoNight-Lite variant 1.
|
||||||
CN_HEAVY_TUBE, // "cn-heavy/tube" CryptoNight-Heavy (modified, TUBE only).
|
CN_HEAVY_TUBE, // "cn-heavy/tube" CryptoNight-Heavy (modified, TUBE only).
|
||||||
CN_PICO_0, // "cn-pico" CryptoNight Turtle (TRTL)
|
CN_PICO_0, // "cn-pico" CryptoNight-Pico.
|
||||||
ASTROBWT_DERO, // "astrobwt" AstroBWT (Dero)
|
CN_CCX, // "cn/ccx" Conceal (CCX).
|
||||||
|
CN_GPU, // "cn/gpu" CryptoNight-GPU (Ryo).
|
||||||
|
AR2_CHUKWA, // "argon2/chukwa" Argon2id (Chukwa).
|
||||||
|
AR2_WRKZ, // "argon2/wrkz" Argon2id (WRKZ).
|
||||||
|
ASTROBWT_DERO, // "astrobwt" AstroBWT (Dero).
|
||||||
|
KAWPOW_RVN, // "kawpow/rvn" KawPow (RVN).
|
||||||
|
RX_0, // "rx/0" RandomX (Monero).
|
||||||
|
RX_WOW, // "rx/wow" RandomWOW (Wownero).
|
||||||
|
RX_ARQ, // "rx/arq" RandomARQ (Arqma).
|
||||||
|
RX_KEVA, // "rx/keva" RandomKEVA (Keva).
|
||||||
|
RX_DEFYX, // "defyx DefyX.
|
||||||
MAX,
|
MAX,
|
||||||
MIN = 0,
|
MIN = 0,
|
||||||
INVALID = -1,
|
INVALID = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
const Algorithm::Id ba2a[BenchAlgo::MAX] = {
|
const Algorithm::Id ba2a[BenchAlgo::MAX] = {
|
||||||
Algorithm::AR2_CHUKWA,
|
|
||||||
Algorithm::RX_0,
|
|
||||||
Algorithm::RX_WOW,
|
|
||||||
Algorithm::DEFYX,
|
|
||||||
Algorithm::RX_ARQ,
|
|
||||||
Algorithm::CN_R,
|
Algorithm::CN_R,
|
||||||
Algorithm::CN_GPU,
|
|
||||||
Algorithm::CN_LITE_1,
|
Algorithm::CN_LITE_1,
|
||||||
Algorithm::CN_HEAVY_TUBE,
|
Algorithm::CN_HEAVY_TUBE,
|
||||||
Algorithm::CN_PICO_0,
|
Algorithm::CN_PICO_0,
|
||||||
|
Algorithm::CN_CCX,
|
||||||
|
Algorithm::CN_GPU,
|
||||||
|
Algorithm::AR2_CHUKWA,
|
||||||
|
Algorithm::AR2_WRKZ,
|
||||||
Algorithm::ASTROBWT_DERO,
|
Algorithm::ASTROBWT_DERO,
|
||||||
|
Algorithm::KAWPOW_RVN,
|
||||||
|
Algorithm::RX_0,
|
||||||
|
Algorithm::RX_WOW,
|
||||||
|
Algorithm::RX_ARQ,
|
||||||
|
Algorithm::RX_KEVA,
|
||||||
|
Algorithm::RX_DEFYX,
|
||||||
};
|
};
|
||||||
|
|
||||||
Job* m_bench_job[BenchAlgo::MAX];
|
Job* m_bench_job[BenchAlgo::MAX];
|
||||||
float m_bench_algo_perf[BenchAlgo::MAX];
|
double m_bench_algo_perf[BenchAlgo::MAX];
|
||||||
|
|
||||||
Controller* m_controller; // to get access to config and network
|
Controller* m_controller; // to get access to config and network
|
||||||
bool m_isNewBenchRun; // true if benchmark is need to be executed or was executed
|
bool m_isNewBenchRun; // true if benchmark is need to be executed or was executed
|
||||||
|
@ -74,7 +82,7 @@ class Benchmark : public IJobResultListener {
|
||||||
std::set<uint32_t> m_backends_started; // id of backend started for benchmark
|
std::set<uint32_t> m_backends_started; // id of backend started for benchmark
|
||||||
|
|
||||||
uint64_t get_now() const; // get current time in ms
|
uint64_t get_now() const; // get current time in ms
|
||||||
float get_algo_perf(Algorithm::Id algo) const; // get algo perf based on m_bench_algo_perf
|
double get_algo_perf(Algorithm::Id algo) const; // get algo perf based on m_bench_algo_perf
|
||||||
void start(const Benchmark::BenchAlgo); // start benchmark for specified perf algo
|
void start(const Benchmark::BenchAlgo); // start benchmark for specified perf algo
|
||||||
void finish(); // end of benchmarks, switch to jobs from the pool (network), fill algo_perf
|
void finish(); // end of benchmarks, switch to jobs from the pool (network), fill algo_perf
|
||||||
void onJobResult(const JobResult&) override; // onJobResult is called after each computed benchmark hash
|
void onJobResult(const JobResult&) override; // onJobResult is called after each computed benchmark hash
|
||||||
|
@ -89,7 +97,7 @@ class Benchmark : public IJobResultListener {
|
||||||
void start(); // start benchmarks
|
void start(); // start benchmarks
|
||||||
|
|
||||||
bool isNewBenchRun() const { return m_isNewBenchRun; }
|
bool isNewBenchRun() const { return m_isNewBenchRun; }
|
||||||
float algo_perf[Algorithm::MAX];
|
double algo_perf[Algorithm::MAX];
|
||||||
|
|
||||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||||
void read(const rapidjson::Value &value);
|
void read(const rapidjson::Value &value);
|
||||||
|
|
|
@ -59,15 +59,20 @@ int xmrig::Controller::init()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
void xmrig::Controller::pre_start()
|
void xmrig::Controller::pre_start()
|
||||||
{
|
{
|
||||||
m_miner = new Miner(this);
|
m_miner = new Miner(this);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Controller::start()
|
void xmrig::Controller::start()
|
||||||
{
|
{
|
||||||
Base::start();
|
Base::start();
|
||||||
|
#ifndef XMRIG_FEATURE_BENCHMARK
|
||||||
|
m_miner = new Miner(this);
|
||||||
|
#endif
|
||||||
network()->connect();
|
network()->connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,9 @@ public:
|
||||||
~Controller() override;
|
~Controller() override;
|
||||||
|
|
||||||
int init() override;
|
int init() override;
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
void pre_start();
|
void pre_start();
|
||||||
|
# endif
|
||||||
void start() override;
|
void start() override;
|
||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,13 @@ bool xmrig::Config::isShouldSave() const
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
return (m_upgrade || cpu().isShouldSave() || m_benchmark.isNewBenchRun());
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
if (m_benchmark.isNewBenchRun()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return (m_upgrade || cpu().isShouldSave());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,7 +183,6 @@ bool xmrig::Config::read(const IJsonReader &reader, const char *fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
d_ptr->cpu.read(reader.getValue(kCPU));
|
d_ptr->cpu.read(reader.getValue(kCPU));
|
||||||
m_benchmark.read(reader.getValue("algo-perf"));
|
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
if (!d_ptr->rx.read(reader.getValue(kRandomX))) {
|
if (!d_ptr->rx.read(reader.getValue(kRandomX))) {
|
||||||
|
@ -197,6 +202,10 @@ bool xmrig::Config::read(const IJsonReader &reader, const char *fileName)
|
||||||
d_ptr->healthPrintTime = reader.getUint(kHealthPrintTime, d_ptr->healthPrintTime);
|
d_ptr->healthPrintTime = reader.getUint(kHealthPrintTime, d_ptr->healthPrintTime);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
m_benchmark.read(reader.getValue(kAlgoPerf));
|
||||||
|
# endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +263,9 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
||||||
doc.AddMember(StringRef(kVerbose), Log::verbose(), allocator);
|
doc.AddMember(StringRef(kVerbose), Log::verbose(), allocator);
|
||||||
doc.AddMember(StringRef(kWatch), m_watch, allocator);
|
doc.AddMember(StringRef(kWatch), m_watch, allocator);
|
||||||
|
|
||||||
doc.AddMember("algo-perf", m_benchmark.toJSON(doc), allocator);
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
doc.AddMember("rebench-algo", isRebenchAlgo(), allocator);
|
doc.AddMember(StringRef(kRebenchAlgo), isRebenchAlgo(), allocator);
|
||||||
doc.AddMember("bench-algo-time", benchAlgoTime(), allocator);
|
doc.AddMember(StringRef(kBenchAlgoTime), benchAlgoTime(), allocator);
|
||||||
|
doc.AddMember(StringRef(kAlgoPerf), m_benchmark.toJSON(doc), allocator);
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
#include "backend/cpu/CpuConfig.h"
|
#include "backend/cpu/CpuConfig.h"
|
||||||
#include "base/kernel/config/BaseConfig.h"
|
#include "base/kernel/config/BaseConfig.h"
|
||||||
#include "base/tools/Object.h"
|
#include "base/tools/Object.h"
|
||||||
|
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
#include "core/Benchmark.h"
|
#include "core/Benchmark.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
@ -59,7 +61,6 @@ public:
|
||||||
# ifdef XMRIG_FEATURE_OPENCL
|
# ifdef XMRIG_FEATURE_OPENCL
|
||||||
const OclConfig &cl() const;
|
const OclConfig &cl() const;
|
||||||
# endif
|
# endif
|
||||||
inline Benchmark &benchmark() { return m_benchmark; }
|
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_CUDA
|
# ifdef XMRIG_FEATURE_CUDA
|
||||||
const CudaConfig &cuda() const;
|
const CudaConfig &cuda() const;
|
||||||
|
@ -79,9 +80,15 @@ public:
|
||||||
bool read(const IJsonReader &reader, const char *fileName) override;
|
bool read(const IJsonReader &reader, const char *fileName) override;
|
||||||
void getJSON(rapidjson::Document &doc) const override;
|
void getJSON(rapidjson::Document &doc) const override;
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
inline Benchmark &benchmark() { return m_benchmark; }
|
||||||
|
# endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConfigPrivate *d_ptr;
|
ConfigPrivate *d_ptr;
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
Benchmark m_benchmark;
|
Benchmark m_benchmark;
|
||||||
|
# endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,134 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2018-2019, tevador <tevador@gmail.com>
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
* Neither the name of the copyright holder nor the
|
|
||||||
names of its contributors may be used to endorse or promote products
|
|
||||||
derived from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "defyx.h"
|
|
||||||
#include "crypto/randomx/blake2/blake2.h"
|
|
||||||
#include "crypto/randomx/vm_interpreted.hpp"
|
|
||||||
#include "crypto/randomx/vm_interpreted_light.hpp"
|
|
||||||
#include "crypto/randomx/vm_compiled.hpp"
|
|
||||||
#include "crypto/randomx/vm_compiled_light.hpp"
|
|
||||||
#include "crypto/randomx/jit_compiler_x86_static.hpp"
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "yescrypt.h"
|
|
||||||
#include "KangarooTwelve.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
#define YESCRYPT_FLAGS YESCRYPT_RW
|
|
||||||
#define YESCRYPT_BASE_N 2048
|
|
||||||
#define YESCRYPT_R 8
|
|
||||||
#define YESCRYPT_P 1
|
|
||||||
|
|
||||||
RandomX_ConfigurationScala::RandomX_ConfigurationScala()
|
|
||||||
{
|
|
||||||
ArgonMemory = 131072;
|
|
||||||
ArgonIterations = 2;
|
|
||||||
ArgonSalt = "DefyXScala\x13";
|
|
||||||
CacheAccesses = 2;
|
|
||||||
DatasetBaseSize = 33554432;
|
|
||||||
ProgramSize = 64;
|
|
||||||
ProgramIterations = 1024;
|
|
||||||
ProgramCount = 4;
|
|
||||||
ScratchpadL3_Size = 262144;
|
|
||||||
ScratchpadL2_Size = 131072;
|
|
||||||
ScratchpadL1_Size = 65536;
|
|
||||||
|
|
||||||
RANDOMX_FREQ_IADD_RS = 25;
|
|
||||||
RANDOMX_FREQ_CBRANCH = 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
RandomX_ConfigurationScala RandomX_ScalaConfig;
|
|
||||||
|
|
||||||
int sipesh(void *out, size_t outlen, const void *in, size_t inlen, const void *salt, size_t saltlen, unsigned int t_cost, unsigned int m_cost)
|
|
||||||
{
|
|
||||||
yescrypt_local_t local;
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
if (yescrypt_init_local(&local))
|
|
||||||
return -1;
|
|
||||||
retval = yescrypt_kdf(NULL, &local, (const uint8_t*)in, inlen, (const uint8_t*)salt, saltlen,
|
|
||||||
(uint64_t)YESCRYPT_BASE_N << m_cost, YESCRYPT_R, YESCRYPT_P,
|
|
||||||
t_cost, 0, YESCRYPT_FLAGS, (uint8_t*)out, outlen);
|
|
||||||
if (yescrypt_free_local(&local))
|
|
||||||
return -1;
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
int k12(const void *data, size_t length, void *hash)
|
|
||||||
{
|
|
||||||
|
|
||||||
int kDo = KangarooTwelve((const unsigned char *)data, length, (unsigned char *)hash, 32, 0, 0);
|
|
||||||
return kDo;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
void defyx_calculate_hash(randomx_vm *machine, const void *input, size_t inputSize, void *output) {
|
|
||||||
assert(machine != nullptr);
|
|
||||||
assert(inputSize == 0 || input != nullptr);
|
|
||||||
assert(output != nullptr);
|
|
||||||
alignas(16) uint64_t tempHash[8];
|
|
||||||
//rx_blake2b(tempHash, sizeof(tempHash), input, inputSize, nullptr, 0);
|
|
||||||
sipesh(tempHash, sizeof(tempHash), input, inputSize, input, inputSize, 0, 0);
|
|
||||||
k12(input, inputSize, tempHash);
|
|
||||||
machine->initScratchpad(&tempHash);
|
|
||||||
machine->resetRoundingMode();
|
|
||||||
for (uint32_t chain = 0; chain < RandomX_CurrentConfig.ProgramCount - 1; ++chain) {
|
|
||||||
machine->run(&tempHash);
|
|
||||||
rx_blake2b(tempHash, sizeof(tempHash), machine->getRegisterFile(), sizeof(randomx::RegisterFile), nullptr, 0);
|
|
||||||
}
|
|
||||||
machine->run(&tempHash);
|
|
||||||
machine->getFinalResult(output, RANDOMX_HASH_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void defyx_calculate_hash_first(randomx_vm* machine, uint64_t (&tempHash)[8], const void* input, size_t inputSize) {
|
|
||||||
//rx_blake2b(tempHash, sizeof(tempHash), input, inputSize, nullptr, 0);
|
|
||||||
sipesh(tempHash, sizeof(tempHash), input, inputSize, input, inputSize, 0, 0);
|
|
||||||
k12(input, inputSize, tempHash);
|
|
||||||
machine->initScratchpad(tempHash);
|
|
||||||
}
|
|
||||||
|
|
||||||
void defyx_calculate_hash_next(randomx_vm* machine, uint64_t (&tempHash)[8], const void* nextInput, size_t nextInputSize, void* output) {
|
|
||||||
machine->resetRoundingMode();
|
|
||||||
for (uint32_t chain = 0; chain < RandomX_CurrentConfig.ProgramCount - 1; ++chain) {
|
|
||||||
machine->run(&tempHash);
|
|
||||||
rx_blake2b(tempHash, sizeof(tempHash), machine->getRegisterFile(), sizeof(randomx::RegisterFile), nullptr, 0);
|
|
||||||
}
|
|
||||||
machine->run(&tempHash);
|
|
||||||
|
|
||||||
// Finish current hash and fill the scratchpad for the next hash at the same time
|
|
||||||
//rx_blake2b(tempHash, sizeof(tempHash), nextInput, nextInputSize, nullptr, 0);
|
|
||||||
sipesh(tempHash, sizeof(tempHash), nextInput, nextInputSize, nextInput, nextInputSize, 0, 0);
|
|
||||||
k12(nextInput, nextInputSize, tempHash);
|
|
||||||
machine->hashAndFill(output, RANDOMX_HASH_SIZE, tempHash);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2018-2019, tevador <tevador@gmail.com>
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
* Neither the name of the copyright holder nor the
|
|
||||||
names of its contributors may be used to endorse or promote products
|
|
||||||
derived from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef DEFYX_H
|
|
||||||
#define DEFYX_H
|
|
||||||
|
|
||||||
#include "crypto/randomx/randomx.h"
|
|
||||||
|
|
||||||
struct RandomX_ConfigurationScala : public RandomX_ConfigurationBase { RandomX_ConfigurationScala(); };
|
|
||||||
|
|
||||||
extern RandomX_ConfigurationScala RandomX_ScalaConfig;
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculates a RandomX hash value.
|
|
||||||
*
|
|
||||||
* @param machine is a pointer to a randomx_vm structure. Must not be NULL.
|
|
||||||
* @param input is a pointer to memory to be hashed. Must not be NULL.
|
|
||||||
* @param inputSize is the number of bytes to be hashed.
|
|
||||||
* @param output is a pointer to memory where the hash will be stored. Must not
|
|
||||||
* be NULL and at least RANDOMX_HASH_SIZE bytes must be available for writing.
|
|
||||||
*/
|
|
||||||
RANDOMX_EXPORT void defyx_calculate_hash(randomx_vm *machine, const void *input, size_t inputSize, void *output);
|
|
||||||
|
|
||||||
RANDOMX_EXPORT void defyx_calculate_hash_first(randomx_vm* machine, uint64_t (&tempHash)[8], const void* input, size_t inputSize);
|
|
||||||
RANDOMX_EXPORT void defyx_calculate_hash_next(randomx_vm* machine, uint64_t (&tempHash)[8], const void* nextInput, size_t nextInputSize, void* output);
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -47,6 +47,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "crypto/defyx/yescrypt.h"
|
||||||
|
#include "crypto/defyx/KangarooTwelve.h"
|
||||||
|
}
|
||||||
|
#define YESCRYPT_FLAGS YESCRYPT_RW
|
||||||
|
#define YESCRYPT_BASE_N 2048
|
||||||
|
#define YESCRYPT_R 8
|
||||||
|
#define YESCRYPT_P 1
|
||||||
|
|
||||||
RandomX_ConfigurationWownero::RandomX_ConfigurationWownero()
|
RandomX_ConfigurationWownero::RandomX_ConfigurationWownero()
|
||||||
{
|
{
|
||||||
ArgonSalt = "RandomWOW\x01";
|
ArgonSalt = "RandomWOW\x01";
|
||||||
|
@ -108,6 +117,24 @@ RandomX_ConfigurationKeva::RandomX_ConfigurationKeva()
|
||||||
ScratchpadL3_Size = 1048576;
|
ScratchpadL3_Size = 1048576;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RandomX_ConfigurationScala::RandomX_ConfigurationScala()
|
||||||
|
{
|
||||||
|
ArgonMemory = 131072;
|
||||||
|
ArgonIterations = 2;
|
||||||
|
ArgonSalt = "DefyXScala\x13";
|
||||||
|
CacheAccesses = 2;
|
||||||
|
DatasetBaseSize = 33554432;
|
||||||
|
ScratchpadL1_Size = 65536;
|
||||||
|
ScratchpadL2_Size = 131072;
|
||||||
|
ScratchpadL3_Size = 262144;
|
||||||
|
ProgramSize = 64;
|
||||||
|
ProgramIterations = 1024;
|
||||||
|
ProgramCount = 4;
|
||||||
|
|
||||||
|
RANDOMX_FREQ_IADD_RS = 25;
|
||||||
|
RANDOMX_FREQ_CBRANCH = 16;
|
||||||
|
}
|
||||||
|
|
||||||
RandomX_ConfigurationBase::RandomX_ConfigurationBase()
|
RandomX_ConfigurationBase::RandomX_ConfigurationBase()
|
||||||
: ArgonMemory(262144)
|
: ArgonMemory(262144)
|
||||||
, ArgonIterations(3)
|
, ArgonIterations(3)
|
||||||
|
@ -311,11 +338,37 @@ RandomX_ConfigurationLoki RandomX_LokiConfig;
|
||||||
RandomX_ConfigurationArqma RandomX_ArqmaConfig;
|
RandomX_ConfigurationArqma RandomX_ArqmaConfig;
|
||||||
RandomX_ConfigurationSafex RandomX_SafexConfig;
|
RandomX_ConfigurationSafex RandomX_SafexConfig;
|
||||||
RandomX_ConfigurationKeva RandomX_KevaConfig;
|
RandomX_ConfigurationKeva RandomX_KevaConfig;
|
||||||
|
RandomX_ConfigurationScala RandomX_ScalaConfig;
|
||||||
|
|
||||||
alignas(64) RandomX_ConfigurationBase RandomX_CurrentConfig;
|
alignas(64) RandomX_ConfigurationBase RandomX_CurrentConfig;
|
||||||
|
|
||||||
static std::mutex vm_pool_mutex;
|
static std::mutex vm_pool_mutex;
|
||||||
|
|
||||||
|
int sipesh(void *out, size_t outlen, const void *in, size_t inlen)
|
||||||
|
{
|
||||||
|
const void *salt = in;
|
||||||
|
size_t saltlen = inlen;
|
||||||
|
unsigned int t_cost = 0;
|
||||||
|
unsigned int m_cost = 0;
|
||||||
|
yescrypt_local_t local;
|
||||||
|
int retval;
|
||||||
|
|
||||||
|
if (yescrypt_init_local(&local))
|
||||||
|
return -1;
|
||||||
|
retval = yescrypt_kdf(NULL, &local, (const uint8_t*)in, inlen, (const uint8_t*)salt, saltlen,
|
||||||
|
(uint64_t)YESCRYPT_BASE_N << m_cost, YESCRYPT_R, YESCRYPT_P,
|
||||||
|
t_cost, 0, YESCRYPT_FLAGS, (uint8_t*)out, outlen);
|
||||||
|
if (yescrypt_free_local(&local))
|
||||||
|
return -1;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
int k12(void *hash, const void *data, size_t length)
|
||||||
|
{
|
||||||
|
int kDo = KangarooTwelve((const unsigned char *)data, length, (unsigned char *)hash, 32, 0, 0);
|
||||||
|
return kDo;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
randomx_cache *randomx_create_cache(randomx_flags flags, uint8_t *memory) {
|
randomx_cache *randomx_create_cache(randomx_flags flags, uint8_t *memory) {
|
||||||
|
@ -550,4 +603,40 @@ extern "C" {
|
||||||
machine->hashAndFill(output, RANDOMX_HASH_SIZE, tempHash);
|
machine->hashAndFill(output, RANDOMX_HASH_SIZE, tempHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void defyx_calculate_hash(randomx_vm *machine, const void *input, size_t inputSize, void *output) {
|
||||||
|
assert(machine != nullptr);
|
||||||
|
assert(inputSize == 0 || input != nullptr);
|
||||||
|
assert(output != nullptr);
|
||||||
|
alignas(16) uint64_t tempHash[8];
|
||||||
|
sipesh(tempHash, sizeof(tempHash), input, inputSize);
|
||||||
|
k12(tempHash, input, inputSize);
|
||||||
|
machine->initScratchpad(&tempHash);
|
||||||
|
machine->resetRoundingMode();
|
||||||
|
for (uint32_t chain = 0; chain < RandomX_CurrentConfig.ProgramCount - 1; ++chain) {
|
||||||
|
machine->run(&tempHash);
|
||||||
|
rx_blake2b(tempHash, sizeof(tempHash), machine->getRegisterFile(), sizeof(randomx::RegisterFile), nullptr, 0);
|
||||||
|
}
|
||||||
|
machine->run(&tempHash);
|
||||||
|
machine->getFinalResult(output, RANDOMX_HASH_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void defyx_calculate_hash_first(randomx_vm* machine, uint64_t (&tempHash)[8], const void* input, size_t inputSize) {
|
||||||
|
sipesh(tempHash, sizeof(tempHash), input, inputSize);
|
||||||
|
k12(tempHash, input, inputSize);
|
||||||
|
machine->initScratchpad(tempHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
void defyx_calculate_hash_next(randomx_vm* machine, uint64_t (&tempHash)[8], const void* nextInput, size_t nextInputSize, void* output) {
|
||||||
|
machine->resetRoundingMode();
|
||||||
|
for (uint32_t chain = 0; chain < RandomX_CurrentConfig.ProgramCount - 1; ++chain) {
|
||||||
|
machine->run(&tempHash);
|
||||||
|
rx_blake2b(tempHash, sizeof(tempHash), machine->getRegisterFile(), sizeof(randomx::RegisterFile), nullptr, 0);
|
||||||
|
}
|
||||||
|
machine->run(&tempHash);
|
||||||
|
|
||||||
|
// Finish current hash and fill the scratchpad for the next hash at the same time
|
||||||
|
sipesh(tempHash, sizeof(tempHash), nextInput, nextInputSize);
|
||||||
|
k12(tempHash, nextInput, nextInputSize);
|
||||||
|
machine->hashAndFill(output, RANDOMX_HASH_SIZE, tempHash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,6 +184,7 @@ struct RandomX_ConfigurationLoki : public RandomX_ConfigurationBase { RandomX_Co
|
||||||
struct RandomX_ConfigurationArqma : public RandomX_ConfigurationBase { RandomX_ConfigurationArqma(); };
|
struct RandomX_ConfigurationArqma : public RandomX_ConfigurationBase { RandomX_ConfigurationArqma(); };
|
||||||
struct RandomX_ConfigurationSafex : public RandomX_ConfigurationBase { RandomX_ConfigurationSafex(); };
|
struct RandomX_ConfigurationSafex : public RandomX_ConfigurationBase { RandomX_ConfigurationSafex(); };
|
||||||
struct RandomX_ConfigurationKeva : public RandomX_ConfigurationBase { RandomX_ConfigurationKeva(); };
|
struct RandomX_ConfigurationKeva : public RandomX_ConfigurationBase { RandomX_ConfigurationKeva(); };
|
||||||
|
struct RandomX_ConfigurationScala : public RandomX_ConfigurationBase { RandomX_ConfigurationScala(); };
|
||||||
|
|
||||||
extern RandomX_ConfigurationMonero RandomX_MoneroConfig;
|
extern RandomX_ConfigurationMonero RandomX_MoneroConfig;
|
||||||
extern RandomX_ConfigurationWownero RandomX_WowneroConfig;
|
extern RandomX_ConfigurationWownero RandomX_WowneroConfig;
|
||||||
|
@ -191,6 +192,7 @@ extern RandomX_ConfigurationLoki RandomX_LokiConfig;
|
||||||
extern RandomX_ConfigurationArqma RandomX_ArqmaConfig;
|
extern RandomX_ConfigurationArqma RandomX_ArqmaConfig;
|
||||||
extern RandomX_ConfigurationSafex RandomX_SafexConfig;
|
extern RandomX_ConfigurationSafex RandomX_SafexConfig;
|
||||||
extern RandomX_ConfigurationKeva RandomX_KevaConfig;
|
extern RandomX_ConfigurationKeva RandomX_KevaConfig;
|
||||||
|
extern RandomX_ConfigurationScala RandomX_ScalaConfig;
|
||||||
|
|
||||||
extern RandomX_ConfigurationBase RandomX_CurrentConfig;
|
extern RandomX_ConfigurationBase RandomX_CurrentConfig;
|
||||||
|
|
||||||
|
@ -350,6 +352,20 @@ RANDOMX_EXPORT void randomx_calculate_hash(randomx_vm *machine, const void *inpu
|
||||||
RANDOMX_EXPORT void randomx_calculate_hash_first(randomx_vm* machine, uint64_t (&tempHash)[8], const void* input, size_t inputSize);
|
RANDOMX_EXPORT void randomx_calculate_hash_first(randomx_vm* machine, uint64_t (&tempHash)[8], const void* input, size_t inputSize);
|
||||||
RANDOMX_EXPORT void randomx_calculate_hash_next(randomx_vm* machine, uint64_t (&tempHash)[8], const void* nextInput, size_t nextInputSize, void* output);
|
RANDOMX_EXPORT void randomx_calculate_hash_next(randomx_vm* machine, uint64_t (&tempHash)[8], const void* nextInput, size_t nextInputSize, void* output);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates a RandomX hash value (Scala variant).
|
||||||
|
*
|
||||||
|
* @param machine is a pointer to a randomx_vm structure. Must not be NULL.
|
||||||
|
* @param input is a pointer to memory to be hashed. Must not be NULL.
|
||||||
|
* @param inputSize is the number of bytes to be hashed.
|
||||||
|
* @param output is a pointer to memory where the hash will be stored. Must not
|
||||||
|
* be NULL and at least RANDOMX_HASH_SIZE bytes must be available for writing.
|
||||||
|
*/
|
||||||
|
RANDOMX_EXPORT void defyx_calculate_hash(randomx_vm *machine, const void *input, size_t inputSize, void *output);
|
||||||
|
|
||||||
|
RANDOMX_EXPORT void defyx_calculate_hash_first(randomx_vm* machine, uint64_t (&tempHash)[8], const void* input, size_t inputSize);
|
||||||
|
RANDOMX_EXPORT void defyx_calculate_hash_next(randomx_vm* machine, uint64_t (&tempHash)[8], const void* nextInput, size_t nextInputSize, void* output);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include "crypto/randomx/randomx.h"
|
#include "crypto/randomx/randomx.h"
|
||||||
#include "crypto/defyx/defyx.h"
|
|
||||||
#include "crypto/rx/RxAlgo.h"
|
#include "crypto/rx/RxAlgo.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,16 +49,15 @@ const RandomX_ConfigurationBase *xmrig::RxAlgo::base(Algorithm::Id algorithm)
|
||||||
case Algorithm::RX_ARQ:
|
case Algorithm::RX_ARQ:
|
||||||
return &RandomX_ArqmaConfig;
|
return &RandomX_ArqmaConfig;
|
||||||
|
|
||||||
case Algorithm::DEFYX:
|
|
||||||
return &RandomX_ScalaConfig;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Algorithm::RX_SFX:
|
case Algorithm::RX_SFX:
|
||||||
return &RandomX_SafexConfig;
|
return &RandomX_SafexConfig;
|
||||||
|
|
||||||
case Algorithm::RX_KEVA:
|
case Algorithm::RX_KEVA:
|
||||||
return &RandomX_KevaConfig;
|
return &RandomX_KevaConfig;
|
||||||
|
|
||||||
|
case Algorithm::RX_DEFYX:
|
||||||
|
return &RandomX_ScalaConfig;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,7 +318,7 @@ void xmrig::JobResults::done(const Job &job)
|
||||||
|
|
||||||
void xmrig::JobResults::setListener(IJobResultListener *listener, bool hwAES)
|
void xmrig::JobResults::setListener(IJobResultListener *listener, bool hwAES)
|
||||||
{
|
{
|
||||||
//assert(handler == nullptr);
|
assert(handler == nullptr);
|
||||||
|
|
||||||
handler = new JobResultsPrivate(listener, hwAES);
|
handler = new JobResultsPrivate(listener, hwAES);
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,6 +175,8 @@ void xmrig::Network::onLogin(IStrategy *, IClient *client, rapidjson::Document &
|
||||||
|
|
||||||
params.AddMember("algo", algo, allocator);
|
params.AddMember("algo", algo, allocator);
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||||
|
if (strstr(client->pool().host(), "moneroocean.stream")) {
|
||||||
Value algo_perf(kObjectType);
|
Value algo_perf(kObjectType);
|
||||||
|
|
||||||
for (const auto &a : algorithms) {
|
for (const auto &a : algorithms) {
|
||||||
|
@ -183,6 +185,8 @@ void xmrig::Network::onLogin(IStrategy *, IClient *client, rapidjson::Document &
|
||||||
|
|
||||||
params.AddMember("algo-perf", algo_perf, allocator);
|
params.AddMember("algo-perf", algo_perf, allocator);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Network::onPause(IStrategy *strategy)
|
void xmrig::Network::onPause(IStrategy *strategy)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue