Merge branch 'dev'

This commit is contained in:
XMRig 2020-11-14 01:11:54 +07:00
commit c18a0152dd
No known key found for this signature in database
GPG key ID: 446A53638BE94409
21 changed files with 197 additions and 43 deletions

View file

@ -1,3 +1,12 @@
# v6.5.2
- [#1935](https://github.com/xmrig/xmrig/pull/1935) Separate MSR mod for Zen/Zen2 and Zen3.
- [#1937](https://github.com/xmrig/xmrig/issues/1937) Print path to existing WinRing0 service without verbose option.
- [#1939](https://github.com/xmrig/xmrig/pull/1939) Fixed build with gcc 4.8.
- [#1941](https://github.com/xmrig/xmrig/pull/1941) Added CPUID info to JSON report.
- [#1941](https://github.com/xmrig/xmrig/pull/1942) Fixed alignment modification in memory pool.
- [#1944](https://github.com/xmrig/xmrig/pull/1944) Updated `randomx_boost.sh` with new MSR mod.
- Added `250K` and `500K` offline benchmarks.
# v6.5.1
- [#1932](https://github.com/xmrig/xmrig/pull/1932) New MSR mod for Ryzen, up to +3.5% on Zen2 and +1-2% on Zen3.
- [#1918](https://github.com/xmrig/xmrig/issues/1918) Fixed 1GB huge pages support on ARMv8.

View file

@ -4,12 +4,22 @@ modprobe msr
if cat /proc/cpuinfo | grep "AMD Ryzen" > /dev/null;
then
echo "Detected Ryzen"
wrmsr -a 0xc0011022 0x510000
wrmsr -a 0xc001102b 0x1808cc16
wrmsr -a 0xc0011020 0
wrmsr -a 0xc0011021 0x40
echo "MSR register values for Ryzen applied"
if cat /proc/cpuinfo | grep "cpu family[[:space:]]:[[:space:]]25" > /dev/null;
then
echo "Detected Ryzen (Zen3)"
wrmsr -a 0xc0011020 0x4480000000000
wrmsr -a 0xc0011021 0x1c000200000040
wrmsr -a 0xc0011022 0xc000000401500000
wrmsr -a 0xc001102b 0x2000cc14
echo "MSR register values for Ryzen (Zen3) applied"
else
echo "Detected Ryzen (Zen1/Zen2)"
wrmsr -a 0xc0011020 0
wrmsr -a 0xc0011021 0x40
wrmsr -a 0xc0011022 0x1510000
wrmsr -a 0xc001102b 0x2000cc16
echo "MSR register values for Ryzen (Zen1/Zen2) applied"
fi
elif cat /proc/cpuinfo | grep "Intel" > /dev/null;
then
echo "Detected Intel"

View file

@ -37,9 +37,35 @@
namespace xmrig {
static uint64_t hashCheck[2][10] = {
{ 0x898B6E0431C28A6BULL, 0xEE9468F8B40926BCULL, 0xC2BC5D11724813C0ULL, 0x3A2C7B285B87F941ULL, 0x3B5BD2C3A16B450EULL, 0x5CD0602F20C5C7C4ULL, 0x101DE939474B6812ULL, 0x52B765A1B156C6ECULL, 0x323935102AB6B45CULL, 0xB5231262E2792B26ULL },
{ 0x0F3E5400B39EA96AULL, 0x85944CCFA2752D1FULL, 0x64AFFCAE991811BAULL, 0x3E4D0B836D3B13BAULL, 0xEB7417D621271166ULL, 0x97FFE10C0949FFA5ULL, 0x84CAC0F8879A4BA1ULL, 0xA1B79F031DA2459FULL, 0x9B65226DA873E65DULL, 0x0F9E00C5A511C200ULL },
static const std::map<int, std::map<uint32_t, uint64_t> > hashCheck = {
{ Algorithm::RX_0, {
{ 250000U, 0x7D6054757BB08A63ULL },
{ 500000U, 0x96607546DE1F5ECCULL },
{ 1000000U, 0x898B6E0431C28A6BULL },
{ 2000000U, 0xEE9468F8B40926BCULL },
{ 3000000U, 0xC2BC5D11724813C0ULL },
{ 4000000U, 0x3A2C7B285B87F941ULL },
{ 5000000U, 0x3B5BD2C3A16B450EULL },
{ 6000000U, 0x5CD0602F20C5C7C4ULL },
{ 7000000U, 0x101DE939474B6812ULL },
{ 8000000U, 0x52B765A1B156C6ECULL },
{ 9000000U, 0x323935102AB6B45CULL },
{ 10000000U, 0xB5231262E2792B26ULL }
}},
{ Algorithm::RX_WOW, {
{ 250000U, 0xC7F712C9603E2603ULL },
{ 500000U, 0x21A0E5AAE6DA7D8DULL },
{ 1000000U, 0x0F3E5400B39EA96AULL },
{ 2000000U, 0x85944CCFA2752D1FULL },
{ 3000000U, 0x64AFFCAE991811BAULL },
{ 4000000U, 0x3E4D0B836D3B13BAULL },
{ 5000000U, 0xEB7417D621271166ULL },
{ 6000000U, 0x97FFE10C0949FFA5ULL },
{ 7000000U, 0x84CAC0F8879A4BA1ULL },
{ 8000000U, 0xA1B79F031DA2459FULL },
{ 9000000U, 0x9B65226DA873E65DULL },
{ 10000000U, 0x0F9E00C5A511C200ULL }
}}
};
@ -87,7 +113,7 @@ bool xmrig::Benchmark::finish(uint64_t totalHashCount)
doc.AddMember("steady_done_ts", m_doneTime, allocator);
doc.AddMember(StringRef(BenchConfig::kHash), Value(fmt::format("{:016X}", m_data).c_str(), allocator), allocator);
doc.AddMember("backend", m_backend->toJSON(doc), allocator); // FIXME
doc.AddMember("backend", m_backend->toJSON(doc), allocator);
send(doc);
}
@ -185,12 +211,13 @@ uint64_t xmrig::Benchmark::referenceHash() const
}
# endif
const uint32_t N = (m_end / 1000000) - 1;
if (((m_algo == Algorithm::RX_0) || (m_algo == Algorithm::RX_WOW)) && ((m_end % 1000000) == 0) && (N < 10)) {
return hashCheck[(m_algo == Algorithm::RX_0) ? 0 : 1][N];
}
uint64_t hash = 0;
return 0;
try {
hash = hashCheck.at(m_algo).at(m_end);
} catch (const std::exception &ex) {}
return hash;
}

View file

@ -48,7 +48,8 @@ public:
enum MsrMod : uint32_t {
MSR_MOD_NONE,
MSR_MOD_RYZEN,
MSR_MOD_RYZEN_17H,
MSR_MOD_RYZEN_19H,
MSR_MOD_INTEL,
MSR_MOD_CUSTOM,
MSR_MOD_MAX

View file

@ -189,15 +189,32 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
memcpy(vendor + 4, &data[3], 4);
memcpy(vendor + 8, &data[2], 4);
cpuid(PROCESSOR_INFO, data);
m_procInfo = data[EAX_Reg];
m_family = get_masked(m_procInfo, 12, 8) + get_masked(m_procInfo, 28, 20);
m_model = (get_masked(m_procInfo, 20, 16) << 4) | get_masked(m_procInfo, 8, 4);
m_stepping = get_masked(m_procInfo, 4, 0);
if (memcmp(vendor, "AuthenticAMD", 12) == 0) {
m_vendor = VENDOR_AMD;
cpuid(PROCESSOR_INFO, data);
const int32_t family = get_masked(data[EAX_Reg], 12, 8) + get_masked(data[EAX_Reg], 28, 20);
if (family >= 23) {
if (m_family >= 0x17) {
m_assembly = Assembly::RYZEN;
m_msrMod = MSR_MOD_RYZEN;
switch (m_family) {
case 0x17:
m_msrMod = MSR_MOD_RYZEN_17H;
break;
case 0x19:
m_msrMod = MSR_MOD_RYZEN_19H;
break;
default:
m_msrMod = MSR_MOD_NONE;
break;
}
}
else {
m_assembly = Assembly::BULLDOZER;
@ -220,7 +237,6 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
unsigned int reserved2 : 4;
} processor_info;
cpuid(1, data);
memcpy(&processor_info, data, sizeof(processor_info));
// Intel JCC erratum mitigation
@ -314,6 +330,10 @@ rapidjson::Value xmrig::BasicCpuInfo::toJSON(rapidjson::Document &doc) const
Value out(kObjectType);
out.AddMember("brand", StringRef(brand()), allocator);
out.AddMember("family", m_family, allocator);
out.AddMember("model", m_model, allocator);
out.AddMember("stepping", m_stepping, allocator);
out.AddMember("proc_info", m_procInfo, allocator);
out.AddMember("aes", hasAES(), allocator);
out.AddMember("avx2", hasAVX2(), allocator);
out.AddMember("x64", isX64(), allocator);

View file

@ -70,6 +70,10 @@ protected:
bool m_jccErratum = false;
private:
uint32_t m_procInfo = 0;
uint32_t m_family = 0;
uint32_t m_model = 0;
uint32_t m_stepping = 0;
Assembly m_assembly = Assembly::NONE;
MsrMod m_msrMod = MSR_MOD_NONE;
std::bitset<FLAG_MAX> m_flags;

View file

@ -83,6 +83,7 @@ public:
BenchVerifyKey = 1045,
BenchSeedKey = 1046,
BenchHashKey = 1047,
BenchTokenKey = 1048,
// xmrig common
CPUPriorityKey = 1021,

View file

@ -70,6 +70,16 @@ bool xmrig::Pools::isEqual(const Pools &other) const
}
int xmrig::Pools::donateLevel() const
{
# ifdef XMRIG_FEATURE_BENCHMARK
return benchSize() || (m_benchmark && !m_benchmark->id().isEmpty()) ? 0 : m_donateLevel;
# else
return m_donateLevel;
# endif
}
xmrig::IStrategy *xmrig::Pools::createStrategy(IStrategyListener *listener) const
{
if (active() == 1) {
@ -184,6 +194,27 @@ void xmrig::Pools::print() const
}
void xmrig::Pools::toJSON(rapidjson::Value &out, rapidjson::Document &doc) const
{
using namespace rapidjson;
auto &allocator = doc.GetAllocator();
# ifdef XMRIG_FEATURE_BENCHMARK
if (m_benchmark) {
out.AddMember(StringRef(BenchConfig::kBenchmark), m_benchmark->toJSON(doc), allocator);
return;
}
# endif
doc.AddMember(StringRef(kDonateLevel), m_donateLevel, allocator);
doc.AddMember(StringRef(kDonateOverProxy), m_proxyDonate, allocator);
out.AddMember(StringRef(kPools), toJSON(doc), allocator);
doc.AddMember(StringRef(kRetries), retries(), allocator);
doc.AddMember(StringRef(kRetryPause), retryPause(), allocator);
}
void xmrig::Pools::setDonateLevel(int level)
{
if (level >= kMinimumDonateLevel && level <= 99) {

View file

@ -58,7 +58,6 @@ public:
Pools();
inline const std::vector<Pool> &data() const { return m_data; }
inline int donateLevel() const { return benchSize() ? 0 : m_donateLevel; }
inline int retries() const { return m_retries; }
inline int retryPause() const { return m_retryPause; }
inline ProxyDonate proxyDonate() const { return m_proxyDonate; }
@ -67,12 +66,14 @@ public:
inline bool operator==(const Pools &other) const { return isEqual(other); }
bool isEqual(const Pools &other) const;
int donateLevel() const;
IStrategy *createStrategy(IStrategyListener *listener) const;
rapidjson::Value toJSON(rapidjson::Document &doc) const;
size_t active() const;
uint32_t benchSize() const;
void load(const IJsonReader &reader);
void print() const;
void toJSON(rapidjson::Value &out, rapidjson::Document &doc) const;
private:
void setDonateLevel(int level);

View file

@ -54,6 +54,7 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
if (!m_benchmark->id().isEmpty()) {
m_job.setId(m_benchmark->id());
m_job.setBenchToken(m_benchmark->token());
m_mode = ONLINE_VERIFY;
return;

View file

@ -57,6 +57,7 @@ xmrig::BenchConfig::BenchConfig(uint32_t size, const String &id, const rapidjson
m_submit(Json::getBool(object, kSubmit)),
m_id(id),
m_seed(Json::getString(object, kSeed)),
m_token(Json::getString(object, kToken)),
m_size(size),
m_hash(0)
{
@ -88,16 +89,53 @@ xmrig::BenchConfig *xmrig::BenchConfig::create(const rapidjson::Value &object)
}
rapidjson::Value xmrig::BenchConfig::toJSON(rapidjson::Document &doc) const
{
using namespace rapidjson;
Value out(kObjectType);
auto &allocator = doc.GetAllocator();
if (m_size == 0) {
out.AddMember(StringRef(kSize), 0U, allocator);
}
else if (m_size < 1000000) {
out.AddMember(StringRef(kSize), Value(fmt::format("{}K", m_size / 1000).c_str(), allocator), allocator);
}
else {
out.AddMember(StringRef(kSize), Value(fmt::format("{}M", m_size / 1000000).c_str(), allocator), allocator);
}
out.AddMember(StringRef(kAlgo), m_algorithm.toJSON(), allocator);
out.AddMember(StringRef(kSubmit), m_submit, allocator);
out.AddMember(StringRef(kVerify), m_id.toJSON(), allocator);
out.AddMember(StringRef(kToken), m_token.toJSON(), allocator);
out.AddMember(StringRef(kSeed), m_seed.toJSON(), allocator);
if (m_hash) {
out.AddMember(StringRef(kHash), Value(fmt::format("{:016X}", m_hash).c_str(), allocator), allocator);
}
else {
out.AddMember(StringRef(kHash), kNullType, allocator);
}
return out;
}
uint32_t xmrig::BenchConfig::getSize(const char *benchmark)
{
if (!benchmark) {
return false;
return 0;
}
const auto size = strtoul(benchmark, nullptr, 10);
if (size < 1 || size > 10) {
return false;
if (size >= 1 && size <= 10) {
return strcasecmp(benchmark, fmt::format("{}M", size).c_str()) == 0 ? size * 1000000 : 0;
}
return strcasecmp(benchmark, fmt::format("{}M", size).c_str()) == 0 ? size * 1000000 : 0;
if (size == 250 || size == 500) {
return strcasecmp(benchmark, fmt::format("{}K", size).c_str()) == 0 ? size * 1000 : 0;
}
return 0;
}

View file

@ -57,9 +57,12 @@ public:
inline const Algorithm &algorithm() const { return m_algorithm; }
inline const String &id() const { return m_id; }
inline const String &seed() const { return m_seed; }
inline const String &token() const { return m_token; }
inline uint32_t size() const { return m_size; }
inline uint64_t hash() const { return m_hash; }
rapidjson::Value toJSON(rapidjson::Document &doc) const;
private:
static uint32_t getSize(const char *benchmark);
@ -67,6 +70,7 @@ private:
bool m_submit;
String m_id;
String m_seed;
String m_token;
uint32_t m_size;
uint64_t m_hash;
};

View file

@ -228,16 +228,14 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
doc.AddMember(StringRef(kCuda), cuda().toJSON(doc), allocator);
# endif
doc.AddMember(StringRef(Pools::kDonateLevel), m_pools.donateLevel(), allocator);
doc.AddMember(StringRef(Pools::kDonateOverProxy), m_pools.proxyDonate(), allocator);
doc.AddMember(StringRef(kLogFile), m_logFile.toJSON(), allocator);
doc.AddMember(StringRef(Pools::kPools), m_pools.toJSON(doc), allocator);
m_pools.toJSON(doc, doc);
doc.AddMember(StringRef(kPrintTime), printTime(), allocator);
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
doc.AddMember(StringRef(kHealthPrintTime), healthPrintTime(), allocator);
# endif
doc.AddMember(StringRef(Pools::kRetries), m_pools.retries(), allocator);
doc.AddMember(StringRef(Pools::kRetryPause), m_pools.retryPause(), allocator);
doc.AddMember(StringRef(kSyslog), isSyslog(), allocator);
# ifdef XMRIG_FEATURE_TLS

View file

@ -257,6 +257,7 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
case IConfig::StressKey: /* --stress */
case IConfig::BenchSubmitKey: /* --submit */
case IConfig::BenchVerifyKey: /* --verify */
case IConfig::BenchTokenKey: /* --token */
case IConfig::BenchSeedKey: /* --seed */
case IConfig::BenchHashKey: /* --hash */
return transformBenchmark(doc, key, arg);
@ -333,6 +334,9 @@ void xmrig::ConfigTransform::transformBenchmark(rapidjson::Document &doc, int ke
case IConfig::BenchVerifyKey: /* --verify */
return set(doc, BenchConfig::kBenchmark, BenchConfig::kVerify, arg);
case IConfig::BenchTokenKey: /* --token */
return set(doc, BenchConfig::kBenchmark, BenchConfig::kToken, arg);
case IConfig::BenchSeedKey: /* --seed */
return set(doc, BenchConfig::kBenchmark, BenchConfig::kSeed, arg);

View file

@ -103,6 +103,7 @@ static const option options[] = {
# ifdef XMRIG_FEATURE_HTTP
{ "submit", 0, nullptr, IConfig::BenchSubmitKey },
{ "verify", 1, nullptr, IConfig::BenchVerifyKey },
{ "token", 1, nullptr, IConfig::BenchTokenKey },
# endif
{ "seed", 1, nullptr, IConfig::BenchSeedKey },
{ "hash", 1, nullptr, IConfig::BenchHashKey },

View file

@ -71,7 +71,7 @@ uint8_t *xmrig::MemoryPool::get(size_t size, uint32_t)
{
assert(!(size % pageSize));
if (!m_memory || (m_memory->size() - m_offset) < size) {
if (!m_memory || (m_memory->size() - m_offset - m_alignOffset) < size) {
return nullptr;
}

View file

@ -41,6 +41,7 @@ namespace randomx {
class CompiledVm : public VmBase<softAes>
{
public:
inline CompiledVm() {}
void* operator new(size_t, void* ptr) { return ptr; }
void operator delete(void*) {}

View file

@ -64,16 +64,17 @@ static const std::array<const char *, RxConfig::ModeMax> modeNames = { "auto", "
#ifdef XMRIG_FEATURE_MSR
constexpr size_t kMsrArraySize = 4;
constexpr size_t kMsrArraySize = 5;
static const std::array<MsrItems, kMsrArraySize> msrPresets = {
MsrItems(),
MsrItems{{ 0xC0011020, 0ULL }, { 0xC0011021, 0x40ULL, ~0x20ULL }, { 0xC0011022, 0x1510000ULL }, { 0xC001102b, 0x2000cc16ULL }},
MsrItems{{ 0xC0011020, 0x0004480000000000ULL }, { 0xC0011021, 0x001c000200000040ULL, ~0x20ULL }, { 0xC0011022, 0xc000000401500000ULL }, { 0xC001102b, 0x2000cc14ULL }},
MsrItems{{ 0x1a4, 0xf }},
MsrItems()
};
static const std::array<const char *, kMsrArraySize> modNames = { "none", "ryzen", "intel", "custom" };
static const std::array<const char *, kMsrArraySize> modNames = { "none", "ryzen_17h", "ryzen_19h", "intel", "custom" };
static_assert (kMsrArraySize == ICpuInfo::MSR_MOD_MAX, "kMsrArraySize and MSR_MOD_MAX mismatch");
#endif

View file

@ -135,7 +135,7 @@ static HANDLE wrmsr_install_driver()
SERVICE_STATUS status;
const auto rc = QueryServiceStatus(hService, &status);
if (rc && Log::isVerbose()) {
if (rc) {
DWORD dwBytesNeeded;
QueryServiceConfigA(hService, nullptr, 0, &dwBytesNeeded);

View file

@ -260,14 +260,16 @@ void xmrig::Network::onRequest(IApiRequest &request)
void xmrig::Network::setJob(IClient *client, const Job &job, bool donate)
{
uint64_t diff = job.diff();;
const char *scale = NetworkState::scaleDiff(diff);
uint64_t diff = job.diff();;
const char *scale = NetworkState::scaleDiff(diff);
# ifdef XMRIG_FEATURE_BENCHMARK
if (job.benchSize()) {
LOG_NOTICE("%s " MAGENTA_BOLD("start benchmark ") "hashes " CYAN_BOLD("%" PRIu64 "M") " algo " WHITE_BOLD("%s") " print_time " CYAN_BOLD("%us"),
const uint32_t size = job.benchSize();
if (size) {
LOG_NOTICE("%s " MAGENTA_BOLD("start benchmark ") "hashes " CYAN_BOLD("%u%s") " algo " WHITE_BOLD("%s") " print_time " CYAN_BOLD("%us"),
Tags::bench(),
job.benchSize() / 1000000,
size < 1000000 ? size / 1000 : size / 1000000,
size < 1000000 ? "K" : "M",
job.algorithm().shortName(),
m_controller->config()->printTime());

View file

@ -28,7 +28,7 @@
#define APP_ID "xmrig"
#define APP_NAME "XMRig"
#define APP_DESC "XMRig miner"
#define APP_VERSION "6.5.1"
#define APP_VERSION "6.5.2-dev"
#define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2020 xmrig.com"
@ -36,7 +36,7 @@
#define APP_VER_MAJOR 6
#define APP_VER_MINOR 5
#define APP_VER_PATCH 1
#define APP_VER_PATCH 2
#ifdef _MSC_VER
# if (_MSC_VER >= 1920)