diff --git a/src/backend/cpu/CpuConfig_gen.h b/src/backend/cpu/CpuConfig_gen.h index 8a1eb0b7..60f308c5 100644 --- a/src/backend/cpu/CpuConfig_gen.h +++ b/src/backend/cpu/CpuConfig_gen.h @@ -177,8 +177,8 @@ template<> size_t inline generate(Threads& 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 diff --git a/src/backend/cpu/CpuWorker.cpp b/src/backend/cpu/CpuWorker.cpp index 4a0d3825..1418b14a 100644 --- a/src/backend/cpu/CpuWorker.cpp +++ b/src/backend/cpu/CpuWorker.cpp @@ -175,7 +175,7 @@ bool xmrig::CpuWorker::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::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(m_job.blob()), reinterpret_cast(m_hash), m_ctx); + if (N == 1) { + flex_hash(reinterpret_cast(m_job.blob()), reinterpret_cast(m_hash), m_ctx); + } else { + valid = false; + } break; default: valid = false; diff --git a/src/backend/cpu/CpuWorker.h b/src/backend/cpu/CpuWorker.h index 18e4fed5..5bfa13d2 100644 --- a/src/backend/cpu/CpuWorker.h +++ b/src/backend/cpu/CpuWorker.h @@ -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 diff --git a/src/backend/cpu/platform/BasicCpuInfo.cpp b/src/backend/cpu/platform/BasicCpuInfo.cpp index d92c5f94..1a5d1122 100644 --- a/src/backend/cpu/platform/BasicCpuInfo.cpp +++ b/src/backend/cpu/platform/BasicCpuInfo.cpp @@ -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(count / 2, 1), 8); + switch (algorithm.id()) { + case Algorithm::GHOSTRIDER_RTM: return CpuThreads(std::max(count / 2, 1), 8); + case Algorithm::FLEX_KCN: return CpuThreads(std::max(count / 2, 1), 1); } # endif diff --git a/src/backend/cpu/platform/BasicCpuInfo_arm.cpp b/src/backend/cpu/platform/BasicCpuInfo_arm.cpp index b684c510..da4a21eb 100644 --- a/src/backend/cpu/platform/BasicCpuInfo_arm.cpp +++ b/src/backend/cpu/platform/BasicCpuInfo_arm.cpp @@ -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 diff --git a/src/backend/cpu/platform/HwlocCpuInfo.cpp b/src/backend/cpu/platform/HwlocCpuInfo.cpp index 55048f21..8652c6e4 100644 --- a/src/backend/cpu/platform/HwlocCpuInfo.cpp +++ b/src/backend/cpu/platform/HwlocCpuInfo.cpp @@ -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); diff --git a/src/base/crypto/Algorithm.h b/src/base/crypto/Algorithm.h index 0a5154b1..577735a0 100644 --- a/src/base/crypto/Algorithm.h +++ b/src/base/crypto/Algorithm.h @@ -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); } diff --git a/src/core/Miner.cpp b/src/core/Miner.cpp index 9cc9092b..fd243f0d 100644 --- a/src/core/Miner.cpp +++ b/src/core/Miner.cpp @@ -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