Added support for allocate RandomX dataset on each NUMA node.
This commit is contained in:
parent
e53ae0c15e
commit
828fc065b0
11 changed files with 178 additions and 70 deletions
|
@ -295,7 +295,7 @@ rapidjson::Value xmrig::CpuBackend::toJSON(rapidjson::Document &doc) const
|
|||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (d_ptr->algo.family() == Algorithm::RANDOM_X) {
|
||||
RxDataset *dataset = Rx::dataset(-1); // FIXME
|
||||
RxDataset *dataset = Rx::dataset(0); // FIXME
|
||||
if (dataset) {
|
||||
const auto rxPages = dataset->hugePages();
|
||||
pages[0] += rxPages.first;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <thread>
|
||||
|
||||
|
||||
|
@ -81,15 +82,20 @@ xmrig::CpuWorker<N>::~CpuWorker()
|
|||
template<size_t N>
|
||||
void xmrig::CpuWorker<N>::allocateRandomX_VM()
|
||||
{
|
||||
while (!Rx::isReady(m_job.currentJob(), m_affinity)) {
|
||||
while (!Rx::isReady(m_job.currentJob(), m_node)) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
|
||||
if (Nonce::sequence(Nonce::CPU) == 0) {
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RxDataset *dataset = Rx::dataset(m_affinity);
|
||||
RxDataset *dataset = Rx::dataset(m_node);
|
||||
assert(dataset != nullptr);
|
||||
|
||||
if (!dataset) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_vm) {
|
||||
m_vm = new RxVm(dataset, m_memory->scratchpad(), !m_hwAES);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
namespace xmrig {
|
||||
|
||||
|
||||
std::vector<uint32_t> HwlocCpuInfo::m_nodeIndexes;
|
||||
uint32_t HwlocCpuInfo::m_features = 0;
|
||||
|
||||
|
||||
|
@ -151,8 +152,17 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo() : BasicCpuInfo(),
|
|||
m_nodes = std::max<size_t>(countByType(m_topology, HWLOC_OBJ_NUMANODE), 1);
|
||||
m_packages = countByType(m_topology, HWLOC_OBJ_PACKAGE);
|
||||
|
||||
if (nodes() > 1 && hwloc_topology_get_support(m_topology)->membind->set_thisthread_membind) {
|
||||
m_features |= SET_THISTHREAD_MEMBIND;
|
||||
if (m_nodes > 1) {
|
||||
if (hwloc_topology_get_support(m_topology)->membind->set_thisthread_membind) {
|
||||
m_features |= SET_THISTHREAD_MEMBIND;
|
||||
}
|
||||
|
||||
m_nodeIndexes.reserve(m_nodes);
|
||||
hwloc_obj_t node = nullptr;
|
||||
|
||||
while ((node = hwloc_get_next_obj_by_type(m_topology, HWLOC_OBJ_NUMANODE, node)) != nullptr) {
|
||||
m_nodeIndexes.emplace_back(node->os_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ public:
|
|||
HwlocCpuInfo();
|
||||
~HwlocCpuInfo() override;
|
||||
|
||||
static inline bool has(Feature feature) { return m_features & feature; }
|
||||
static inline bool has(Feature feature) { return m_features & feature; }
|
||||
static inline const std::vector<uint32_t> &nodeIndexes() { return m_nodeIndexes; }
|
||||
|
||||
protected:
|
||||
CpuThreads threads(const Algorithm &algorithm) const override;
|
||||
|
@ -62,6 +63,7 @@ protected:
|
|||
private:
|
||||
void processTopLevelCache(hwloc_obj_t obj, const Algorithm &algorithm, CpuThreads &threads) const;
|
||||
|
||||
static std::vector<uint32_t> m_nodeIndexes;
|
||||
static uint32_t m_features;
|
||||
|
||||
char m_backend[20];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue