Prepare for per pool and per job algorithms.

This commit is contained in:
XMRig 2018-04-21 19:55:51 +07:00
parent 274992e50d
commit 45e8a0525c
14 changed files with 116 additions and 84 deletions

View file

@ -62,19 +62,19 @@ bool xmrig::CpuThread::isSoftAES(AlgoVariant av)
xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant av, Variant variant)
{
assert(variant == VARIANT_NONE || variant == VARIANT_V1);
assert(variant == VARIANT_V0 || variant == VARIANT_V1);
static const cn_hash_fun func_table[50] = {
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_NONE>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_NONE>,
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_NONE>,
cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_NONE>,
cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_NONE>,
cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_NONE>,
cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_NONE>,
cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_NONE>,
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_NONE>,
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_NONE>,
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_V0>,
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_V0>,
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_V1>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_V1>,
@ -88,16 +88,16 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_V1>,
# ifndef XMRIG_NO_AEON
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_NONE>,
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_NONE>,
cryptonight_single_hash<CRYPTONIGHT_LITE, true, VARIANT_NONE>,
cryptonight_double_hash<CRYPTONIGHT_LITE, true, VARIANT_NONE>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, false, VARIANT_NONE>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, false, VARIANT_NONE>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, false, VARIANT_NONE>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, true, VARIANT_NONE>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_NONE>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_NONE>,
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_V0>,
cryptonight_single_hash<CRYPTONIGHT_LITE, true, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT_LITE, true, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, false, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, false, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, false, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, true, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_V0>,
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_V1>,
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_V1>,
@ -115,16 +115,16 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
# endif
# ifndef XMRIG_NO_SUMO
cryptonight_single_hash<CRYPTONIGHT_HEAVY, false, VARIANT_NONE>,
cryptonight_double_hash<CRYPTONIGHT_HEAVY, false, VARIANT_NONE>,
cryptonight_single_hash<CRYPTONIGHT_HEAVY, true, VARIANT_NONE>,
cryptonight_double_hash<CRYPTONIGHT_HEAVY, true, VARIANT_NONE>,
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, false, VARIANT_NONE>,
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, false, VARIANT_NONE>,
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, false, VARIANT_NONE>,
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, true, VARIANT_NONE>,
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, true, VARIANT_NONE>,
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, true, VARIANT_NONE>,
cryptonight_single_hash<CRYPTONIGHT_HEAVY, false, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT_HEAVY, false, VARIANT_V0>,
cryptonight_single_hash<CRYPTONIGHT_HEAVY, true, VARIANT_V0>,
cryptonight_double_hash<CRYPTONIGHT_HEAVY, true, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, false, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, false, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, false, VARIANT_V0>,
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, true, VARIANT_V0>,
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, true, VARIANT_V0>,
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, true, VARIANT_V0>,
# else
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
# endif
@ -132,7 +132,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
# ifndef XMRIG_NO_SUMO
if (algorithm == CRYPTONIGHT_HEAVY) {
variant = VARIANT_NONE;
variant = VARIANT_V0;
}
# endif

View file

@ -50,11 +50,11 @@ MultiWorker<N>::~MultiWorker()
template<size_t N>
bool MultiWorker<N>::selfTest()
{
if (m_thread->fn(xmrig::VARIANT_NONE) == nullptr) {
if (m_thread->fn(xmrig::VARIANT_V0) == nullptr) {
return false;
}
m_thread->fn(xmrig::VARIANT_NONE)(test_input, 76, m_hash, m_ctx);
m_thread->fn(xmrig::VARIANT_V0)(test_input, 76, m_hash, m_ctx);
if (m_thread->algorithm() == xmrig::CRYPTONIGHT && memcmp(m_hash, test_output_v0, sizeof m_hash) == 0) {
m_thread->fn(xmrig::VARIANT_V1)(test_input, 76, m_hash, m_ctx);