|
|
@ -161,11 +161,11 @@ static void rx_initdata(randomx_cache *rs_cache, const int miners, const uint64_
|
|
|
|
CTHR_THREAD_TYPE *st;
|
|
|
|
CTHR_THREAD_TYPE *st;
|
|
|
|
si = malloc(miners * sizeof(seedinfo));
|
|
|
|
si = malloc(miners * sizeof(seedinfo));
|
|
|
|
if (si == NULL)
|
|
|
|
if (si == NULL)
|
|
|
|
local_abort("Couldn't allocate RandomX mining threadinfo");
|
|
|
|
local_abort("Couldn't allocate RandomWOW mining threadinfo");
|
|
|
|
st = malloc(miners * sizeof(CTHR_THREAD_TYPE));
|
|
|
|
st = malloc(miners * sizeof(CTHR_THREAD_TYPE));
|
|
|
|
if (st == NULL) {
|
|
|
|
if (st == NULL) {
|
|
|
|
free(si);
|
|
|
|
free(si);
|
|
|
|
local_abort("Couldn't allocate RandomX mining threadlist");
|
|
|
|
local_abort("Couldn't allocate RandomWOW mining threadlist");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i=0; i<miners-1; i++) {
|
|
|
|
for (i=0; i<miners-1; i++) {
|
|
|
|
si[i].si_cache = rs_cache;
|
|
|
|
si[i].si_cache = rs_cache;
|
|
|
@ -225,11 +225,11 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch
|
|
|
|
if (cache == NULL) {
|
|
|
|
if (cache == NULL) {
|
|
|
|
cache = randomx_alloc_cache(flags | RANDOMX_FLAG_LARGE_PAGES);
|
|
|
|
cache = randomx_alloc_cache(flags | RANDOMX_FLAG_LARGE_PAGES);
|
|
|
|
if (cache == NULL) {
|
|
|
|
if (cache == NULL) {
|
|
|
|
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX cache");
|
|
|
|
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomWOW cache");
|
|
|
|
cache = randomx_alloc_cache(flags);
|
|
|
|
cache = randomx_alloc_cache(flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cache == NULL)
|
|
|
|
if (cache == NULL)
|
|
|
|
local_abort("Couldn't allocate RandomX cache");
|
|
|
|
local_abort("Couldn't allocate RandomWOW cache");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rx_sp->rs_height != seedheight || rx_sp->rs_cache == NULL || memcmp(seedhash, rx_sp->rs_hash, HASH_SIZE)) {
|
|
|
|
if (rx_sp->rs_height != seedheight || rx_sp->rs_cache == NULL || memcmp(seedhash, rx_sp->rs_hash, HASH_SIZE)) {
|
|
|
@ -251,7 +251,7 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch
|
|
|
|
if (rx_dataset == NULL) {
|
|
|
|
if (rx_dataset == NULL) {
|
|
|
|
rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_LARGE_PAGES);
|
|
|
|
rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_LARGE_PAGES);
|
|
|
|
if (rx_dataset == NULL) {
|
|
|
|
if (rx_dataset == NULL) {
|
|
|
|
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX dataset");
|
|
|
|
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomWOW dataset");
|
|
|
|
rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_DEFAULT);
|
|
|
|
rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_DEFAULT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rx_dataset != NULL)
|
|
|
|
if (rx_dataset != NULL)
|
|
|
@ -264,14 +264,14 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch
|
|
|
|
miners = 0;
|
|
|
|
miners = 0;
|
|
|
|
if (!rx_dataset_nomem) {
|
|
|
|
if (!rx_dataset_nomem) {
|
|
|
|
rx_dataset_nomem = 1;
|
|
|
|
rx_dataset_nomem = 1;
|
|
|
|
mwarning(RX_LOGCAT, "Couldn't allocate RandomX dataset for miner");
|
|
|
|
mwarning(RX_LOGCAT, "Couldn't allocate RandomWOW dataset for miner");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CTHR_MUTEX_UNLOCK(rx_dataset_mutex);
|
|
|
|
CTHR_MUTEX_UNLOCK(rx_dataset_mutex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rx_vm = randomx_create_vm(flags | RANDOMX_FLAG_LARGE_PAGES, rx_sp->rs_cache, rx_dataset);
|
|
|
|
rx_vm = randomx_create_vm(flags | RANDOMX_FLAG_LARGE_PAGES, rx_sp->rs_cache, rx_dataset);
|
|
|
|
if(rx_vm == NULL) { //large pages failed
|
|
|
|
if(rx_vm == NULL) { //large pages failed
|
|
|
|
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX VM");
|
|
|
|
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomWOW VM");
|
|
|
|
rx_vm = randomx_create_vm(flags, rx_sp->rs_cache, rx_dataset);
|
|
|
|
rx_vm = randomx_create_vm(flags, rx_sp->rs_cache, rx_dataset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(rx_vm == NULL) {//fallback if everything fails
|
|
|
|
if(rx_vm == NULL) {//fallback if everything fails
|
|
|
@ -279,7 +279,7 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch
|
|
|
|
rx_vm = randomx_create_vm(flags, rx_sp->rs_cache, rx_dataset);
|
|
|
|
rx_vm = randomx_create_vm(flags, rx_sp->rs_cache, rx_dataset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rx_vm == NULL)
|
|
|
|
if (rx_vm == NULL)
|
|
|
|
local_abort("Couldn't allocate RandomX VM");
|
|
|
|
local_abort("Couldn't allocate RandomWOW VM");
|
|
|
|
} else if (miners) {
|
|
|
|
} else if (miners) {
|
|
|
|
CTHR_MUTEX_LOCK(rx_dataset_mutex);
|
|
|
|
CTHR_MUTEX_LOCK(rx_dataset_mutex);
|
|
|
|
if (rx_dataset != NULL && rx_dataset_height != seedheight)
|
|
|
|
if (rx_dataset != NULL && rx_dataset_height != seedheight)
|
|
|
|