Sync changes with proxy.

This commit is contained in:
XMRig 2018-04-25 14:48:32 +07:00
parent b9fec2fcc4
commit ca149d2eed
22 changed files with 436 additions and 328 deletions

View file

@ -62,69 +62,69 @@ bool xmrig::CpuThread::isSoftAES(AlgoVariant av)
xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant av, Variant variant)
{
assert(variant == VARIANT_V0 || variant == VARIANT_V1);
assert(variant == VARIANT_0 || variant == VARIANT_1);
static const cn_hash_fun func_table[50] = {
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_0>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_0>,
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_0>,
cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_0>,
cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_0>,
cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_0>,
cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_0>,
cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_0>,
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_0>,
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_0>,
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_V1>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_V1>,
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_V1>,
cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_V1>,
cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_V1>,
cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_V1>,
cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_V1>,
cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_V1>,
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_V1>,
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_V1>,
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_1>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_1>,
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_1>,
cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_1>,
cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_1>,
cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_1>,
cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_1>,
cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_1>,
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_1>,
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_1>,
# ifndef XMRIG_NO_AEON
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_0>,
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
cryptonight_single_hash<CRYPTONIGHT_LITE, true, VARIANT_0>,
cryptonight_double_hash<CRYPTONIGHT_LITE, true, VARIANT_0>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, true, VARIANT_0>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_0>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_0>,
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_V1>,
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_V1>,
cryptonight_single_hash<CRYPTONIGHT_LITE, true, VARIANT_V1>,
cryptonight_double_hash<CRYPTONIGHT_LITE, true, VARIANT_V1>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, false, VARIANT_V1>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, false, VARIANT_V1>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, false, VARIANT_V1>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, true, VARIANT_V1>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_V1>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_V1>,
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_1>,
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_1>,
cryptonight_single_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
cryptonight_double_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, false, VARIANT_1>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, false, VARIANT_1>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, false, VARIANT_1>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
# else
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
# endif
# ifndef XMRIG_NO_SUMO
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>,
cryptonight_single_hash<CRYPTONIGHT_HEAVY, false, VARIANT_0>,
cryptonight_double_hash<CRYPTONIGHT_HEAVY, false, VARIANT_0>,
cryptonight_single_hash<CRYPTONIGHT_HEAVY, true, VARIANT_0>,
cryptonight_double_hash<CRYPTONIGHT_HEAVY, true, VARIANT_0>,
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, false, VARIANT_0>,
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, false, VARIANT_0>,
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, false, VARIANT_0>,
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, true, VARIANT_0>,
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, true, VARIANT_0>,
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, true, VARIANT_0>,
# 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_V0;
variant = VARIANT_0;
}
# endif
@ -252,7 +252,6 @@ rapidjson::Value xmrig::CpuThread::toAPI(rapidjson::Document &doc) const
auto &allocator = doc.GetAllocator();
obj.AddMember("type", "cpu", allocator);
obj.AddMember("algo", rapidjson::StringRef(Pool::algoName(algorithm())), allocator);
obj.AddMember("av", m_av, allocator);
obj.AddMember("low_power_mode", multiway(), allocator);
obj.AddMember("affine_to_cpu", affinity(), allocator);

View file

@ -50,21 +50,21 @@ MultiWorker<N>::~MultiWorker()
template<size_t N>
bool MultiWorker<N>::selfTest()
{
if (m_thread->fn(xmrig::VARIANT_V0) == nullptr) {
if (m_thread->fn(xmrig::VARIANT_0) == nullptr) {
return false;
}
m_thread->fn(xmrig::VARIANT_V0)(test_input, 76, m_hash, m_ctx);
m_thread->fn(xmrig::VARIANT_0)(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);
m_thread->fn(xmrig::VARIANT_1)(test_input, 76, m_hash, m_ctx);
return memcmp(m_hash, test_output_v1, sizeof m_hash) == 0;
}
# ifndef XMRIG_NO_AEON
if (m_thread->algorithm() == xmrig::CRYPTONIGHT_LITE && memcmp(m_hash, test_output_v0_lite, sizeof m_hash) == 0) {
m_thread->fn(xmrig::VARIANT_V1)(test_input, 76, m_hash, m_ctx);
m_thread->fn(xmrig::VARIANT_1)(test_input, 76, m_hash, m_ctx);
return memcmp(m_hash, test_output_v1_lite, sizeof m_hash) == 0;
}

View file

@ -132,7 +132,7 @@ void Workers::setJob(const Job &job, bool donate)
void Workers::start(xmrig::Controller *controller)
{
const std::vector<xmrig::IThread *> &threads = controller->config()->threads();
m_status.algo = controller->config()->algorithm();
m_status.algo = controller->config()->algorithm().algo();
m_status.colors = controller->config()->isColors();
m_status.threads = threads.size();