mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 10:01:06 +00:00
Use better source for AES settings in RandomX threads.
This commit is contained in:
parent
1a2f9fb160
commit
cf61f49746
3 changed files with 11 additions and 6 deletions
|
@ -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)) {
|
||||
|
@ -148,10 +154,9 @@ 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;
|
||||
|
||||
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;
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "workers/CpuThread.h"
|
||||
#include "workers/MultiWorker.h"
|
||||
#include "workers/Workers.h"
|
||||
#include "common/cpu/Cpu.h"
|
||||
|
||||
|
||||
template<size_t N>
|
||||
|
@ -61,8 +60,9 @@ void MultiWorker<N>::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<randomx_flags>(flags), nullptr, Workers::getDataset());
|
||||
if (!m_rx_vm) {
|
||||
|
|
Loading…
Reference in a new issue