Merge xmrig v6.6.0 into master
This commit is contained in:
commit
54e736aaaa
29 changed files with 794 additions and 454 deletions
|
@ -56,7 +56,8 @@
|
|||
|
||||
|
||||
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||
# include "backend/common/Benchmark.h"
|
||||
# include "backend/common/benchmark/Benchmark.h"
|
||||
# include "backend/common/benchmark/BenchState.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -347,7 +348,7 @@ void xmrig::CpuBackend::setJob(const Job &job)
|
|||
const auto &cpu = d_ptr->controller->config()->cpu();
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
uint32_t benchSize = job.benchSize();
|
||||
const uint32_t benchSize = BenchState::size();
|
||||
# else
|
||||
constexpr uint32_t benchSize = 0;
|
||||
# endif
|
||||
|
@ -370,7 +371,7 @@ void xmrig::CpuBackend::setJob(const Job &job)
|
|||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (benchSize) {
|
||||
d_ptr->benchmark = std::make_shared<Benchmark>(job, threads.size(), this);
|
||||
d_ptr->benchmark = std::make_shared<Benchmark>(threads.size(), this);
|
||||
}
|
||||
# endif
|
||||
|
||||
|
|
|
@ -116,16 +116,17 @@ size_t xmrig::CpuConfig::memPoolSize() const
|
|||
std::vector<xmrig::CpuLaunchData> xmrig::CpuConfig::get(const Miner *miner, const Algorithm &algorithm, uint32_t benchSize) const
|
||||
{
|
||||
std::vector<CpuLaunchData> out;
|
||||
const CpuThreads &threads = m_threads.get(algorithm);
|
||||
const auto &threads = m_threads.get(algorithm);
|
||||
|
||||
if (threads.isEmpty()) {
|
||||
return out;
|
||||
}
|
||||
|
||||
out.reserve(threads.count());
|
||||
const size_t count = threads.count();
|
||||
out.reserve(count);
|
||||
|
||||
for (const CpuThread &thread : threads.data()) {
|
||||
out.emplace_back(miner, algorithm, *this, thread, benchSize);
|
||||
for (const auto &thread : threads.data()) {
|
||||
out.emplace_back(miner, algorithm, *this, thread, benchSize, count);
|
||||
}
|
||||
|
||||
return out;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <algorithm>
|
||||
|
||||
|
||||
xmrig::CpuLaunchData::CpuLaunchData(const Miner *miner, const Algorithm &algorithm, const CpuConfig &config, const CpuThread &thread, uint32_t benchSize) :
|
||||
xmrig::CpuLaunchData::CpuLaunchData(const Miner *miner, const Algorithm &algorithm, const CpuConfig &config, const CpuThread &thread, uint32_t benchSize, size_t threads) :
|
||||
algorithm(algorithm),
|
||||
assembly(config.assembly()),
|
||||
astrobwtAVX2(config.astrobwtAVX2()),
|
||||
|
@ -43,6 +43,7 @@ xmrig::CpuLaunchData::CpuLaunchData(const Miner *miner, const Algorithm &algorit
|
|||
priority(config.priority()),
|
||||
affinity(thread.affinity()),
|
||||
miner(miner),
|
||||
threads(threads),
|
||||
benchSize(benchSize),
|
||||
intensity(std::min<uint32_t>(thread.intensity(), algorithm.maxIntensity()))
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ class Miner;
|
|||
class CpuLaunchData
|
||||
{
|
||||
public:
|
||||
CpuLaunchData(const Miner *miner, const Algorithm &algorithm, const CpuConfig &config, const CpuThread &thread, uint32_t benchSize);
|
||||
CpuLaunchData(const Miner *miner, const Algorithm &algorithm, const CpuConfig &config, const CpuThread &thread, uint32_t benchSize, size_t threads);
|
||||
|
||||
bool isEqual(const CpuLaunchData &other) const;
|
||||
CnHash::AlgoVariant av() const;
|
||||
|
@ -66,6 +66,7 @@ public:
|
|||
const int priority;
|
||||
const int64_t affinity;
|
||||
const Miner *miner;
|
||||
const size_t threads;
|
||||
const uint32_t benchSize;
|
||||
const uint32_t intensity;
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "backend/cpu/CpuWorker.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "core/config/Config.h"
|
||||
#include "core/Miner.h"
|
||||
#include "crypto/cn/CnCtx.h"
|
||||
#include "crypto/cn/CryptoNight_test.h"
|
||||
|
@ -52,6 +53,11 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_BENCHMARK
|
||||
# include "backend/common/benchmark/BenchState.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
static constexpr uint32_t kReserveCount = 32768;
|
||||
|
@ -85,6 +91,7 @@ xmrig::CpuWorker<N>::CpuWorker(size_t id, const CpuLaunchData &data) :
|
|||
m_av(data.av()),
|
||||
m_astrobwtMaxSize(data.astrobwtMaxSize * 1000),
|
||||
m_miner(data.miner),
|
||||
m_threads(data.threads),
|
||||
m_benchSize(data.benchSize),
|
||||
m_ctx()
|
||||
{
|
||||
|
@ -242,6 +249,19 @@ void xmrig::CpuWorker<N>::start()
|
|||
current_job_nonces[i] = *m_job.nonce(i);
|
||||
}
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (m_benchSize) {
|
||||
if (current_job_nonces[0] >= m_benchSize) {
|
||||
return BenchState::done(m_benchData, m_benchDiff, Chrono::steadyMSecs());;
|
||||
}
|
||||
|
||||
// Make each hash dependent on the previous one in single thread benchmark to prevent cheating with multiple threads
|
||||
if (m_threads == 1) {
|
||||
*(uint64_t*)(m_job.blob()) ^= m_benchData;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
bool valid = true;
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
|
@ -285,10 +305,7 @@ void xmrig::CpuWorker<N>::start()
|
|||
if (m_benchSize) {
|
||||
if (current_job_nonces[i] < m_benchSize) {
|
||||
m_benchData ^= value;
|
||||
}
|
||||
else {
|
||||
m_benchDoneTime = Chrono::steadyMSecs();
|
||||
return;
|
||||
m_benchDiff = std::max(m_benchDiff, Job::toDiff(value));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -392,6 +409,10 @@ void xmrig::CpuWorker<N>::consumeJob()
|
|||
|
||||
m_job.add(m_miner->job(), m_benchSize ? 1 : kReserveCount, Nonce::CPU);
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
m_benchData = 0;
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (m_job.currentJob().algorithm().family() == Algorithm::RANDOM_X) {
|
||||
allocateRandomX_VM();
|
||||
|
|
|
@ -82,6 +82,7 @@ private:
|
|||
const CnHash::AlgoVariant m_av;
|
||||
const int m_astrobwtMaxSize;
|
||||
const Miner *m_miner;
|
||||
const size_t m_threads;
|
||||
const uint32_t m_benchSize;
|
||||
cryptonight_ctx *m_ctx[N];
|
||||
VirtualMemory *m_memory = nullptr;
|
||||
|
@ -90,6 +91,11 @@ private:
|
|||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
randomx_vm *m_vm = nullptr;
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
uint64_t m_benchData = 0;
|
||||
uint64_t m_benchDiff = 0;
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue