Merge branch 'evo' into feature-per-pool-algo
This commit is contained in:
commit
9b14caa9f9
79 changed files with 9889 additions and 40 deletions
|
@ -159,7 +159,7 @@ void xmrig::MultiWorker<N>::start()
|
|||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (m_state.job.algorithm().family() == Algorithm::RANDOM_X) {
|
||||
allocateRandomX_VM();
|
||||
Workers::updateDataset(m_state.job.seedHash(), m_totalWays);
|
||||
Workers::updateDataset(m_state.job.seedHash(), m_totalWays, m_state.job.algorithm());
|
||||
randomx_calculate_hash(m_rx_vm, m_state.blob, m_state.job.size(), m_hash);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -64,6 +64,7 @@ uv_rwlock_t Workers::m_rx_dataset_lock;
|
|||
randomx_cache *Workers::m_rx_cache = nullptr;
|
||||
randomx_dataset *Workers::m_rx_dataset = nullptr;
|
||||
uint8_t Workers::m_rx_seed_hash[32] = {};
|
||||
xmrig::Algorithm Workers::m_rx_algo;
|
||||
std::atomic<uint32_t> Workers::m_rx_dataset_init_thread_counter = {};
|
||||
#endif
|
||||
|
||||
|
@ -374,10 +375,10 @@ void Workers::start(IWorker *worker)
|
|||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
void Workers::updateDataset(const uint8_t* seed_hash, const uint32_t num_threads)
|
||||
void Workers::updateDataset(const uint8_t* seed_hash, const uint32_t num_threads, const xmrig::Algorithm &algorithm)
|
||||
{
|
||||
// Check if we need to update cache and dataset
|
||||
if (memcmp(m_rx_seed_hash, seed_hash, sizeof(m_rx_seed_hash)) == 0)
|
||||
if ((memcmp(m_rx_seed_hash, seed_hash, sizeof(m_rx_seed_hash)) == 0) && (m_rx_algo == algorithm))
|
||||
return;
|
||||
|
||||
const uint32_t thread_id = m_rx_dataset_init_thread_counter++;
|
||||
|
@ -394,10 +395,30 @@ void Workers::updateDataset(const uint8_t* seed_hash, const uint32_t num_threads
|
|||
|
||||
// One of the threads updates cache
|
||||
uv_rwlock_wrlock(&m_rx_dataset_lock);
|
||||
|
||||
if (m_rx_algo != algorithm) {
|
||||
switch (algorithm) {
|
||||
case xmrig::Algorithm::RX_WOW:
|
||||
randomx_apply_config(RandomX_WowneroConfig);
|
||||
break;
|
||||
|
||||
case xmrig::Algorithm::RX_LOKI:
|
||||
randomx_apply_config(RandomX_LokiConfig);
|
||||
break;
|
||||
|
||||
default:
|
||||
randomx_apply_config(RandomX_MoneroConfig);
|
||||
break;
|
||||
}
|
||||
|
||||
m_rx_algo = algorithm;
|
||||
}
|
||||
|
||||
if (memcmp(m_rx_seed_hash, seed_hash, sizeof(m_rx_seed_hash)) != 0) {
|
||||
memcpy(m_rx_seed_hash, seed_hash, sizeof(m_rx_seed_hash));
|
||||
randomx_init_cache(m_rx_cache, m_rx_seed_hash, sizeof(m_rx_seed_hash));
|
||||
}
|
||||
|
||||
uv_rwlock_wrunlock(&m_rx_dataset_lock);
|
||||
|
||||
// All threads update dataset
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
static void updateDataset(const uint8_t* seed_hash, uint32_t num_threads);
|
||||
static void updateDataset(const uint8_t* seed_hash, uint32_t num_threads, const xmrig::Algorithm &algorithm);
|
||||
static randomx_dataset* getDataset();
|
||||
# endif
|
||||
|
||||
|
@ -128,6 +128,7 @@ private:
|
|||
static randomx_cache *m_rx_cache;
|
||||
static randomx_dataset *m_rx_dataset;
|
||||
static uint8_t m_rx_seed_hash[32];
|
||||
static xmrig::Algorithm m_rx_algo;
|
||||
static std::atomic<uint32_t> m_rx_dataset_init_thread_counter;
|
||||
# endif
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue