From 6cb27e9662f4ab95b52fdb616a73288f4f23f451 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 8 Mar 2020 00:13:47 +0700 Subject: [PATCH] Added command line option --astrobwt-max-size --- CHANGELOG.md | 2 ++ README.md | 1 + src/backend/cpu/CpuConfig.h | 20 ++++++++++---------- src/base/kernel/interfaces/IConfig.h | 1 + src/core/config/ConfigTransform.cpp | 5 +++++ src/core/config/Config_platform.h | 3 +++ src/core/config/usage.h | 4 ++++ 7 files changed, 26 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e911991c..b6e21b0e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # v5.9.0 - [#1578](https://github.com/xmrig/xmrig/pull/1578) Added new RandomKEVA algorithm for upcoming Kevacoin fork, as `"algo": "rx/keva"` or `"coin": "keva"`. +- [#1584](https://github.com/xmrig/xmrig/pull/1584) Fixed invalid AstroBWT hashes after algorithm switching. +- Added command line option `--astrobwt-max-size`. # v5.8.2 - [#1580](https://github.com/xmrig/xmrig/pull/1580) AstroBWT algorithm 20-50% speedup. diff --git a/README.md b/README.md index 2110d2805..516072d47 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ CPU backend: --randomx-1gb-pages use 1GB hugepages for dataset (Linux only) --randomx-wrmsr=N write custom value (0-15) to Intel MSR register 0x1a4 or disable MSR mod (-1) --randomx-no-rdmsr disable reverting initial MSR values on exit + --astrobwt-max-size=N skip hashes with large stage 2 size, default: 550, min: 400, max: 1200 API: --api-worker-id=ID custom worker-id for API diff --git a/src/backend/cpu/CpuConfig.h b/src/backend/cpu/CpuConfig.h index ba2b84100..c294f0697 100644 --- a/src/backend/cpu/CpuConfig.h +++ b/src/backend/cpu/CpuConfig.h @@ -58,8 +58,8 @@ public: inline bool isYield() const { return m_yield; } inline const Assembly &assembly() const { return m_assembly; } inline const String &argon2Impl() const { return m_argon2Impl; } - inline int astrobwtMaxSize() const { return m_astrobwtMaxSize; } inline const Threads &threads() const { return m_threads; } + inline int astrobwtMaxSize() const { return m_astrobwtMaxSize; } inline int priority() const { return m_priority; } inline uint32_t limit() const { return m_limit; } @@ -70,18 +70,18 @@ private: inline void setPriority(int priority) { m_priority = (priority >= -1 && priority <= 5) ? priority : -1; } - AesMode m_aes = AES_AUTO; + AesMode m_aes = AES_AUTO; Assembly m_assembly; - bool m_enabled = true; - bool m_hugePages = true; - bool m_shouldSave = false; - bool m_yield = true; - int m_memoryPool = 0; - int m_priority = -1; + bool m_enabled = true; + bool m_hugePages = true; + bool m_shouldSave = false; + bool m_yield = true; + int m_astrobwtMaxSize = 550; + int m_memoryPool = 0; + int m_priority = -1; String m_argon2Impl; - int m_astrobwtMaxSize = 550; Threads m_threads; - uint32_t m_limit = 100; + uint32_t m_limit = 100; }; diff --git a/src/base/kernel/interfaces/IConfig.h b/src/base/kernel/interfaces/IConfig.h index 470f36ef8..af1c3d169 100644 --- a/src/base/kernel/interfaces/IConfig.h +++ b/src/base/kernel/interfaces/IConfig.h @@ -97,6 +97,7 @@ public: CPUMaxThreadsKey = 1026, MemoryPoolKey = 1027, YieldKey = 1030, + AstroBWTMaxSizeKey = 1034, // xmrig amd OclPlatformKey = 1400, diff --git a/src/core/config/ConfigTransform.cpp b/src/core/config/ConfigTransform.cpp index eb58cdaa2..ebbd7dbd7 100644 --- a/src/core/config/ConfigTransform.cpp +++ b/src/core/config/ConfigTransform.cpp @@ -156,6 +156,11 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const return set(doc, kCpu, "asm", arg); # endif +# ifdef XMRIG_ALGO_ASTROBWT + case IConfig::AstroBWTMaxSizeKey: /* --astrobwt-max-size */ + return set(doc, kCpu, "astrobwt-max-size", static_cast(strtol(arg, nullptr, 10))); +# endif + # ifdef XMRIG_ALGO_RANDOMX case IConfig::RandomXInitKey: /* --randomx-init */ return set(doc, kRandomX, "init", static_cast(strtol(arg, nullptr, 10))); diff --git a/src/core/config/Config_platform.h b/src/core/config/Config_platform.h index cd5567db7..b6bed7f86 100644 --- a/src/core/config/Config_platform.h +++ b/src/core/config/Config_platform.h @@ -107,6 +107,9 @@ static const option options[] = { { "randomx-no-rdmsr", 0, nullptr, IConfig::RandomXRdmsrKey }, { "no-rdmsr", 0, nullptr, IConfig::RandomXRdmsrKey }, # endif + #ifdef XMRIG_ALGO_ASTROBWT + { "astrobwt-max-size", 1, nullptr, IConfig::AstroBWTMaxSizeKey }, + #endif # ifdef XMRIG_FEATURE_OPENCL { "opencl", 0, nullptr, IConfig::OclKey }, { "opencl-devices", 1, nullptr, IConfig::OclDevicesKey }, diff --git a/src/core/config/usage.h b/src/core/config/usage.h index bc2cff3da..0bc9db8c0 100644 --- a/src/core/config/usage.h +++ b/src/core/config/usage.h @@ -94,6 +94,10 @@ static inline const std::string &usage() u += " --randomx-no-rdmsr disable reverting initial MSR values on exit\n"; # endif +# ifdef XMRIG_ALGO_ASTROBWT + u += " --astrobwt-max-size=N skip hashes with large stage 2 size, default: 550, min: 400, max: 1200\n"; +# endif + # ifdef XMRIG_FEATURE_HTTP u += "\nAPI:\n"; u += " --api-worker-id=ID custom worker-id for API\n";