Merge xmrig v6.3.4 sources

This commit is contained in:
MoneroOcean 2020-09-23 00:25:27 +00:00
commit 21b156cbda
51 changed files with 1182 additions and 514 deletions

View file

@ -32,6 +32,8 @@
#include "base/io/log/Log.h"
#include "crypto/rx/RxConfig.h"
#include "crypto/rx/RxQueue.h"
#include "crypto/randomx/randomx.h"
#include "crypto/randomx/soft_aes.h"
namespace xmrig {
@ -99,6 +101,8 @@ bool xmrig::Rx::init(const T &seed, const RxConfig &config, const CpuConfig &cpu
return true;
}
randomx_set_scratchpad_prefetch_mode(config.scratchpadPrefetchMode());
if (isReady(seed)) {
return true;
}
@ -110,6 +114,9 @@ bool xmrig::Rx::init(const T &seed, const RxConfig &config, const CpuConfig &cpu
if (!osInitialized) {
setupMainLoopExceptionFrame();
if (!cpu.isHwAES()) {
SelectSoftAESImpl();
}
osInitialized = true;
}

View file

@ -57,6 +57,8 @@ static const char *kCacheQoS = "cache_qos";
static const char *kNUMA = "numa";
#endif
static const char *kScratchpadPrefetchMode = "scratchpad_prefetch_mode";
static const std::array<const char *, RxConfig::ModeMax> modeNames = { "auto", "fast", "light" };
@ -118,6 +120,11 @@ bool xmrig::RxConfig::read(const rapidjson::Value &value)
}
# endif
const uint32_t mode = static_cast<uint32_t>(Json::getInt(value, kScratchpadPrefetchMode, static_cast<int>(m_scratchpadPrefetchMode)));
if (mode < ScratchpadPrefetchMax) {
m_scratchpadPrefetchMode = static_cast<ScratchpadPrefetchMode>(mode);
}
return true;
}
@ -171,6 +178,8 @@ rapidjson::Value xmrig::RxConfig::toJSON(rapidjson::Document &doc) const
}
# endif
obj.AddMember(StringRef(kScratchpadPrefetchMode), static_cast<int>(m_scratchpadPrefetchMode), allocator);
return obj;
}

View file

@ -50,6 +50,14 @@ public:
ModeMax
};
enum ScratchpadPrefetchMode : uint32_t {
ScratchpadPrefetchOff,
ScratchpadPrefetchT0,
ScratchpadPrefetchNTA,
ScratchpadPrefetchMov,
ScratchpadPrefetchMax,
};
bool read(const rapidjson::Value &value);
rapidjson::Value toJSON(rapidjson::Document &doc) const;
@ -68,6 +76,8 @@ public:
inline bool cacheQoS() const { return m_cacheQoS; }
inline Mode mode() const { return m_mode; }
inline ScratchpadPrefetchMode scratchpadPrefetchMode() const { return m_scratchpadPrefetchMode; }
# ifdef XMRIG_FEATURE_MSR
const char *msrPresetName() const;
const MsrItems &msrPreset() const;
@ -94,6 +104,8 @@ private:
int m_threads = -1;
Mode m_mode = AutoMode;
ScratchpadPrefetchMode m_scratchpadPrefetchMode = ScratchpadPrefetchT0;
# ifdef XMRIG_FEATURE_HWLOC
std::vector<uint32_t> m_nodeset;
# endif

View file

@ -31,6 +31,11 @@
#include "crypto/rx/RxVm.h"
#if defined(_M_X64) || defined(__x86_64__)
extern "C" uint32_t rx_blake2b_use_sse41;
#endif
randomx_vm* xmrig::RxVm::create(RxDataset *dataset, uint8_t *scratchpad, bool softAes, xmrig::Assembly assembly, uint32_t node)
{
int flags = 0;
@ -55,6 +60,10 @@ randomx_vm* xmrig::RxVm::create(RxDataset *dataset, uint8_t *scratchpad, bool so
flags |= RANDOMX_FLAG_AMD;
}
# if defined(_M_X64) || defined(__x86_64__)
rx_blake2b_use_sse41 = Cpu::info()->has(ICpuInfo::FLAG_SSE41) ? 1 : 0;
# endif
return randomx_create_vm(static_cast<randomx_flags>(flags), dataset->cache() ? dataset->cache()->get() : nullptr, dataset->get(), scratchpad, node);
}