diff --git a/src/core/config/Config.cpp b/src/core/config/Config.cpp index 52a1e5504..450f587e5 100644 --- a/src/core/config/Config.cpp +++ b/src/core/config/Config.cpp @@ -56,6 +56,12 @@ xmrig::Config::Config() : } +bool xmrig::Config::isHwAES() const +{ + return (m_aesMode == AES_AUTO ? (Cpu::info()->hasAES() ? AES_HW : AES_SOFT) : m_aesMode) == AES_HW; +} + + bool xmrig::Config::read(const IJsonReader &reader, const char *fileName) { if (!BaseConfig::read(reader, fileName)) { @@ -147,11 +153,10 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const bool xmrig::Config::finalize() { if (!m_threads.cpu.empty()) { - m_threads.mode = Advanced; - const bool softAES = (m_aesMode == AES_AUTO ? (Cpu::info()->hasAES() ? AES_HW : AES_SOFT) : m_aesMode) == AES_SOFT; + m_threads.mode = Advanced; for (size_t i = 0; i < m_threads.cpu.size(); ++i) { - m_threads.list.push_back(CpuThread::createFromData(i, m_algorithm.algo(), m_threads.cpu[i], m_priority, softAES)); + m_threads.list.push_back(CpuThread::createFromData(i, m_algorithm.algo(), m_threads.cpu[i], m_priority, !isHwAES())); } return true; diff --git a/src/core/config/Config.h b/src/core/config/Config.h index 4bcb8bba3..1d8a42d91 100644 --- a/src/core/config/Config.h +++ b/src/core/config/Config.h @@ -67,10 +67,10 @@ public: Config(); + bool isHwAES() const; bool read(const IJsonReader &reader, const char *fileName) override; void getJSON(rapidjson::Document &doc) const override; - inline AesMode aesMode() const { return m_aesMode; } inline AlgoVariant algoVariant() const { return m_algoVariant; } inline Assembly assembly() const { return m_assembly; } inline bool isHugePages() const { return m_hugePages; } diff --git a/src/workers/MultiWorker.cpp b/src/workers/MultiWorker.cpp index e15b51b7a..b5f465e4c 100644 --- a/src/workers/MultiWorker.cpp +++ b/src/workers/MultiWorker.cpp @@ -31,7 +31,6 @@ #include "workers/CpuThread.h" #include "workers/MultiWorker.h" #include "workers/Workers.h" -#include "common/cpu/Cpu.h" template @@ -61,8 +60,9 @@ void MultiWorker::allocateRandomX_VM() { if (!m_rx_vm) { int flags = RANDOMX_FLAG_LARGE_PAGES | RANDOMX_FLAG_FULL_MEM | RANDOMX_FLAG_JIT; - if (xmrig::Cpu::info()->hasAES()) + if (!m_thread->isSoftAES()) { flags |= RANDOMX_FLAG_HARD_AES; + } m_rx_vm = randomx_create_vm(static_cast(flags), nullptr, Workers::getDataset()); if (!m_rx_vm) {