1
0
mirror of https://github.com/xmrig/xmrig.git synced 2026-07-03 15:22:43 -04:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Tony Butler 8f7abc5c91 Merge 14128cbdb4 into dd7e0e520d 2024-08-02 21:47:37 +02:00
7 changed files with 44 additions and 67 deletions
+7 -2
View File
@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2024 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -126,6 +126,11 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<CpuThreads> &threads, uint32
count += threads.move(Algorithm::kRX_WOW, std::move(wow)); count += threads.move(Algorithm::kRX_WOW, std::move(wow));
} }
if (!threads.isExist(Algorithm::RX_YADA)) {
auto yada = cpuInfo->threads(Algorithm::RX_YADA, limit);
count += threads.move(Algorithm::kRX_YADA, std::move(yada));
}
count += generate(Algorithm::kRX, threads, Algorithm::RX_0, limit); count += generate(Algorithm::kRX, threads, Algorithm::RX_0, limit);
return count; return count;
+2 -4
View File
@@ -56,8 +56,7 @@ public:
ARCH_ZEN_PLUS, ARCH_ZEN_PLUS,
ARCH_ZEN2, ARCH_ZEN2,
ARCH_ZEN3, ARCH_ZEN3,
ARCH_ZEN4, ARCH_ZEN4
ARCH_ZEN5
}; };
enum MsrMod : uint32_t { enum MsrMod : uint32_t {
@@ -65,13 +64,12 @@ public:
MSR_MOD_RYZEN_17H, MSR_MOD_RYZEN_17H,
MSR_MOD_RYZEN_19H, MSR_MOD_RYZEN_19H,
MSR_MOD_RYZEN_19H_ZEN4, MSR_MOD_RYZEN_19H_ZEN4,
MSR_MOD_RYZEN_1AH_ZEN5,
MSR_MOD_INTEL, MSR_MOD_INTEL,
MSR_MOD_CUSTOM, MSR_MOD_CUSTOM,
MSR_MOD_MAX MSR_MOD_MAX
}; };
# define MSR_NAMES_LIST "none", "ryzen_17h", "ryzen_19h", "ryzen_19h_zen4", "ryzen_1Ah_zen5", "intel", "custom" # define MSR_NAMES_LIST "none", "ryzen_17h", "ryzen_19h", "ryzen_19h_zen4", "intel", "custom"
enum Flag : uint32_t { enum Flag : uint32_t {
FLAG_AES, FLAG_AES,
+1 -6
View File
@@ -64,7 +64,7 @@ static_assert(kCpuFlagsSize == ICpuInfo::FLAG_MAX, "kCpuFlagsSize and FLAG_MAX m
#ifdef XMRIG_FEATURE_MSR #ifdef XMRIG_FEATURE_MSR
constexpr size_t kMsrArraySize = 7; constexpr size_t kMsrArraySize = 6;
static const std::array<const char *, kMsrArraySize> msrNames = { MSR_NAMES_LIST }; static const std::array<const char *, kMsrArraySize> msrNames = { MSR_NAMES_LIST };
static_assert(kMsrArraySize == ICpuInfo::MSR_MOD_MAX, "kMsrArraySize and MSR_MOD_MAX mismatch"); static_assert(kMsrArraySize == ICpuInfo::MSR_MOD_MAX, "kMsrArraySize and MSR_MOD_MAX mismatch");
#endif #endif
@@ -260,11 +260,6 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
} }
break; break;
case 0x1a:
m_arch = ARCH_ZEN5;
m_msrMod = MSR_MOD_RYZEN_1AH_ZEN5;
break;
default: default:
m_msrMod = MSR_MOD_NONE; m_msrMod = MSR_MOD_NONE;
break; break;
+28 -43
View File
@@ -7,8 +7,8 @@
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> * Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd> * Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2019 Howard Chu <https://github.com/hyc> * Copyright 2019 Howard Chu <https://github.com/hyc>
* Copyright 2018-2024 SChernykh <https://github.com/SChernykh> * Copyright 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2024 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -24,9 +24,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>
#include "base/net/stratum/Job.h" #include "base/net/stratum/Job.h"
#include "base/tools/Alignment.h" #include "base/tools/Alignment.h"
#include "base/tools/Buffer.h" #include "base/tools/Buffer.h"
@@ -110,36 +112,26 @@ bool xmrig::Job::setSeedHash(const char *hash)
bool xmrig::Job::setTarget(const char *target) bool xmrig::Job::setTarget(const char *target)
{ {
static auto parse = [](const char *target, const Algorithm &algorithm) -> uint64_t { if (!target) {
if (!target) {
return 0;
}
if (algorithm == Algorithm::RX_YADA) {
return strtoull(target, nullptr, 16);
}
const auto raw = Cvt::fromHex(target, strlen(target));
switch (raw.size()) {
case 4:
return 0xFFFFFFFFFFFFFFFFULL / (0xFFFFFFFFULL / uint64_t(*reinterpret_cast<const uint32_t *>(raw.data())));
case 8:
return *reinterpret_cast<const uint64_t *>(raw.data());
default:
break;
}
return 0;
};
if ((m_target = parse(target, algorithm())) == 0) {
return false; return false;
} }
m_diff = toDiff(m_target); const auto raw = Cvt::fromHex(target, strlen(target));
const size_t size = raw.size();
if (algorithm() == Algorithm::RX_YADA) {
m_target = strtoull(target, nullptr, 16);
}
else {
if (size == 4) {
m_target = 0xFFFFFFFFFFFFFFFFULL / (0xFFFFFFFFULL / uint64_t(*reinterpret_cast<const uint32_t *>(raw.data())));
}
else if (size == 8) {
m_target = *reinterpret_cast<const uint64_t *>(raw.data());
}
else {
return false;
}
}
# ifdef XMRIG_PROXY_PROJECT # ifdef XMRIG_PROXY_PROJECT
assert(sizeof(m_rawTarget) > (size * 2)); assert(sizeof(m_rawTarget) > (size * 2));
@@ -148,6 +140,7 @@ bool xmrig::Job::setTarget(const char *target)
memcpy(m_rawTarget, target, std::min(size * 2, sizeof(m_rawTarget))); memcpy(m_rawTarget, target, std::min(size * 2, sizeof(m_rawTarget)));
# endif # endif
m_diff = toDiff(m_target);
return true; return true;
} }
@@ -184,22 +177,14 @@ void xmrig::Job::setSigKey(const char *sig_key)
int32_t xmrig::Job::nonceOffset() const int32_t xmrig::Job::nonceOffset() const
{ {
switch (algorithm().family()) { auto f = algorithm().family();
case Algorithm::KAWPOW: if (f == Algorithm::KAWPOW) return 32;
return 32; if (f == Algorithm::GHOSTRIDER) return 76;
case Algorithm::GHOSTRIDER: auto id = algorithm().id();
return 76; if (id == Algorithm::RX_YADA) return 147;
default: return 39;
break;
}
if (algorithm() == Algorithm::RX_YADA) {
return 147;
}
return 39;
} }
uint32_t xmrig::Job::getNumTransactions() const uint32_t xmrig::Job::getNumTransactions() const
+5 -3
View File
@@ -7,8 +7,8 @@
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> * Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd> * Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2019 Howard Chu <https://github.com/hyc> * Copyright 2019 Howard Chu <https://github.com/hyc>
* Copyright 2018-2024 SChernykh <https://github.com/SChernykh> * Copyright 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2024 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -27,9 +27,11 @@
#ifndef XMRIG_JOB_H #ifndef XMRIG_JOB_H
#define XMRIG_JOB_H #define XMRIG_JOB_H
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include "base/crypto/Algorithm.h" #include "base/crypto/Algorithm.h"
#include "base/tools/Buffer.h" #include "base/tools/Buffer.h"
#include "base/tools/String.h" #include "base/tools/String.h"
@@ -109,7 +111,7 @@ public:
inline bool operator!=(const Job &other) const { return !isEqual(other); } inline bool operator!=(const Job &other) const { return !isEqual(other); }
inline bool operator==(const Job &other) const { return isEqual(other); } inline bool operator==(const Job &other) const { return isEqual(other); }
inline Job &operator=(const Job &other) { if (this != &other) { copy(other); } return *this; } inline Job &operator=(const Job &other) { copy(other); return *this; }
inline Job &operator=(Job &&other) noexcept { move(std::move(other)); return *this; } inline Job &operator=(Job &&other) noexcept { move(std::move(other)); return *this; }
# ifdef XMRIG_FEATURE_BENCHMARK # ifdef XMRIG_FEATURE_BENCHMARK
-4
View File
@@ -266,10 +266,6 @@ namespace randomx {
// AVX2 init is slower on Zen4 // AVX2 init is slower on Zen4
initDatasetAVX2 = false; initDatasetAVX2 = false;
break; break;
case xmrig::ICpuInfo::ARCH_ZEN5:
// TODO: test it
initDatasetAVX2 = false;
break;
} }
} }
} }
+1 -5
View File
@@ -53,17 +53,13 @@ static const std::array<const char *, RxConfig::ModeMax> modeNames = { "auto", "
#ifdef XMRIG_FEATURE_MSR #ifdef XMRIG_FEATURE_MSR
constexpr size_t kMsrArraySize = 7; constexpr size_t kMsrArraySize = 6;
static const std::array<MsrItems, kMsrArraySize> msrPresets = { static const std::array<MsrItems, kMsrArraySize> msrPresets = {
MsrItems(), MsrItems(),
MsrItems{{ 0xC0011020, 0ULL }, { 0xC0011021, 0x40ULL, ~0x20ULL }, { 0xC0011022, 0x1510000ULL }, { 0xC001102b, 0x2000cc16ULL }}, MsrItems{{ 0xC0011020, 0ULL }, { 0xC0011021, 0x40ULL, ~0x20ULL }, { 0xC0011022, 0x1510000ULL }, { 0xC001102b, 0x2000cc16ULL }},
MsrItems{{ 0xC0011020, 0x0004480000000000ULL }, { 0xC0011021, 0x001c000200000040ULL, ~0x20ULL }, { 0xC0011022, 0xc000000401570000ULL }, { 0xC001102b, 0x2000cc10ULL }}, MsrItems{{ 0xC0011020, 0x0004480000000000ULL }, { 0xC0011021, 0x001c000200000040ULL, ~0x20ULL }, { 0xC0011022, 0xc000000401570000ULL }, { 0xC001102b, 0x2000cc10ULL }},
MsrItems{{ 0xC0011020, 0x0004400000000000ULL }, { 0xC0011021, 0x0004000000000040ULL, ~0x20ULL }, { 0xC0011022, 0x8680000401570000ULL }, { 0xC001102b, 0x2040cc10ULL }}, MsrItems{{ 0xC0011020, 0x0004400000000000ULL }, { 0xC0011021, 0x0004000000000040ULL, ~0x20ULL }, { 0xC0011022, 0x8680000401570000ULL }, { 0xC001102b, 0x2040cc10ULL }},
// TODO: Tune it for Zen5 when it's available
MsrItems{{ 0xC0011020, 0x0004400000000000ULL }, { 0xC0011021, 0x0004000000000040ULL, ~0x20ULL }, { 0xC0011022, 0x8680000401570000ULL }, { 0xC001102b, 0x2040cc10ULL }},
MsrItems{{ 0x1a4, 0xf }}, MsrItems{{ 0x1a4, 0xf }},
MsrItems() MsrItems()
}; };