From 70c7f33a20329a49cb926001fdf248f2dcd1c99f Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 20 Jul 2020 09:17:59 +0700 Subject: [PATCH] Added command line options --cache-qos (--randomx-cache-qos) and --argon2-impl (--cpu-argon2-impl). --- src/base/kernel/interfaces/IConfig.h | 2 ++ src/core/config/ConfigTransform.cpp | 10 ++++++++-- src/core/config/ConfigTransform.h | 4 ++-- src/core/config/Config_platform.h | 5 +++++ src/core/config/usage.h | 7 ++++++- src/crypto/argon2/Impl.cpp | 4 ++-- 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/base/kernel/interfaces/IConfig.h b/src/base/kernel/interfaces/IConfig.h index 0924f1e2..d6ae47b3 100644 --- a/src/base/kernel/interfaces/IConfig.h +++ b/src/base/kernel/interfaces/IConfig.h @@ -101,6 +101,8 @@ public: YieldKey = 1030, AstroBWTMaxSizeKey = 1034, AstroBWTAVX2Key = 1036, + Argon2ImplKey = 1039, + RandomXCacheQoSKey = 1040, // xmrig amd OclPlatformKey = 1400, diff --git a/src/core/config/ConfigTransform.cpp b/src/core/config/ConfigTransform.cpp index eccbd235..80e8d07d 100644 --- a/src/core/config/ConfigTransform.cpp +++ b/src/core/config/ConfigTransform.cpp @@ -5,8 +5,8 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright 2018-2020 SChernykh + * Copyright 2016-2020 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -151,6 +151,9 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const case IConfig::YieldKey: /* --cpu-no-yield */ return set(doc, kCpu, "yield", false); + case IConfig::Argon2ImplKey: /* --argon2-impl */ + return set(doc, kCpu, "argon2-impl", arg); + # ifdef XMRIG_FEATURE_ASM case IConfig::AssemblyKey: /* --asm */ return set(doc, kCpu, "asm", arg); @@ -186,6 +189,9 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const case IConfig::RandomXRdmsrKey: /* --randomx-no-rdmsr */ return set(doc, kRandomX, "rdmsr", false); + + case IConfig::RandomXCacheQoSKey: /* --cache-qos */ + return set(doc, kRandomX, "cache_qos", true); # endif # ifdef XMRIG_FEATURE_OPENCL diff --git a/src/core/config/ConfigTransform.h b/src/core/config/ConfigTransform.h index 66c497ab..1c01433f 100644 --- a/src/core/config/ConfigTransform.h +++ b/src/core/config/ConfigTransform.h @@ -5,8 +5,8 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright 2018-2020 SChernykh + * Copyright 2016-2020 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/core/config/Config_platform.h b/src/core/config/Config_platform.h index 6125fdd9..e585dce3 100644 --- a/src/core/config/Config_platform.h +++ b/src/core/config/Config_platform.h @@ -87,6 +87,9 @@ static const option options[] = { { "cpu-max-threads-hint", 1, nullptr, IConfig::CPUMaxThreadsKey }, { "cpu-memory-pool", 1, nullptr, IConfig::MemoryPoolKey }, { "cpu-no-yield", 0, nullptr, IConfig::YieldKey }, + { "no-yield", 0, nullptr, IConfig::YieldKey }, + { "cpu-argon2-impl", 1, nullptr, IConfig::Argon2ImplKey }, + { "argon2-impl", 1, nullptr, IConfig::Argon2ImplKey }, { "verbose", 0, nullptr, IConfig::VerboseKey }, { "proxy", 1, nullptr, IConfig::ProxyKey }, { "data-dir", 1, nullptr, IConfig::DataDirKey }, @@ -116,6 +119,8 @@ static const option options[] = { { "wrmsr", 2, nullptr, IConfig::RandomXWrmsrKey }, { "randomx-no-rdmsr", 0, nullptr, IConfig::RandomXRdmsrKey }, { "no-rdmsr", 0, nullptr, IConfig::RandomXRdmsrKey }, + { "randomx-cache-qos", 0, nullptr, IConfig::RandomXCacheQoSKey }, + { "cache-qos", 0, nullptr, IConfig::RandomXCacheQoSKey }, # endif #ifdef XMRIG_ALGO_ASTROBWT { "astrobwt-max-size", 1, nullptr, IConfig::AstroBWTMaxSizeKey }, diff --git a/src/core/config/usage.h b/src/core/config/usage.h index e265559b..aec22c9f 100644 --- a/src/core/config/usage.h +++ b/src/core/config/usage.h @@ -69,7 +69,7 @@ static inline const std::string &usage() u += " -r, --retries=N number of times to retry before switch to backup server (default: 5)\n"; u += " -R, --retry-pause=N time to pause between retries (default: 5)\n"; u += " --user-agent set custom user-agent string for pool\n"; - u += " --donate-level=N donate level, default 5%% (5 minutes in 100 minutes)\n"; + u += " --donate-level=N donate level, default 1%% (1 minute in 100 minutes)\n"; u += " --donate-over-proxy=N control donate over xmrig-proxy feature\n"; u += "\nCPU backend:\n"; @@ -85,6 +85,10 @@ static inline const std::string &usage() u += " --no-huge-pages disable huge pages support\n"; u += " --asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer\n"; +# if defined(__x86_64__) || defined(_M_AMD64) + u += " --argon2-impl=IMPL argon2 implementation: x86_64, SSE2, SSSE3, XOP, AVX2, AVX-512F\n"; +# endif + # ifdef XMRIG_ALGO_RANDOMX u += " --randomx-init=N threads count to initialize RandomX dataset\n"; u += " --randomx-no-numa disable NUMA support for RandomX\n"; @@ -92,6 +96,7 @@ static inline const std::string &usage() u += " --randomx-1gb-pages use 1GB hugepages for dataset (Linux only)\n"; u += " --randomx-wrmsr=N write custom value (0-15) to Intel MSR register 0x1a4 or disable MSR mod (-1)\n"; u += " --randomx-no-rdmsr disable reverting initial MSR values on exit\n"; + u += " --randomx-cache-qos enable Cache QoS\n"; # endif # ifdef XMRIG_ALGO_ASTROBWT diff --git a/src/crypto/argon2/Impl.cpp b/src/crypto/argon2/Impl.cpp index f032cb27..42bd5587 100644 --- a/src/crypto/argon2/Impl.cpp +++ b/src/crypto/argon2/Impl.cpp @@ -72,8 +72,8 @@ bool xmrig::argon2::Impl::select(const String &nameHint, bool benchmark) } } - if (hint.isEmpty() || argon2_select_impl_by_name(hint) == 0) { - argon2_select_impl(); + if (!hint.isEmpty()) { + argon2_select_impl_by_name(hint); } # endif