Added "cn/xao" and "cn/rto".

This commit is contained in:
XMRig 2018-07-09 16:12:45 +07:00
parent a8de81a51b
commit 25bac30862
7 changed files with 112 additions and 48 deletions

View file

@ -58,19 +58,21 @@ static AlgoData const algorithms[] = {
{ "cryptonight/1", "cn/1", xmrig::CRYPTONIGHT, xmrig::VARIANT_1 },
{ "cryptonight/xtl", "cn/xtl", xmrig::CRYPTONIGHT, xmrig::VARIANT_XTL },
{ "cryptonight/msr", "cn/msr", xmrig::CRYPTONIGHT, xmrig::VARIANT_MSR },
{ "cryptonight/xao", "cn/xao", xmrig::CRYPTONIGHT, xmrig::VARIANT_XAO },
{ "cryptonight/rto", "cn/rto", xmrig::CRYPTONIGHT, xmrig::VARIANT_RTO },
# ifndef XMRIG_NO_AEON
{ "cryptonight-lite", "cn-lite", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO },
{ "cryptonight-light", "cn-light", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO },
{ "cryptonight-lite/0", "cn-lite/0", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0 },
{ "cryptonight-lite/1", "cn-lite/1", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 },
{ "cryptonight-lite/ipbc", "cn-lite/ipbc", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_IPBC },
# endif
# ifndef XMRIG_NO_SUMO
{ "cryptonight-heavy", "cn-heavy", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_AUTO },
{ "cryptonight-heavy/0", "cn-heavy/0", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_0 },
{ "cryptonight-heavy/xhv", "cn-heavy/xhv", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_XHV },
{ "cryptonight-heavy/tube", "cn-heavy/tube", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_TUBE },
# endif
};
@ -83,10 +85,12 @@ static AlgoData const xmrStakAlgorithms[] = {
{ "cryptonight_lite", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0 },
{ "cryptonight-aeonv7", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 },
{ "cryptonight_lite_v7", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 },
{ "cryptonight_lite_v7_xor", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_IPBC },
{ "cryptonight_heavy", nullptr, xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_0 },
{ "cryptonight_haven", nullptr, xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_XHV },
{ "cryptonight_masari", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_MSR },
{ "cryptonight_masari", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_MSR },
{ "cryptonight-bittube2", nullptr, xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_TUBE }, // bittube-miner
{ "cryptonight_alloy", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_XAO }, // xmr-stak-alloy
};
#endif
@ -94,10 +98,12 @@ static AlgoData const xmrStakAlgorithms[] = {
static const char *variants[] = {
"0",
"1",
"ipbc",
"tube",
"xtl",
"msr",
"xhv"
"xhv",
"xao",
"rto"
};

View file

@ -352,6 +352,10 @@ void Pool::adjustVariant(const xmrig::Variant variantHint)
return;
}
if (m_algorithm.variant() != VARIANT_AUTO) {
return;
}
if (m_algorithm.algo() == CRYPTONIGHT_HEAVY) {
m_algorithm.setVariant(VARIANT_0);
}
@ -376,9 +380,11 @@ void Pool::rebuild()
addVariant(xmrig::VARIANT_1);
addVariant(xmrig::VARIANT_0);
addVariant(xmrig::VARIANT_XTL);
addVariant(xmrig::VARIANT_IPBC);
addVariant(xmrig::VARIANT_TUBE);
addVariant(xmrig::VARIANT_MSR);
addVariant(xmrig::VARIANT_XHV);
addVariant(xmrig::VARIANT_XAO);
addVariant(xmrig::VARIANT_RTO);
addVariant(xmrig::VARIANT_AUTO);
# endif
}

View file

@ -61,10 +61,12 @@ enum Variant {
VARIANT_AUTO = -1, // Autodetect
VARIANT_0 = 0, // Original CryptoNight or CryptoNight-Heavy
VARIANT_1 = 1, // CryptoNight variant 1 also known as Monero7 and CryptoNightV7
VARIANT_IPBC = 2, // Modified CryptoNight Lite variant 1 with XOR (IPBC/TUBE only)
VARIANT_TUBE = 2, // Modified CryptoNight-Heavy (TUBE only)
VARIANT_XTL = 3, // Modified CryptoNight variant 1 (Stellite only)
VARIANT_MSR = 4, // Modified CryptoNight variant 1 (Masari only)
VARIANT_XHV = 5, // Modified CryptoNight-Heavy (Haven Protocol only)
VARIANT_XAO = 6, // Modified CryptoNight variant 1 (Alloy only)
VARIANT_RTO = 7, // Modified CryptoNight variant 1 (Arto only)
VARIANT_MAX
};

View file

@ -39,6 +39,7 @@ constexpr const size_t CRYPTONIGHT_MEMORY = 2 * 1024 * 1024;
constexpr const uint32_t CRYPTONIGHT_MASK = 0x1FFFF0;
constexpr const uint32_t CRYPTONIGHT_ITER = 0x80000;
constexpr const uint32_t CRYPTONIGHT_MSR_ITER = 0x40000;
constexpr const uint32_t CRYPTONIGHT_XAO_ITER = 0x100000;
constexpr const size_t CRYPTONIGHT_LITE_MEMORY = 1 * 1024 * 1024;
constexpr const uint32_t CRYPTONIGHT_LITE_MASK = 0xFFFF0;
@ -108,19 +109,32 @@ template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_0>()
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_1>() { return CRYPTONIGHT_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_XTL>() { return CRYPTONIGHT_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_MSR>() { return CRYPTONIGHT_MSR_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_XAO>() { return CRYPTONIGHT_XAO_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_RTO>() { return CRYPTONIGHT_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_0>() { return CRYPTONIGHT_LITE_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_1>() { return CRYPTONIGHT_LITE_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_IPBC>() { return CRYPTONIGHT_LITE_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_0>() { return CRYPTONIGHT_HEAVY_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_XHV>() { return CRYPTONIGHT_HEAVY_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_TUBE>() { return CRYPTONIGHT_HEAVY_ITER; }
inline uint32_t cn_select_iter(Algo algorithm, Variant variant)
{
switch (variant) {
case VARIANT_MSR:
return CRYPTONIGHT_MSR_ITER;
case VARIANT_RTO:
return CRYPTONIGHT_XAO_ITER;
default:
break;
}
switch(algorithm)
{
case CRYPTONIGHT:
return variant == VARIANT_MSR ? CRYPTONIGHT_MSR_ITER : CRYPTONIGHT_ITER;
return CRYPTONIGHT_ITER;
case CRYPTONIGHT_LITE:
return CRYPTONIGHT_LITE_ITER;
@ -139,15 +153,25 @@ inline uint32_t cn_select_iter(Algo algorithm, Variant variant)
template<Variant variant> inline constexpr bool cn_is_monero() { return false; }
template<> inline constexpr bool cn_is_monero<VARIANT_0>() { return false; }
template<> inline constexpr bool cn_is_monero<VARIANT_1>() { return true; }
template<> inline constexpr bool cn_is_monero<VARIANT_IPBC>() { return true; }
template<> inline constexpr bool cn_is_monero<VARIANT_TUBE>() { return true; }
template<> inline constexpr bool cn_is_monero<VARIANT_XTL>() { return true; }
template<> inline constexpr bool cn_is_monero<VARIANT_MSR>() { return true; }
template<> inline constexpr bool cn_is_monero<VARIANT_XHV>() { return false; }
template<> inline constexpr bool cn_is_monero<VARIANT_XAO>() { return false; }
template<> inline constexpr bool cn_is_monero<VARIANT_RTO>() { return true; }
inline bool cn_is_monero(Variant variant)
{
return variant > VARIANT_0 && variant < VARIANT_XHV;
switch (variant) {
case VARIANT_0:
case VARIANT_XHV:
case VARIANT_RTO:
return false;
default:
return true;
}
}

View file

@ -462,7 +462,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
((uint64_t*)&l0[idx0 & MASK])[0] = al0;
if (IS_MONERO) {
if (VARIANT == xmrig::VARIANT_IPBC) {
if (VARIANT == xmrig::VARIANT_RTO) {
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0;
}
else {
@ -576,7 +576,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
((uint64_t*)&l0[idx0 & MASK])[0] = al0;
if (IS_MONERO) {
if (VARIANT == xmrig::VARIANT_IPBC) {
if (VARIANT == xmrig::VARIANT_RTO) {
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0;
}
else {
@ -615,7 +615,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
((uint64_t*)&l1[idx1 & MASK])[0] = al1;
if (IS_MONERO) {
if (VARIANT == xmrig::VARIANT_IPBC) {
if (VARIANT == xmrig::VARIANT_RTO) {
((uint64_t*)&l1[idx1 & MASK])[1] = ah1 ^ tweak1_2_1 ^ al1;
}
else {
@ -690,7 +690,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
if (IS_MONERO) { \
_mm_store_si128(ptr, _mm_xor_si128(a, mc)); \
\
if (VARIANT == xmrig::VARIANT_IPBC) { \
if (VARIANT == xmrig::VARIANT_RTO) { \
((uint64_t*)ptr)[1] ^= ((uint64_t*)ptr)[0]; \
} \
} else { \

View file

@ -62,15 +62,9 @@ bool xmrig::CpuThread::isSoftAES(AlgoVariant av)
xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant av, Variant variant)
{
assert(variant == VARIANT_0 ||
variant == VARIANT_1 ||
variant == VARIANT_IPBC ||
variant == VARIANT_XTL ||
variant == VARIANT_MSR ||
variant == VARIANT_XHV
);
assert(variant >= VARIANT_0 && variant < VARIANT_MAX);
static const cn_hash_fun func_table[180] = {
static const cn_hash_fun func_table[VARIANT_MAX * 10 * 3] = {
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_0>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_0>,
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_0>,
@ -93,7 +87,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_1>,
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_1>,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_IPBC
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_TUBE
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_XTL>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_XTL>,
@ -119,6 +113,28 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_XHV
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_XAO>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_XAO>,
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_XAO>,
cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_XAO>,
cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_XAO>,
cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_XAO>,
cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_XAO>,
cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_XAO>,
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_XAO>,
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_XAO>,
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_RTO>,
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_RTO>,
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_RTO>,
cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_RTO>,
cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_RTO>,
cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_RTO>,
cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_RTO>,
cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_RTO>,
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_RTO>,
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_RTO>,
# ifndef XMRIG_NO_AEON
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
@ -142,20 +158,12 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_IPBC>,
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_IPBC>,
cryptonight_single_hash<CRYPTONIGHT_LITE, true, VARIANT_IPBC>,
cryptonight_double_hash<CRYPTONIGHT_LITE, true, VARIANT_IPBC>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, false, VARIANT_IPBC>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, false, VARIANT_IPBC>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, false, VARIANT_IPBC>,
cryptonight_triple_hash<CRYPTONIGHT_LITE, true, VARIANT_IPBC>,
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_IPBC>,
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_IPBC>,
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
# else
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
@ -163,6 +171,8 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
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
@ -178,7 +188,18 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, true, 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_IPBC
cryptonight_single_hash<CRYPTONIGHT_HEAVY, false, VARIANT_TUBE>,
cryptonight_double_hash<CRYPTONIGHT_HEAVY, false, VARIANT_TUBE>,
cryptonight_single_hash<CRYPTONIGHT_HEAVY, true, VARIANT_TUBE>,
cryptonight_double_hash<CRYPTONIGHT_HEAVY, true, VARIANT_TUBE>,
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, false, VARIANT_TUBE>,
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, false, VARIANT_TUBE>,
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, false, VARIANT_TUBE>,
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, true, VARIANT_TUBE>,
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, true, VARIANT_TUBE>,
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, true, 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
@ -192,6 +213,9 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, true, VARIANT_XHV>,
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, true, VARIANT_XHV>,
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, true, 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
# else
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
@ -199,6 +223,8 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
# endif
};

View file

@ -61,7 +61,7 @@ bool MultiWorker<N>::selfTest()
if (m_thread->algorithm() == xmrig::CRYPTONIGHT_LITE) {
return verify(xmrig::VARIANT_0, test_output_v0_lite) &&
verify(xmrig::VARIANT_1, test_output_v1_lite) &&
verify(xmrig::VARIANT_IPBC, test_output_ipbc_lite);
verify(xmrig::VARIANT_TUBE, test_output_ipbc_lite);
}
# endif