Correct flex algo hashrate calc

This commit is contained in:
MoneroOcean 2024-05-30 23:32:13 +03:00
parent 20184c6c9f
commit d4252f7133
8 changed files with 20 additions and 15 deletions

View file

@ -177,8 +177,8 @@ template<>
size_t inline generate<Algorithm::GHOSTRIDER>(Threads<CpuThreads>& threads, uint32_t limit)
{
size_t count = 0;
count += generate(Algorithm::kGHOSTRIDER, threads, Algorithm::GHOSTRIDER_RTM, limit);
count += generate(Algorithm::kFLEX, threads, Algorithm::FLEX_KCN, limit);
count += threads.move(Algorithm::kGHOSTRIDER, std::move(Cpu::info()->threads(Algorithm::GHOSTRIDER_RTM, limit)));
count += threads.move(Algorithm::kFLEX, std::move(Cpu::info()->threads(Algorithm::FLEX_KCN, limit)));
return count;
}
#endif

View file

@ -175,7 +175,7 @@ bool xmrig::CpuWorker<N>::selfTest()
case Algorithm::GHOSTRIDER_RTM:
return (N == 8) && verify(Algorithm::GHOSTRIDER_RTM, test_output_gr);
case Algorithm::FLEX_KCN:
return verify(Algorithm::FLEX_KCN, test_output_flex);
return (N == 1) && verify(Algorithm::FLEX_KCN, test_output_flex);
default:;
}
}
@ -340,13 +340,16 @@ void xmrig::CpuWorker<N>::start()
case Algorithm::GHOSTRIDER_RTM:
if (N == 8) {
ghostrider::hash_octa(m_job.blob(), job.size(), m_hash, m_ctx, m_ghHelper);
}
else {
} else {
valid = false;
}
break;
case Algorithm::FLEX_KCN:
flex_hash(reinterpret_cast<const char*>(m_job.blob()), reinterpret_cast<char*>(m_hash), m_ctx);
if (N == 1) {
flex_hash(reinterpret_cast<const char*>(m_job.blob()), reinterpret_cast<char*>(m_hash), m_ctx);
} else {
valid = false;
}
break;
default:
valid = false;

View file

@ -55,7 +55,7 @@ public:
size_t threads() const override
{
# ifdef XMRIG_ALGO_GHOSTRIDER
return ((m_algorithm.family() == Algorithm::GHOSTRIDER) && m_ghHelper) ? 2 : 1;
return ((m_algorithm.id() == Algorithm::GHOSTRIDER_RTM) && m_ghHelper) ? 2 : 1;
# else
return 1;
# endif

View file

@ -386,8 +386,9 @@ xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint3
# endif
# ifdef XMRIG_ALGO_GHOSTRIDER
if (f == Algorithm::GHOSTRIDER) {
return CpuThreads(std::max<size_t>(count / 2, 1), 8);
switch (algorithm.id()) {
case Algorithm::GHOSTRIDER_RTM: return CpuThreads(std::max<size_t>(count / 2, 1), 8);
case Algorithm::FLEX_KCN: return CpuThreads(std::max<size_t>(count / 2, 1), 1);
}
# endif

View file

@ -102,8 +102,9 @@ const char *xmrig::BasicCpuInfo::backend() const
xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint32_t) const
{
# ifdef XMRIG_ALGO_GHOSTRIDER
if (algorithm.family() == Algorithm::GHOSTRIDER) {
return CpuThreads(threads(), 8);
switch (algorithm.id()) {
case Algorithm::GHOSTRIDER_RTM: return CpuThreads(threads(), 8);
case Algorithm::FLEX_KCN: return CpuThreads(threads(), 1);
}
# endif

View file

@ -260,7 +260,7 @@ xmrig::CpuThreads xmrig::HwlocCpuInfo::allThreads(const Algorithm &algorithm, ui
CpuThreads threads;
threads.reserve(m_threads);
const uint32_t intensity = (algorithm.family() == Algorithm::GHOSTRIDER) ? 8 : 0;
const uint32_t intensity = (algorithm.id() == Algorithm::GHOSTRIDER_RTM) ? 8 : 0;
for (const int32_t pu : m_units) {
threads.add(pu, intensity);

View file

@ -198,7 +198,7 @@ public:
inline Id id() const { return m_id; }
inline size_t l2() const { return l2(m_id); }
inline uint32_t family() const { return family(m_id); }
inline uint32_t minIntensity() const { return ((family(m_id) == GHOSTRIDER) ? 8 : 1); };
inline uint32_t minIntensity() const { return ((m_id == GHOSTRIDER_RTM) ? 8 : 1); };
inline uint32_t maxIntensity() const { return isCN() ? 5 : ((family(m_id) == GHOSTRIDER) ? 8 : 1); };
inline size_t l3() const { return l3(m_id); }

View file

@ -321,7 +321,7 @@ public:
avg_hashrate_buf[0] = '\0';
# ifdef XMRIG_ALGO_GHOSTRIDER
if (algorithm.family() == Algorithm::GHOSTRIDER) {
if (algorithm.id() == Algorithm::GHOSTRIDER_RTM) {
snprintf(avg_hashrate_buf, sizeof(avg_hashrate_buf), " avg " CYAN_BOLD("%s %s"), Hashrate::format(avg_hashrate * scale, num + 16 * 4, 16), h);
}
# endif
@ -581,7 +581,7 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
# endif
# ifdef XMRIG_ALGO_GHOSTRIDER
if (job.algorithm().family() == Algorithm::GHOSTRIDER) {
if (job.algorithm().id() == Algorithm::GHOSTRIDER_RTM) {
d_ptr->initGhostRider();
}
# endif