diff --git a/README.md b/README.md index a628ca8a..c16be08c 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ CPU backend: --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 + --astrobwt-avx2 enable AVX2 optimizations for AstroBWT algorithm API: --api-worker-id=ID custom worker-id for API diff --git a/src/backend/cpu/CpuConfig.cpp b/src/backend/cpu/CpuConfig.cpp index 709b90dc..4c7a630f 100644 --- a/src/backend/cpu/CpuConfig.cpp +++ b/src/backend/cpu/CpuConfig.cpp @@ -52,7 +52,7 @@ static const char *kArgon2Impl = "argon2-impl"; #ifdef XMRIG_ALGO_ASTROBWT static const char* kAstroBWTMaxSize = "astrobwt-max-size"; -static const char* kAstroBWTAVX2 = "astrobwt-avx2"; +static const char* kAstroBWTAVX2 = "astrobwt-avx2"; #endif @@ -94,8 +94,8 @@ rapidjson::Value xmrig::CpuConfig::toJSON(rapidjson::Document &doc) const # endif # ifdef XMRIG_ALGO_ASTROBWT - obj.AddMember(StringRef(kAstroBWTMaxSize), m_astrobwtMaxSize, allocator); - obj.AddMember(StringRef(kAstroBWTAVX2), m_astrobwtAVX2, allocator); + obj.AddMember(StringRef(kAstroBWTMaxSize), m_astrobwtMaxSize, allocator); + obj.AddMember(StringRef(kAstroBWTAVX2), m_astrobwtAVX2, allocator); # endif m_threads.toJSON(obj, doc); diff --git a/src/backend/cpu/CpuConfig.h b/src/backend/cpu/CpuConfig.h index 4f034258..30166215 100644 --- a/src/backend/cpu/CpuConfig.h +++ b/src/backend/cpu/CpuConfig.h @@ -73,12 +73,12 @@ private: AesMode m_aes = AES_AUTO; Assembly m_assembly; + bool m_astrobwtAVX2 = false; bool m_enabled = true; bool m_hugePages = true; bool m_shouldSave = false; bool m_yield = true; int m_astrobwtMaxSize = 550; - bool m_astrobwtAVX2 = false; int m_memoryPool = 0; int m_priority = -1; String m_argon2Impl; diff --git a/src/backend/cpu/CpuLaunchData.cpp b/src/backend/cpu/CpuLaunchData.cpp index 87b7c26b..b0090a21 100644 --- a/src/backend/cpu/CpuLaunchData.cpp +++ b/src/backend/cpu/CpuLaunchData.cpp @@ -35,11 +35,11 @@ xmrig::CpuLaunchData::CpuLaunchData(const Miner *miner, const Algorithm &algorithm, const CpuConfig &config, const CpuThread &thread) : algorithm(algorithm), assembly(config.assembly()), + astrobwtAVX2(config.astrobwtAVX2()), hugePages(config.isHugePages()), hwAES(config.isHwAES()), yield(config.isYield()), - astrobwtMaxSize(config.astrobwtMaxSize()), - astrobwtAVX2(config.astrobwtAVX2()), + astrobwtMaxSize(config.astrobwtMaxSize()), priority(config.priority()), affinity(thread.affinity()), miner(miner), diff --git a/src/backend/cpu/CpuLaunchData.h b/src/backend/cpu/CpuLaunchData.h index 17c0ee90..7728d1d3 100644 --- a/src/backend/cpu/CpuLaunchData.h +++ b/src/backend/cpu/CpuLaunchData.h @@ -58,11 +58,11 @@ public: const Algorithm algorithm; const Assembly assembly; + const bool astrobwtAVX2; const bool hugePages; const bool hwAES; const bool yield; const int astrobwtMaxSize; - const bool astrobwtAVX2; const int priority; const int64_t affinity; const Miner *miner; diff --git a/src/backend/cpu/CpuWorker.cpp b/src/backend/cpu/CpuWorker.cpp index c78a8bda..96897838 100644 --- a/src/backend/cpu/CpuWorker.cpp +++ b/src/backend/cpu/CpuWorker.cpp @@ -77,11 +77,11 @@ xmrig::CpuWorker::CpuWorker(size_t id, const CpuLaunchData &data) : Worker(id, data.affinity, data.priority), m_algorithm(data.algorithm), m_assembly(data.assembly), + m_astrobwtAVX2(data.astrobwtAVX2), m_hwAES(data.hwAES), m_yield(data.yield), m_av(data.av()), m_astrobwtMaxSize(data.astrobwtMaxSize * 1000), - m_astrobwtAVX2(data.astrobwtAVX2), m_miner(data.miner), m_ctx() { diff --git a/src/backend/cpu/CpuWorker.h b/src/backend/cpu/CpuWorker.h index a68da174..8d539126 100644 --- a/src/backend/cpu/CpuWorker.h +++ b/src/backend/cpu/CpuWorker.h @@ -70,11 +70,11 @@ private: const Algorithm m_algorithm; const Assembly m_assembly; + const bool m_astrobwtAVX2; const bool m_hwAES; const bool m_yield; const CnHash::AlgoVariant m_av; const int m_astrobwtMaxSize; - const bool m_astrobwtAVX2; const Miner *m_miner; cryptonight_ctx *m_ctx[N]; uint8_t m_hash[N * 32]{ 0 }; diff --git a/src/base/kernel/interfaces/IConfig.h b/src/base/kernel/interfaces/IConfig.h index 806dcd4d..bb834232 100644 --- a/src/base/kernel/interfaces/IConfig.h +++ b/src/base/kernel/interfaces/IConfig.h @@ -98,6 +98,7 @@ public: MemoryPoolKey = 1027, YieldKey = 1030, AstroBWTMaxSizeKey = 1034, + AstroBWTAVX2Key = 1036, // xmrig amd OclPlatformKey = 1400, diff --git a/src/core/config/ConfigTransform.cpp b/src/core/config/ConfigTransform.cpp index ebbd7dbd..eccbd235 100644 --- a/src/core/config/ConfigTransform.cpp +++ b/src/core/config/ConfigTransform.cpp @@ -159,6 +159,9 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const # ifdef XMRIG_ALGO_ASTROBWT case IConfig::AstroBWTMaxSizeKey: /* --astrobwt-max-size */ return set(doc, kCpu, "astrobwt-max-size", static_cast(strtol(arg, nullptr, 10))); + + case IConfig::AstroBWTAVX2Key: /* --astrobwt-avx2 */ + return set(doc, kCpu, "astrobwt-avx2", true); # endif # ifdef XMRIG_ALGO_RANDOMX diff --git a/src/core/config/Config_platform.h b/src/core/config/Config_platform.h index 6dc139a0..bc748df2 100644 --- a/src/core/config/Config_platform.h +++ b/src/core/config/Config_platform.h @@ -110,6 +110,7 @@ static const option options[] = { # endif #ifdef XMRIG_ALGO_ASTROBWT { "astrobwt-max-size", 1, nullptr, IConfig::AstroBWTMaxSizeKey }, + { "astrobwt-avx2", 0, nullptr, IConfig::AstroBWTAVX2Key }, #endif # ifdef XMRIG_FEATURE_OPENCL { "opencl", 0, nullptr, IConfig::OclKey }, diff --git a/src/core/config/usage.h b/src/core/config/usage.h index 0bc9db8c..9f88754a 100644 --- a/src/core/config/usage.h +++ b/src/core/config/usage.h @@ -96,6 +96,7 @@ static inline const std::string &usage() # ifdef XMRIG_ALGO_ASTROBWT u += " --astrobwt-max-size=N skip hashes with large stage 2 size, default: 550, min: 400, max: 1200\n"; + u += " --astrobwt-avx2 enable AVX2 optimizations for AstroBWT algorithm"; # endif # ifdef XMRIG_FEATURE_HTTP