1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-25 05:40:39 -05:00

Compare commits

..

18 Commits

Author SHA1 Message Date
Artem Zuikov
b30f0122a7 Merge 3bc2f27b97 into e32731b60b 2024-10-21 00:58:38 +03:00
4ertus2
3bc2f27b97 cache CnHash functions in CpuWorker 2024-10-21 00:56:22 +03:00
XMRig
e32731b60b Update deps 2024-10-20 09:49:06 +07:00
xmrig
e1ae367084 Merge pull request #3540 from SChernykh/dev
Detect AMD engineering samples in randomx_boost.sh
2024-08-29 19:50:43 +07:00
SChernykh
bc1c8358c4 Detect AMD engineering samples in randomx_boost.sh 2024-08-29 14:47:30 +02:00
xmrig
e0af8f0c6b Merge pull request #3539 from SChernykh/dev
Added Zen5 to randomx_boost.sh
2024-08-28 18:51:39 +07:00
SChernykh
29f9c8cf4c Added Zen5 to randomx_boost.sh 2024-08-28 13:49:27 +02:00
xmrig
26f4936f6f Merge pull request #3535 from SChernykh/dev
RandomX: tweaks for Zen5
2024-08-20 06:47:30 +07:00
SChernykh
a411ee3565 RandomX: tweaks for Zen5 2024-08-19 21:01:49 +02:00
xmrig
01bd0d48a1 Merge pull request #3534 from SChernykh/dev
Fixed threads auto-config on Zen5
2024-08-17 06:23:49 +07:00
SChernykh
20d555668b Fixed threads auto-config on Zen5 2024-08-16 23:36:22 +02:00
xmrig
56baec762f Merge pull request #3531 from SChernykh/dev
Always reset nonce on RandomX dataset change
2024-08-14 22:16:34 +07:00
SChernykh
17a52fb418 Always reset nonce on RandomX dataset change
Also never get a new job when mining is paused
2024-08-14 16:41:03 +02:00
XMRig
7e4caa8929 Merge remote-tracking branch 'remotes/origin/master' into dev 2024-08-12 03:02:19 +07:00
xmrig
ef14d55aa5 Merge pull request #3529 from eltociear/patch-1
docs: update ghostrider/README.md
2024-08-12 03:01:13 +07:00
XMRig
5776fdcc20 v6.22.1-dev 2024-08-12 02:15:08 +07:00
XMRig
fe0f69031b Merge branch 'master' into dev 2024-08-12 02:14:40 +07:00
Ikko Eltociear Ashimine
e682f89298 docs: update ghostrider/README.md
nubmer -> number
2024-08-12 03:54:26 +09:00
14 changed files with 75 additions and 34 deletions

View File

@@ -1,8 +1,8 @@
#!/bin/sh -e
HWLOC_VERSION_MAJOR="2"
HWLOC_VERSION_MINOR="10"
HWLOC_VERSION_PATCH="0"
HWLOC_VERSION_MINOR="11"
HWLOC_VERSION_PATCH="2"
HWLOC_VERSION="${HWLOC_VERSION_MAJOR}.${HWLOC_VERSION_MINOR}.${HWLOC_VERSION_PATCH}"

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
OPENSSL_VERSION="3.0.14"
OPENSSL_VERSION="3.0.15"
mkdir -p deps
mkdir -p deps/include

View File

@@ -1,6 +1,6 @@
#!/bin/sh -e
UV_VERSION="1.48.0"
UV_VERSION="1.49.2"
mkdir -p deps
mkdir -p deps/include

View File

@@ -8,7 +8,7 @@ else
modprobe msr allow_writes=on
fi
if grep -E 'AMD Ryzen|AMD EPYC' /proc/cpuinfo > /dev/null;
if grep -E 'AMD Ryzen|AMD EPYC|AuthenticAMD' /proc/cpuinfo > /dev/null;
then
if grep "cpu family[[:space:]]\{1,\}:[[:space:]]25" /proc/cpuinfo > /dev/null;
then
@@ -28,6 +28,14 @@ if grep -E 'AMD Ryzen|AMD EPYC' /proc/cpuinfo > /dev/null;
wrmsr -a 0xc001102b 0x2000cc10
echo "MSR register values for Zen3 applied"
fi
elif grep "cpu family[[:space:]]\{1,\}:[[:space:]]26" /proc/cpuinfo > /dev/null;
then
echo "Detected Zen5 CPU"
wrmsr -a 0xc0011020 0x4400000000000
wrmsr -a 0xc0011021 0x4000000000040
wrmsr -a 0xc0011022 0x8680000401570000
wrmsr -a 0xc001102b 0x2040cc10
echo "MSR register values for Zen5 applied"
else
echo "Detected Zen1/Zen2 CPU"
wrmsr -a 0xc0011020 0

View File

@@ -67,7 +67,8 @@ VirtualMemory* cn_heavyZen3Memory = nullptr;
template<size_t N>
xmrig::CpuWorker<N>::CpuWorker(size_t id, const CpuLaunchData &data) :
Worker(id, data.affinity, data.priority),
m_algorithm(data.algorithm),
m_algorithm_family(data.algorithm.family()),
m_algorithm_l3(data.algorithm.l3()),
m_assembly(data.assembly),
m_hwAES(data.hwAES),
m_yield(data.yield),
@@ -82,24 +83,29 @@ xmrig::CpuWorker<N>::CpuWorker(size_t id, const CpuLaunchData &data) :
const uint32_t model = Cpu::info()->model();
const bool is_vermeer = (arch == ICpuInfo::ARCH_ZEN3) && (model == 0x21);
const bool is_raphael = (arch == ICpuInfo::ARCH_ZEN4) && (model == 0x61);
if ((N == 1) && (m_av == CnHash::AV_SINGLE) && (m_algorithm.family() == Algorithm::CN_HEAVY) && (m_assembly != Assembly::NONE) && (is_vermeer || is_raphael)) {
if ((N == 1) && (m_av == CnHash::AV_SINGLE) && (m_algorithm_family == Algorithm::CN_HEAVY) && (m_assembly != Assembly::NONE) && (is_vermeer || is_raphael)) {
std::lock_guard<std::mutex> lock(cn_heavyZen3MemoryMutex);
if (!cn_heavyZen3Memory) {
// Round up number of threads to the multiple of 8
const size_t num_threads = ((m_threads + 7) / 8) * 8;
cn_heavyZen3Memory = new VirtualMemory(m_algorithm.l3() * num_threads, data.hugePages, false, false, node());
cn_heavyZen3Memory = new VirtualMemory(m_algorithm_l3 * num_threads, data.hugePages, false, false, node());
}
m_memory = cn_heavyZen3Memory;
}
else
# endif
{
m_memory = new VirtualMemory(m_algorithm.l3() * N, data.hugePages, false, true, node());
m_memory = new VirtualMemory(m_algorithm_l3 * N, data.hugePages, false, true, node());
}
# ifdef XMRIG_ALGO_GHOSTRIDER
m_ghHelper = ghostrider::create_helper_thread(affinity(), data.priority, data.affinities);
# endif
std::vector<Algorithm> family = Algorithm::all([this](const Algorithm &algo) -> bool { return m_algorithm_family == algo.family(); });
for (auto& algorithm : family) {
m_hash_fns.emplace(algorithm.id(), CnHash::fn(algorithm, m_av, m_assembly));
}
}
@@ -124,6 +130,23 @@ xmrig::CpuWorker<N>::~CpuWorker()
# endif
}
template<size_t N>
xmrig::cn_hash_fun xmrig::CpuWorker<N>::fn(const Algorithm &algorithm) const {
#if 1
if (!algorithm.isValid()) {
return nullptr;
}
const auto it = m_hash_fns.find(algorithm.id());
if (it != m_hash_fns.end()) {
return it->second;
}
return nullptr;
#else
return CnHash::fn(algorithm, m_av, m_assembly);
#endif
}
#ifdef XMRIG_ALGO_RANDOMX
template<size_t N>
@@ -159,7 +182,7 @@ template<size_t N>
bool xmrig::CpuWorker<N>::selfTest()
{
# ifdef XMRIG_ALGO_RANDOMX
if (m_algorithm.family() == Algorithm::RANDOM_X) {
if (m_algorithm_family == Algorithm::RANDOM_X) {
return N == 1;
}
# endif
@@ -167,12 +190,12 @@ bool xmrig::CpuWorker<N>::selfTest()
allocateCnCtx();
# ifdef XMRIG_ALGO_GHOSTRIDER
if (m_algorithm.family() == Algorithm::GHOSTRIDER) {
if (m_algorithm_family == Algorithm::GHOSTRIDER) {
return (N == 8) && verify(Algorithm::GHOSTRIDER_RTM, test_output_gr);
}
# endif
if (m_algorithm.family() == Algorithm::CN) {
if (m_algorithm_family == Algorithm::CN) {
const bool rc = verify(Algorithm::CN_0, test_output_v0) &&
verify(Algorithm::CN_1, test_output_v1) &&
verify(Algorithm::CN_2, test_output_v2) &&
@@ -190,14 +213,14 @@ bool xmrig::CpuWorker<N>::selfTest()
}
# ifdef XMRIG_ALGO_CN_LITE
if (m_algorithm.family() == Algorithm::CN_LITE) {
if (m_algorithm_family == Algorithm::CN_LITE) {
return verify(Algorithm::CN_LITE_0, test_output_v0_lite) &&
verify(Algorithm::CN_LITE_1, test_output_v1_lite);
}
# endif
# ifdef XMRIG_ALGO_CN_HEAVY
if (m_algorithm.family() == Algorithm::CN_HEAVY) {
if (m_algorithm_family == Algorithm::CN_HEAVY) {
return verify(Algorithm::CN_HEAVY_0, test_output_v0_heavy) &&
verify(Algorithm::CN_HEAVY_XHV, test_output_xhv_heavy) &&
verify(Algorithm::CN_HEAVY_TUBE, test_output_tube_heavy);
@@ -205,20 +228,20 @@ bool xmrig::CpuWorker<N>::selfTest()
# endif
# ifdef XMRIG_ALGO_CN_PICO
if (m_algorithm.family() == Algorithm::CN_PICO) {
if (m_algorithm_family == Algorithm::CN_PICO) {
return verify(Algorithm::CN_PICO_0, test_output_pico_trtl) &&
verify(Algorithm::CN_PICO_TLO, test_output_pico_tlo);
}
# endif
# ifdef XMRIG_ALGO_CN_FEMTO
if (m_algorithm.family() == Algorithm::CN_FEMTO) {
if (m_algorithm_family == Algorithm::CN_FEMTO) {
return verify(Algorithm::CN_UPX2, test_output_femto_upx2);
}
# endif
# ifdef XMRIG_ALGO_ARGON2
if (m_algorithm.family() == Algorithm::ARGON2) {
if (m_algorithm_family == Algorithm::ARGON2) {
return verify(Algorithm::AR2_CHUKWA, argon2_chukwa_test_out) &&
verify(Algorithm::AR2_CHUKWA_V2, argon2_chukwa_v2_test_out) &&
verify(Algorithm::AR2_WRKZ, argon2_wrkz_test_out);
@@ -262,7 +285,7 @@ void xmrig::CpuWorker<N>::start()
while (!Nonce::isOutdated(Nonce::CPU, m_job.sequence())) {
const Job &job = m_job.currentJob();
if (job.algorithm().l3() != m_algorithm.l3()) {
if (job.algorithm().l3() != m_algorithm_l3) {
break;
}
@@ -359,7 +382,9 @@ void xmrig::CpuWorker<N>::start()
}
}
consumeJob();
if (!Nonce::isPaused()) {
consumeJob();
}
}
}
@@ -487,11 +512,11 @@ void xmrig::CpuWorker<N>::allocateCnCtx()
# ifdef XMRIG_ALGO_CN_HEAVY
// cn-heavy optimization for Zen3 CPUs
if (m_memory == cn_heavyZen3Memory) {
shift = (id() / 8) * m_algorithm.l3() * 8 + (id() % 8) * 64;
shift = (id() / 8) * m_algorithm_l3 * 8 + (id() % 8) * 64;
}
# endif
CnCtx::create(m_ctx, m_memory->scratchpad() + shift, m_algorithm.l3(), N);
CnCtx::create(m_ctx, m_memory->scratchpad() + shift, m_algorithm_l3, N);
}
}

View File

@@ -26,6 +26,8 @@
#include "base/tools/Object.h"
#include "net/JobResult.h"
#include <unordered_map>
#ifdef XMRIG_ALGO_RANDOMX
class randomx_vm;
@@ -55,7 +57,7 @@ public:
size_t threads() const override
{
# ifdef XMRIG_ALGO_GHOSTRIDER
return ((m_algorithm.family() == Algorithm::GHOSTRIDER) && m_ghHelper) ? 2 : 1;
return ((m_algorithm_family == Algorithm::GHOSTRIDER) && m_ghHelper) ? 2 : 1;
# else
return 1;
# endif
@@ -71,7 +73,7 @@ protected:
inline void jobEarlyNotification(const Job&) override {}
private:
inline cn_hash_fun fn(const Algorithm &algorithm) const { return CnHash::fn(algorithm, m_av, m_assembly); }
cn_hash_fun fn(const Algorithm &algorithm) const;
# ifdef XMRIG_ALGO_RANDOMX
void allocateRandomX_VM();
@@ -84,8 +86,10 @@ private:
void consumeJob();
alignas(8) uint8_t m_hash[N * 32]{ 0 };
const Algorithm m_algorithm;
const uint32_t m_algorithm_family;
const size_t m_algorithm_l3;
const Assembly m_assembly;
std::unordered_map<Algorithm::Id, cn_hash_fun> m_hash_fns;
const bool m_hwAES;
const bool m_yield;
const CnHash::AlgoVariant m_av;

View File

@@ -326,7 +326,8 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
}
}
if (scratchpad == 2 * oneMiB) {
// This code is supposed to run only on Intel CPUs
if ((vendor() == VENDOR_INTEL) && (scratchpad == 2 * oneMiB)) {
if (L2 && (cores.size() * oneMiB) == L2 && L2_associativity == 16 && L3 >= L2) {
L3 = L2;
extra = L2;

View File

@@ -158,7 +158,7 @@ void xmrig::CudaWorker::start()
std::this_thread::yield();
}
if (!consumeJob()) {
if (isReady() && !consumeJob()) {
return;
}
}

View File

@@ -190,7 +190,7 @@ void xmrig::OclWorker::start()
std::this_thread::yield();
}
if (!consumeJob()) {
if (isReady() && !consumeJob()) {
return;
}
}

View File

@@ -576,6 +576,11 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
# ifdef XMRIG_ALGO_RANDOMX
const bool ready = d_ptr->initRX();
// Always reset nonce on RandomX dataset change
if (!ready) {
d_ptr->reset = true;
}
# else
constexpr const bool ready = true;
# endif

View File

@@ -16,7 +16,7 @@ xmrig -a gr -o rtm.suprnova.cc:4273 --tls -u WALLET_ADDRESS -p x
You can use **rtm_ghostrider_example.cmd** as a template and put pool URL and your wallet address there. The general XMRig documentation is available [here](https://xmrig.com/docs/miner).
**Using `--threads` or `-t` option is NOT recommended because it turns off advanced built-in config.** If you want to tweak the nubmer of threads used for GhostRider, it's recommended to start using config.json instead of command line. The best suitable command line option for this is `--cpu-max-threads-hint=N` where N can be between 0 and 100.
**Using `--threads` or `-t` option is NOT recommended because it turns off advanced built-in config.** If you want to tweak the number of threads used for GhostRider, it's recommended to start using config.json instead of command line. The best suitable command line option for this is `--cpu-max-threads-hint=N` where N can be between 0 and 100.
## Performance

View File

@@ -267,8 +267,8 @@ namespace randomx {
initDatasetAVX2 = false;
break;
case xmrig::ICpuInfo::ARCH_ZEN5:
// TODO: test it
initDatasetAVX2 = false;
// AVX2 init is 49% faster on Zen5
initDatasetAVX2 = true;
break;
}
}

View File

@@ -60,8 +60,6 @@ static const std::array<MsrItems, kMsrArraySize> msrPresets = {
MsrItems{{ 0xC0011020, 0ULL }, { 0xC0011021, 0x40ULL, ~0x20ULL }, { 0xC0011022, 0x1510000ULL }, { 0xC001102b, 0x2000cc16ULL }},
MsrItems{{ 0xC0011020, 0x0004480000000000ULL }, { 0xC0011021, 0x001c000200000040ULL, ~0x20ULL }, { 0xC0011022, 0xc000000401570000ULL }, { 0xC001102b, 0x2000cc10ULL }},
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 }},

View File

@@ -22,7 +22,7 @@
#define APP_ID "xmrig"
#define APP_NAME "XMRig"
#define APP_DESC "XMRig miner"
#define APP_VERSION "6.22.0"
#define APP_VERSION "6.22.1-dev"
#define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2024 xmrig.com"
@@ -30,7 +30,7 @@
#define APP_VER_MAJOR 6
#define APP_VER_MINOR 22
#define APP_VER_PATCH 0
#define APP_VER_PATCH 1
#ifdef _MSC_VER
# if (_MSC_VER >= 1930)