mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-22 18:54:43 +00:00
Move RandowWOW to new global algorithm.
This commit is contained in:
parent
cf61f49746
commit
f7f2c09e89
8 changed files with 54 additions and 11 deletions
|
@ -68,6 +68,10 @@ MemInfo Mem::create(cryptonight_ctx **ctx, xmrig::Algo algorithm, size_t count)
|
|||
|
||||
void Mem::release(cryptonight_ctx **ctx, size_t count, MemInfo &info)
|
||||
{
|
||||
if (info.memory == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
release(info);
|
||||
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
|
|
|
@ -39,11 +39,11 @@ struct cryptonight_ctx;
|
|||
|
||||
struct MemInfo
|
||||
{
|
||||
alignas(16) uint8_t *memory;
|
||||
alignas(16) uint8_t *memory = nullptr;
|
||||
|
||||
size_t hugePages;
|
||||
size_t pages;
|
||||
size_t size;
|
||||
size_t hugePages = 0;
|
||||
size_t pages = 0;
|
||||
size_t size = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ enum Algo {
|
|||
CRYPTONIGHT_LITE, /* CryptoNight (1 MB) */
|
||||
CRYPTONIGHT_HEAVY, /* CryptoNight (4 MB) */
|
||||
CRYPTONIGHT_PICO, /* CryptoNight (256 KB) */
|
||||
RANDOM_X, /* RandomX */
|
||||
ALGO_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ inline size_t cn_select_memory(Algo algorithm, Variant v = VARIANT_AUTO)
|
|||
switch(algorithm)
|
||||
{
|
||||
case CRYPTONIGHT:
|
||||
return (v == VARIANT_RX_WOW) ? CRYPTONIGHT_LITE_MEMORY : CRYPTONIGHT_MEMORY;
|
||||
return CRYPTONIGHT_MEMORY;
|
||||
|
||||
case CRYPTONIGHT_LITE:
|
||||
return CRYPTONIGHT_LITE_MEMORY;
|
||||
|
@ -86,6 +86,9 @@ inline size_t cn_select_memory(Algo algorithm, Variant v = VARIANT_AUTO)
|
|||
case CRYPTONIGHT_PICO:
|
||||
return CRYPTONIGHT_PICO_MEMORY;
|
||||
|
||||
case RANDOM_X:
|
||||
return (v == VARIANT_RX_WOW) ? CRYPTONIGHT_LITE_MEMORY : CRYPTONIGHT_MEMORY;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,8 @@ static AlgoData const algorithms[] = {
|
|||
{ "cryptonight/double", "cn/double", xmrig::CRYPTONIGHT, xmrig::VARIANT_DOUBLE },
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
{ "randomx/wow", "rx/wow", xmrig::CRYPTONIGHT, xmrig::VARIANT_RX_WOW },
|
||||
{ "randomx/wow", "rx/wow", xmrig::RANDOM_X, xmrig::VARIANT_RX_WOW },
|
||||
{ "randomx", "rx", xmrig::RANDOM_X, xmrig::VARIANT_RX_WOW },
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_LITE
|
||||
|
|
|
@ -574,6 +574,24 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
|
|||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_DOUBLE
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_RX_WOW
|
||||
# endif
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_0
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_1
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_TUBE
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_XTL
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_MSR
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_XHV
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_XAO
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_RTO
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_2
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_HALF
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_TRTL
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_GPU
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_WOW
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_4
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_RWZ
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_ZLS
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_DOUBLE
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_RX_WOW
|
||||
};
|
||||
|
||||
static_assert(count == sizeof(func_table) / sizeof(func_table[0]), "func_table size mismatch");
|
||||
|
|
|
@ -37,7 +37,9 @@ template<size_t N>
|
|||
MultiWorker<N>::MultiWorker(ThreadHandle *handle)
|
||||
: Worker(handle)
|
||||
{
|
||||
m_memory = Mem::create(m_ctx, m_thread->algorithm(), N);
|
||||
if (m_thread->algorithm() != xmrig::RANDOM_X) {
|
||||
m_memory = Mem::create(m_ctx, m_thread->algorithm(), N);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -125,6 +127,12 @@ bool MultiWorker<N>::selfTest()
|
|||
}
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (m_thread->algorithm() == RANDOM_X) {
|
||||
return true;
|
||||
}
|
||||
# endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -359,10 +359,18 @@ void Workers::start(IWorker *worker)
|
|||
const double percent = (double) m_status.hugePages / m_status.pages * 100.0;
|
||||
const size_t memory = m_status.ways * xmrig::cn_select_memory(m_status.algo, m_status.variant) / 1024;
|
||||
|
||||
LOG_INFO(GREEN_BOLD("READY (CPU)") " threads " CYAN_BOLD("%zu(%zu)") " huge pages %s%zu/%zu %1.0f%%\x1B[0m memory " CYAN_BOLD("%zu KB") "",
|
||||
m_status.threads, m_status.ways,
|
||||
(m_status.hugePages == m_status.pages ? GREEN_BOLD_S : (m_status.hugePages == 0 ? RED_BOLD_S : YELLOW_BOLD_S)),
|
||||
m_status.hugePages, m_status.pages, percent, memory);
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (m_status.algo == xmrig::RANDOM_X) {
|
||||
LOG_INFO(GREEN_BOLD("READY (CPU)") " threads " CYAN_BOLD("%zu(%zu)") " memory " CYAN_BOLD("%zu KB") "",
|
||||
m_status.threads, m_status.ways, memory);
|
||||
} else
|
||||
# endif
|
||||
{
|
||||
LOG_INFO(GREEN_BOLD("READY (CPU)") " threads " CYAN_BOLD("%zu(%zu)") " huge pages %s%zu/%zu %1.0f%%\x1B[0m memory " CYAN_BOLD("%zu KB") "",
|
||||
m_status.threads, m_status.ways,
|
||||
(m_status.hugePages == m_status.pages ? GREEN_BOLD_S : (m_status.hugePages == 0 ? RED_BOLD_S : YELLOW_BOLD_S)),
|
||||
m_status.hugePages, m_status.pages, percent, memory);
|
||||
}
|
||||
}
|
||||
|
||||
uv_mutex_unlock(&m_mutex);
|
||||
|
|
Loading…
Reference in a new issue