RandomX: added parameter for scratchpad prefetch mode
`scratchpad_prefetch_mode` can have 4 values: 0: off 1: use `prefetcht0` instruction (default, same as previous XMRig versions) 2: use `prefetchnta` instruction (faster on Coffee Lake and a few other CPUs) 3: use `mov` instruction
This commit is contained in:
parent
a5b6383f7b
commit
a84b45b1bb
7 changed files with 71 additions and 2 deletions
|
@ -32,6 +32,7 @@
|
|||
#include "base/io/log/Log.h"
|
||||
#include "crypto/rx/RxConfig.h"
|
||||
#include "crypto/rx/RxQueue.h"
|
||||
#include "crypto/randomx/randomx.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
@ -99,6 +100,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;
|
||||
}
|
||||
|
|
|
@ -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 int mode = Json::getInt(value, kScratchpadPrefetchMode, static_cast<int>(m_scratchpadPrefetchMode));
|
||||
if ((mode >= ScratchpadPrefetchOff) && (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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue