Rename cn-pico/tlo to cn-ultra/tlo and add CN_ULTRA as new algorithm.

This commit is contained in:
Mika Lindqvist 2019-12-27 15:48:03 +02:00
parent 9ae7fdb5ac
commit 286d690575
21 changed files with 502 additions and 413 deletions

View file

@ -6,6 +6,7 @@ option(WITH_HWLOC "Enable hwloc support" ON)
option(WITH_CN_LITE "Enable CryptoNight-Lite algorithms family" ON) option(WITH_CN_LITE "Enable CryptoNight-Lite algorithms family" ON)
option(WITH_CN_HEAVY "Enable CryptoNight-Heavy algorithms family" ON) option(WITH_CN_HEAVY "Enable CryptoNight-Heavy algorithms family" ON)
option(WITH_CN_PICO "Enable CryptoNight-Pico algorithm" ON) option(WITH_CN_PICO "Enable CryptoNight-Pico algorithm" ON)
option(WITH_CN_ULTRA "Enable CryptoNight-Ultra algorithm" ON)
option(WITH_CN_GPU "Enable CryptoNight-GPU algorithm" ON) option(WITH_CN_GPU "Enable CryptoNight-GPU algorithm" ON)
option(WITH_RANDOMX "Enable RandomX algorithms family" ON) option(WITH_RANDOMX "Enable RandomX algorithms family" ON)
option(WITH_ARGON2 "Enable Argon2 algorithms family" ON) option(WITH_ARGON2 "Enable Argon2 algorithms family" ON)
@ -192,6 +193,10 @@ if (WITH_CN_PICO)
add_definitions(/DXMRIG_ALGO_CN_PICO) add_definitions(/DXMRIG_ALGO_CN_PICO)
endif() endif()
if (WITH_CN_ULTRA)
add_definitions(/DXMRIG_ALGO_CN_ULTRA)
endif()
if (WITH_EMBEDDED_CONFIG) if (WITH_EMBEDDED_CONFIG)
add_definitions(/DXMRIG_FEATURE_EMBEDDED_CONFIG) add_definitions(/DXMRIG_FEATURE_EMBEDDED_CONFIG)
endif() endif()

View file

@ -6,6 +6,7 @@
* **`-DWITH_CN_LITE=OFF`** disable all CryptoNight-Lite algorithms (`cn-lite/0`, `cn-lite/1`). * **`-DWITH_CN_LITE=OFF`** disable all CryptoNight-Lite algorithms (`cn-lite/0`, `cn-lite/1`).
* **`-DWITH_CN_HEAVY=OFF`** disable all CryptoNight-Heavy algorithms (`cn-heavy/0`, `cn-heavy/xhv`, `cn-heavy/tube`). * **`-DWITH_CN_HEAVY=OFF`** disable all CryptoNight-Heavy algorithms (`cn-heavy/0`, `cn-heavy/xhv`, `cn-heavy/tube`).
* **`-DWITH_CN_PICO=OFF`** disable CryptoNight-Pico algorithm (`cn-pico`). * **`-DWITH_CN_PICO=OFF`** disable CryptoNight-Pico algorithm (`cn-pico`).
* **`-DWITH_CN_ULTRA=OFF`** disable CryptoNight-Ultra algorithm (`cn-ultra`).
* **`-DWITH_CN_GPU=OFF`** disable CryptoNight-GPU algorithm (`cn/gpu`). * **`-DWITH_CN_GPU=OFF`** disable CryptoNight-GPU algorithm (`cn/gpu`).
* **`-DWITH_RANDOMX=OFF`** disable RandomX algorithms (`rx/loki`, `rx/wow`). * **`-DWITH_RANDOMX=OFF`** disable RandomX algorithms (`rx/loki`, `rx/wow`).
* **`-DWITH_ARGON2=OFF`** disable Argon2 algorithms (`argon2/chukwa`, `argon2/wrkz`). * **`-DWITH_ARGON2=OFF`** disable Argon2 algorithms (`argon2/chukwa`, `argon2/wrkz`).

View file

@ -163,6 +163,7 @@ void xmrig::CpuConfig::generate()
count += xmrig::generate<Algorithm::CN_LITE>(m_threads, m_limit); count += xmrig::generate<Algorithm::CN_LITE>(m_threads, m_limit);
count += xmrig::generate<Algorithm::CN_HEAVY>(m_threads, m_limit); count += xmrig::generate<Algorithm::CN_HEAVY>(m_threads, m_limit);
count += xmrig::generate<Algorithm::CN_PICO>(m_threads, m_limit); count += xmrig::generate<Algorithm::CN_PICO>(m_threads, m_limit);
count += xmrig::generate<Algorithm::CN_ULTRA>(m_threads, m_limit);
count += xmrig::generate<Algorithm::RANDOM_X>(m_threads, m_limit); count += xmrig::generate<Algorithm::RANDOM_X>(m_threads, m_limit);
count += xmrig::generate<Algorithm::ARGON2>(m_threads, m_limit); count += xmrig::generate<Algorithm::ARGON2>(m_threads, m_limit);

View file

@ -99,12 +99,15 @@ size_t inline generate<Algorithm::CN_HEAVY>(Threads<CpuThreads> &threads, uint32
template<> template<>
size_t inline generate<Algorithm::CN_PICO>(Threads<CpuThreads> &threads, uint32_t limit) size_t inline generate<Algorithm::CN_PICO>(Threads<CpuThreads> &threads, uint32_t limit)
{ {
size_t count = 0; return generate("cn-pico", threads, Algorithm::CN_PICO_0, limit);
}
#endif
count += generate("cn-pico", threads, Algorithm::CN_PICO_0, limit); #ifdef XMRIG_ALGO_CN_ULTRA
count += generate("cn-pico/tlo", threads, Algorithm::CN_PICO_TLO, limit); template<>
size_t inline generate<Algorithm::CN_ULTRA>(Threads<CpuThreads> &threads, uint32_t limit)
return count; {
return generate("cn-ultra", threads, Algorithm::CN_ULTRA_0, limit);
} }
#endif #endif

View file

@ -154,8 +154,13 @@ bool xmrig::CpuWorker<N>::selfTest()
# ifdef XMRIG_ALGO_CN_PICO # ifdef XMRIG_ALGO_CN_PICO
if (m_algorithm.family() == Algorithm::CN_PICO) { if (m_algorithm.family() == Algorithm::CN_PICO) {
return verify(Algorithm::CN_PICO_0, test_output_pico_trtl) && return verify(Algorithm::CN_PICO_0, test_output_pico_trtl);
verify(Algorithm::CN_PICO_TLO, test_output_pico_tlo); }
# endif
# ifdef XMRIG_ALGO_CN_ULTRA
if (m_algorithm.family() == Algorithm::CN_ULTRA) {
return verify(Algorithm::CN_ULTRA_0, test_output_ultra_tlo);
} }
# endif # endif
@ -252,9 +257,6 @@ void xmrig::CpuWorker<N>::start()
template<size_t N> template<size_t N>
bool xmrig::CpuWorker<N>::verify(const Algorithm &algorithm, const uint8_t *referenceValue) bool xmrig::CpuWorker<N>::verify(const Algorithm &algorithm, const uint8_t *referenceValue)
{ {
// FIXME: Disabled until 'cn-pico/tlo' test code added
return true;
cn_hash_fun func = fn(algorithm); cn_hash_fun func = fn(algorithm);
if (!func) { if (!func) {
return false; return false;
@ -268,9 +270,6 @@ bool xmrig::CpuWorker<N>::verify(const Algorithm &algorithm, const uint8_t *refe
template<size_t N> template<size_t N>
bool xmrig::CpuWorker<N>::verify2(const Algorithm &algorithm, const uint8_t *referenceValue) bool xmrig::CpuWorker<N>::verify2(const Algorithm &algorithm, const uint8_t *referenceValue)
{ {
// FIXME: Disabled until 'cn-pico/tlo' test code added
return true;
cn_hash_fun func = fn(algorithm); cn_hash_fun func = fn(algorithm);
if (!func) { if (!func) {
return false; return false;
@ -300,9 +299,6 @@ namespace xmrig {
template<> template<>
bool CpuWorker<1>::verify2(const Algorithm &algorithm, const uint8_t *referenceValue) bool CpuWorker<1>::verify2(const Algorithm &algorithm, const uint8_t *referenceValue)
{ {
// FIXME: Disabled until 'cn-pico/tlo' test code added
return true;
cn_hash_fun func = fn(algorithm); cn_hash_fun func = fn(algorithm);
if (!func) { if (!func) {
return false; return false;

View file

@ -195,7 +195,13 @@ xmrig::CpuThreads xmrig::AdvancedCpuInfo::threads(const Algorithm &algorithm, ui
uint32_t intensity = algorithm.maxIntensity() == 1 ? 0 : 1; uint32_t intensity = algorithm.maxIntensity() == 1 ? 0 : 1;
# ifdef XMRIG_ALGO_CN_PICO # ifdef XMRIG_ALGO_CN_PICO
if ((algorithm == Algorithm::CN_PICO_0 || algorithm == Algorithm::CN_PICO_TLO) && (count / cores()) >= 2) { if (algorithm == Algorithm::CN_PICO_0 && (count / cores()) >= 2) {
intensity = 2;
}
# endif
# ifdef XMRIG_ALGO_CN_ULTRA
if (algorithm == Algorithm::CN_ULTRA_0 && (count / cores()) >= 2) {
intensity = 2; intensity = 2;
} }
# endif # endif

View file

@ -225,6 +225,12 @@ xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint3
} }
# endif # endif
# ifdef XMRIG_ALGO_CN_ULTRA
if (algorithm.family() == Algorithm::CN_ULTRA) {
return CpuThreads(count, 2);
}
# endif
# ifdef XMRIG_ALGO_CN_HEAVY # ifdef XMRIG_ALGO_CN_HEAVY
if (algorithm.family() == Algorithm::CN_HEAVY) { if (algorithm.family() == Algorithm::CN_HEAVY) {
return CpuThreads(std::max<size_t>(count / 4, 1), 1); return CpuThreads(std::max<size_t>(count / 4, 1), 1);

View file

@ -307,7 +307,13 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
size_t cacheHashes = ((L3 + extra) + (scratchpad / 2)) / scratchpad; size_t cacheHashes = ((L3 + extra) + (scratchpad / 2)) / scratchpad;
# ifdef XMRIG_ALGO_CN_PICO # ifdef XMRIG_ALGO_CN_PICO
if ((algorithm == Algorithm::CN_PICO_0 || algorithm == Algorithm::CN_PICO_TLO) && (cacheHashes / PUs) >= 2) { if (algorithm == Algorithm::CN_PICO_0 && (cacheHashes / PUs) >= 2) {
intensity = 2;
}
# endif
# ifdef XMRIG_ALGO_CN_ULTRA
if (algorithm == Algorithm::CN_ULTRA_0 && (cacheHashes / PUs) >= 2) {
intensity = 2; intensity = 2;
} }
# endif # endif

View file

@ -179,6 +179,7 @@ void xmrig::CudaConfig::generate()
count += xmrig::generate<Algorithm::CN_LITE>(m_threads, devices); count += xmrig::generate<Algorithm::CN_LITE>(m_threads, devices);
count += xmrig::generate<Algorithm::CN_HEAVY>(m_threads, devices); count += xmrig::generate<Algorithm::CN_HEAVY>(m_threads, devices);
count += xmrig::generate<Algorithm::CN_PICO>(m_threads, devices); count += xmrig::generate<Algorithm::CN_PICO>(m_threads, devices);
count += xmrig::generate<Algorithm::CN_ULTRA>(m_threads, devices);
count += xmrig::generate<Algorithm::RANDOM_X>(m_threads, devices); count += xmrig::generate<Algorithm::RANDOM_X>(m_threads, devices);
generated = true; generated = true;

View file

@ -101,12 +101,15 @@ size_t inline generate<Algorithm::CN_HEAVY>(Threads<CudaThreads> &threads, const
template<> template<>
size_t inline generate<Algorithm::CN_PICO>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices) size_t inline generate<Algorithm::CN_PICO>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices)
{ {
size_t count = 0; return generate("cn-pico", threads, Algorithm::CN_PICO_0, devices);
}
#endif
count += generate("cn-pico", threads, Algorithm::CN_PICO_0, devices); #ifdef XMRIG_ALGO_CN_ULTRA
count += generate("cn-pico/tlo", threads, Algorithm::CN_PICO_TLO, devices); template<>
size_t inline generate<Algorithm::CN_ULTRA>(Threads<CudaThreads> &threads, const std::vector<CudaDevice> &devices)
return count; {
return generate("cn-ultra", threads, Algorithm::CN_ULTRA_0, devices);
} }
#endif #endif

View file

@ -193,6 +193,7 @@ void xmrig::OclConfig::generate()
count += xmrig::generate<Algorithm::CN_LITE>(m_threads, devices); count += xmrig::generate<Algorithm::CN_LITE>(m_threads, devices);
count += xmrig::generate<Algorithm::CN_HEAVY>(m_threads, devices); count += xmrig::generate<Algorithm::CN_HEAVY>(m_threads, devices);
count += xmrig::generate<Algorithm::CN_PICO>(m_threads, devices); count += xmrig::generate<Algorithm::CN_PICO>(m_threads, devices);
count += xmrig::generate<Algorithm::CN_ULTRA>(m_threads, devices);
count += xmrig::generate<Algorithm::RANDOM_X>(m_threads, devices); count += xmrig::generate<Algorithm::RANDOM_X>(m_threads, devices);
m_shouldSave = count > 0; m_shouldSave = count > 0;

View file

@ -100,12 +100,15 @@ size_t inline generate<Algorithm::CN_HEAVY>(Threads<OclThreads> &threads, const
template<> template<>
size_t inline generate<Algorithm::CN_PICO>(Threads<OclThreads> &threads, const std::vector<OclDevice> &devices) size_t inline generate<Algorithm::CN_PICO>(Threads<OclThreads> &threads, const std::vector<OclDevice> &devices)
{ {
size_t count = 0; return generate("cn-pico", threads, Algorithm::CN_PICO_0, devices);
}
#endif
count += generate("cn-pico", threads, Algorithm::CN_PICO_0, devices); #ifdef XMRIG_ALGO_CN_ULTRA
count += generate("cn-pico/tlo", threads, Algorithm::CN_PICO_TLO, devices); template<>
size_t inline generate<Algorithm::CN_ULTRA>(Threads<OclThreads> &threads, const std::vector<OclDevice> &devices)
return count; {
return generate("cn-ultra", threads, Algorithm::CN_ULTRA_0, devices);
} }
#endif #endif

View file

@ -16,7 +16,7 @@
#define ALGO_CN_HEAVY_TUBE 15 #define ALGO_CN_HEAVY_TUBE 15
#define ALGO_CN_HEAVY_XHV 16 #define ALGO_CN_HEAVY_XHV 16
#define ALGO_CN_PICO_0 17 #define ALGO_CN_PICO_0 17
#define ALGO_CN_PICO_TLO 18 #define ALGO_CN_ULTRA_0 18
#define ALGO_RX_0 19 #define ALGO_RX_0 19
#define ALGO_RX_WOW 20 #define ALGO_RX_WOW 20
#define ALGO_RX_LOKI 21 #define ALGO_RX_LOKI 21
@ -31,5 +31,6 @@
#define FAMILY_CN_LITE 2 #define FAMILY_CN_LITE 2
#define FAMILY_CN_HEAVY 3 #define FAMILY_CN_HEAVY 3
#define FAMILY_CN_PICO 4 #define FAMILY_CN_PICO 4
#define FAMILY_RANDOM_X 5 #define FAMILY_CN_ULTRA 5
#define FAMILY_ARGON2 6 #define FAMILY_RANDOM_X 6
#define FAMILY_ARGON2 7

View file

@ -88,7 +88,7 @@ static inline uint32_t getIntensity(const OclDevice &device, const Algorithm &al
static inline uint32_t getWorksize(const Algorithm &algorithm) static inline uint32_t getWorksize(const Algorithm &algorithm)
{ {
if (algorithm.family() == Algorithm::CN_PICO) { if (algorithm.family() == Algorithm::CN_PICO || algorithm.family() == Algorithm::CN_ULTRA) {
return 64; return 64;
} }

View file

@ -43,7 +43,7 @@ xmrig::OclCnRunner::OclCnRunner(size_t index, const OclLaunchData &data) : OclBa
if (data.device.vendorId() == OCL_VENDOR_NVIDIA) { if (data.device.vendorId() == OCL_VENDOR_NVIDIA) {
stridedIndex = 0; stridedIndex = 0;
} }
else if (stridedIndex == 1 && (m_algorithm.family() == Algorithm::CN_PICO || (m_algorithm.family() == Algorithm::CN && CnAlgo<>::base(m_algorithm) == Algorithm::CN_2))) { else if (stridedIndex == 1 && (m_algorithm.family() == Algorithm::CN_PICO || m_algorithm.family() == Algorithm::CN_ULTRA || (m_algorithm.family() == Algorithm::CN && CnAlgo<>::base(m_algorithm) == Algorithm::CN_2))) {
stridedIndex = 2; stridedIndex = 2;
} }

View file

@ -66,6 +66,9 @@ public:
case Algorithm::CN_PICO: case Algorithm::CN_PICO:
return CN_MEMORY / 8; return CN_MEMORY / 8;
case Algorithm::CN_ULTRA:
return CN_MEMORY / 8;
default: default:
break; break;
} }
@ -111,7 +114,11 @@ public:
# ifdef XMRIG_ALGO_CN_PICO # ifdef XMRIG_ALGO_CN_PICO
case Algorithm::CN_PICO_0: case Algorithm::CN_PICO_0:
case Algorithm::CN_PICO_TLO: return CN_ITER / 8;
# endif
# ifdef XMRIG_ALGO_CN_ULTRA
case Algorithm::CN_ULTRA_0:
return CN_ITER / 8; return CN_ITER / 8;
# endif # endif
@ -133,7 +140,11 @@ public:
# ifdef XMRIG_ALGO_CN_PICO # ifdef XMRIG_ALGO_CN_PICO
if (algo == Algorithm::CN_PICO_0) { if (algo == Algorithm::CN_PICO_0) {
return 0x1FFF0; return 0x1FFF0;
} else if (algo == Algorithm::CN_PICO_TLO) { }
# endif
# ifdef XMRIG_ALGO_CN_ULTRA
if (algo == Algorithm::CN_ULTRA_0) {
return 0x3FFF0; return 0x3FFF0;
} }
# endif # endif
@ -174,7 +185,9 @@ public:
case Algorithm::CN_DOUBLE: case Algorithm::CN_DOUBLE:
# ifdef XMRIG_ALGO_CN_PICO # ifdef XMRIG_ALGO_CN_PICO
case Algorithm::CN_PICO_0: case Algorithm::CN_PICO_0:
case Algorithm::CN_PICO_TLO: # endif
# ifdef XMRIG_ALGO_CN_ULTRA
case Algorithm::CN_ULTRA_0:
# endif # endif
return Algorithm::CN_2; return Algorithm::CN_2;
@ -221,7 +234,7 @@ template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_RWZ>::iterations() con
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_ZLS>::iterations() const { return 0x60000; } template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_ZLS>::iterations() const { return 0x60000; }
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_GPU>::iterations() const { return 0xC000; } template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_GPU>::iterations() const { return 0xC000; }
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_0>::iterations() const { return CN_ITER / 8; } template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_0>::iterations() const { return CN_ITER / 8; }
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_TLO>::iterations() const { return CN_ITER / 8; } template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_ULTRA_0>::iterations() const { return CN_ITER / 8; }
template<> constexpr inline size_t CnAlgo<Algorithm::CN_LITE_0>::memory() const { return CN_MEMORY / 2; } template<> constexpr inline size_t CnAlgo<Algorithm::CN_LITE_0>::memory() const { return CN_MEMORY / 2; }
@ -230,12 +243,12 @@ template<> constexpr inline size_t CnAlgo<Algorithm::CN_HEAVY_0>::memory() const
template<> constexpr inline size_t CnAlgo<Algorithm::CN_HEAVY_TUBE>::memory() const { return CN_MEMORY * 2; } template<> constexpr inline size_t CnAlgo<Algorithm::CN_HEAVY_TUBE>::memory() const { return CN_MEMORY * 2; }
template<> constexpr inline size_t CnAlgo<Algorithm::CN_HEAVY_XHV>::memory() const { return CN_MEMORY * 2; } template<> constexpr inline size_t CnAlgo<Algorithm::CN_HEAVY_XHV>::memory() const { return CN_MEMORY * 2; }
template<> constexpr inline size_t CnAlgo<Algorithm::CN_PICO_0>::memory() const { return CN_MEMORY / 8; } template<> constexpr inline size_t CnAlgo<Algorithm::CN_PICO_0>::memory() const { return CN_MEMORY / 8; }
template<> constexpr inline size_t CnAlgo<Algorithm::CN_PICO_TLO>::memory() const { return CN_MEMORY / 8; } template<> constexpr inline size_t CnAlgo<Algorithm::CN_ULTRA_0>::memory() const { return CN_MEMORY / 8; }
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_GPU>::mask() const { return 0x1FFFC0; } template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_GPU>::mask() const { return 0x1FFFC0; }
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_0>::mask() const { return 0x1FFF0; } template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_0>::mask() const { return 0x1FFF0; }
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_TLO>::mask() const { return 0x3FFF0; } template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_ULTRA_0>::mask() const { return 0x3FFF0; }
} /* namespace xmrig */ } /* namespace xmrig */

View file

@ -79,6 +79,11 @@ cn_mainloop_fun cn_trtl_mainloop_ryzen_asm = nullptr;
cn_mainloop_fun cn_trtl_mainloop_bulldozer_asm = nullptr; cn_mainloop_fun cn_trtl_mainloop_bulldozer_asm = nullptr;
cn_mainloop_fun cn_trtl_double_mainloop_sandybridge_asm = nullptr; cn_mainloop_fun cn_trtl_double_mainloop_sandybridge_asm = nullptr;
cn_mainloop_fun cn_tlo_mainloop_ivybridge_asm = nullptr;
cn_mainloop_fun cn_tlo_mainloop_ryzen_asm = nullptr;
cn_mainloop_fun cn_tlo_mainloop_bulldozer_asm = nullptr;
cn_mainloop_fun cn_tlo_double_mainloop_sandybridge_asm = nullptr;
cn_mainloop_fun cn_zls_mainloop_ivybridge_asm = nullptr; cn_mainloop_fun cn_zls_mainloop_ivybridge_asm = nullptr;
cn_mainloop_fun cn_zls_mainloop_ryzen_asm = nullptr; cn_mainloop_fun cn_zls_mainloop_ryzen_asm = nullptr;
cn_mainloop_fun cn_zls_mainloop_bulldozer_asm = nullptr; cn_mainloop_fun cn_zls_mainloop_bulldozer_asm = nullptr;
@ -128,30 +133,37 @@ static void patchCode(T dst, U src, const uint32_t iterations, const uint32_t ma
static void patchAsmVariants() static void patchAsmVariants()
{ {
const int allocation_size = 65536; const int allocation_size = 81920;
auto base = static_cast<uint8_t *>(VirtualMemory::allocateExecutableMemory(allocation_size)); auto base = static_cast<uint8_t *>(VirtualMemory::allocateExecutableMemory(allocation_size));
cn_half_mainloop_ivybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x0000); cn_half_mainloop_ivybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x00000);
cn_half_mainloop_ryzen_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x1000); cn_half_mainloop_ryzen_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x01000);
cn_half_mainloop_bulldozer_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x2000); cn_half_mainloop_bulldozer_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x02000);
cn_half_double_mainloop_sandybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x3000); cn_half_double_mainloop_sandybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x03000);
# ifdef XMRIG_ALGO_CN_PICO # ifdef XMRIG_ALGO_CN_PICO
cn_trtl_mainloop_ivybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x4000); cn_trtl_mainloop_ivybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x04000);
cn_trtl_mainloop_ryzen_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x5000); cn_trtl_mainloop_ryzen_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x05000);
cn_trtl_mainloop_bulldozer_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x6000); cn_trtl_mainloop_bulldozer_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x06000);
cn_trtl_double_mainloop_sandybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x7000); cn_trtl_double_mainloop_sandybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x07000);
# endif # endif
cn_zls_mainloop_ivybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x8000); # ifdef XMRIG_ALGO_CN_ULTRA
cn_zls_mainloop_ryzen_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x9000); cn_tlo_mainloop_ivybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x08000);
cn_zls_mainloop_bulldozer_asm = reinterpret_cast<cn_mainloop_fun> (base + 0xA000); cn_tlo_mainloop_ryzen_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x09000);
cn_zls_double_mainloop_sandybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0xB000); cn_tlo_mainloop_bulldozer_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x0A000);
cn_tlo_double_mainloop_sandybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x0B000);
# endif
cn_double_mainloop_ivybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0xC000); cn_zls_mainloop_ivybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x0C000);
cn_double_mainloop_ryzen_asm = reinterpret_cast<cn_mainloop_fun> (base + 0xD000); cn_zls_mainloop_ryzen_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x0D000);
cn_double_mainloop_bulldozer_asm = reinterpret_cast<cn_mainloop_fun> (base + 0xE000); cn_zls_mainloop_bulldozer_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x0E000);
cn_double_double_mainloop_sandybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0xF000); cn_zls_double_mainloop_sandybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x0F000);
cn_double_mainloop_ivybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x10000);
cn_double_mainloop_ryzen_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x11000);
cn_double_mainloop_bulldozer_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x12000);
cn_double_double_mainloop_sandybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x13000);
{ {
constexpr uint32_t ITER = CnAlgo<Algorithm::CN_HALF>().iterations(); constexpr uint32_t ITER = CnAlgo<Algorithm::CN_HALF>().iterations();
@ -172,15 +184,17 @@ static void patchAsmVariants()
patchCode(cn_trtl_mainloop_bulldozer_asm, cnv2_mainloop_bulldozer_asm, ITER, MASK); patchCode(cn_trtl_mainloop_bulldozer_asm, cnv2_mainloop_bulldozer_asm, ITER, MASK);
patchCode(cn_trtl_double_mainloop_sandybridge_asm, cnv2_double_mainloop_sandybridge_asm, ITER, MASK); patchCode(cn_trtl_double_mainloop_sandybridge_asm, cnv2_double_mainloop_sandybridge_asm, ITER, MASK);
} }
# endif
# ifdef XMRIG_ALGO_CN_ULTRA
{ {
constexpr uint32_t ITER = CnAlgo<Algorithm::CN_PICO_TLO>().iterations(); constexpr uint32_t ITER = CnAlgo<Algorithm::CN_ULTRA_0>().iterations();
constexpr uint32_t MASK = CnAlgo<Algorithm::CN_PICO_TLO>().mask(); constexpr uint32_t MASK = CnAlgo<Algorithm::CN_ULTRA_0>().mask();
patchCode(cn_trtl_mainloop_ivybridge_asm, cnv2_mainloop_ivybridge_asm, ITER, MASK); patchCode(cn_tlo_mainloop_ivybridge_asm, cnv2_mainloop_ivybridge_asm, ITER, MASK);
patchCode(cn_trtl_mainloop_ryzen_asm, cnv2_mainloop_ryzen_asm, ITER, MASK); patchCode(cn_tlo_mainloop_ryzen_asm, cnv2_mainloop_ryzen_asm, ITER, MASK);
patchCode(cn_trtl_mainloop_bulldozer_asm, cnv2_mainloop_bulldozer_asm, ITER, MASK); patchCode(cn_tlo_mainloop_bulldozer_asm, cnv2_mainloop_bulldozer_asm, ITER, MASK);
patchCode(cn_trtl_double_mainloop_sandybridge_asm, cnv2_double_mainloop_sandybridge_asm, ITER, MASK); patchCode(cn_tlo_double_mainloop_sandybridge_asm, cnv2_double_mainloop_sandybridge_asm, ITER, MASK);
} }
# endif # endif
@ -254,8 +268,11 @@ xmrig::CnHash::CnHash()
# ifdef XMRIG_ALGO_CN_PICO # ifdef XMRIG_ALGO_CN_PICO
ADD_FN(Algorithm::CN_PICO_0); ADD_FN(Algorithm::CN_PICO_0);
ADD_FN_ASM(Algorithm::CN_PICO_0); ADD_FN_ASM(Algorithm::CN_PICO_0);
ADD_FN(Algorithm::CN_PICO_TLO); # endif
ADD_FN_ASM(Algorithm::CN_PICO_TLO);
# ifdef XMRIG_ALGO_CN_ULTRA
ADD_FN(Algorithm::CN_ULTRA_0);
ADD_FN_ASM(Algorithm::CN_ULTRA_0);
# endif # endif
# ifdef XMRIG_ALGO_ARGON2 # ifdef XMRIG_ALGO_ARGON2

View file

@ -338,21 +338,20 @@ const static uint8_t test_output_pico_trtl[160] = {
0xA1, 0xE7, 0x53, 0x85, 0xFB, 0x72, 0xDD, 0x75, 0x90, 0x39, 0xB2, 0x3D, 0xC3, 0x08, 0x2C, 0xD5, 0xA1, 0xE7, 0x53, 0x85, 0xFB, 0x72, 0xDD, 0x75, 0x90, 0x39, 0xB2, 0x3D, 0xC3, 0x08, 0x2C, 0xD5,
0x01, 0x08, 0x27, 0x75, 0x86, 0xB9, 0xBB, 0x9B, 0xDF, 0xEA, 0x49, 0xDE, 0x46, 0xCB, 0x83, 0x45 0x01, 0x08, 0x27, 0x75, 0x86, 0xB9, 0xBB, 0x9B, 0xDF, 0xEA, 0x49, 0xDE, 0x46, 0xCB, 0x83, 0x45
}; };
#endif
#ifdef XMRIG_ALGO_CN_ULTRA
// FIXME: Needs working test code const static uint8_t test_output_ultra_tlo[160] = {
// "cn-pico/tlo" 0x99, 0x75, 0xF2, 0xC1, 0xB3, 0xB4, 0x54, 0x34, 0xA4, 0x93, 0x86, 0x21, 0x30, 0x97, 0xF3, 0x1B,
const static uint8_t test_output_pico_tlo[160] = { 0xB4, 0xB9, 0xA6, 0x58, 0x6A, 0x7E, 0x81, 0xF4, 0x42, 0x9F, 0x6D, 0x5F, 0x65, 0xC3, 0x8D, 0x1A,
0x08, 0xF4, 0x21, 0xD7, 0x83, 0x31, 0x17, 0x30, 0x0E, 0xDA, 0x66, 0xE9, 0x8F, 0x4A, 0x25, 0x69, 0xFC, 0x67, 0xDF, 0xCC, 0xB5, 0xFC, 0x90, 0xD7, 0x85, 0x5A, 0xE9, 0x03, 0x36, 0x1E, 0xAB, 0xD7,
0x09, 0x3D, 0xF3, 0x00, 0x50, 0x01, 0x73, 0x94, 0x4E, 0xFC, 0x40, 0x1E, 0x9A, 0x4A, 0x17, 0xAF, 0x6F, 0x1E, 0x40, 0xA2, 0x2A, 0x72, 0xAD, 0x3E, 0xF2, 0xD6, 0xAD, 0x27, 0xB5, 0xA6, 0x0C, 0xE5,
0xB2, 0x17, 0x2E, 0xC9, 0x46, 0x6E, 0x1A, 0xEE, 0x70, 0xEC, 0x85, 0x72, 0xA1, 0x4C, 0x23, 0x3E, 0x1C, 0xB1, 0x53, 0xE9, 0x70, 0x7D, 0x69, 0xF1, 0xE1, 0x55, 0x28, 0x45, 0xF5, 0x76, 0x56, 0xE5,
0xE3, 0x54, 0x58, 0x2B, 0xCB, 0x93, 0xF8, 0x69, 0xD4, 0x29, 0x74, 0x4D, 0xE5, 0x72, 0x6A, 0x26, 0x10, 0x0D, 0xEA, 0xFD, 0xD9, 0xD6, 0xAF, 0x0F, 0x47, 0x0C, 0x0D, 0xA2, 0x10, 0x16, 0x43, 0xEE,
0x4E, 0xFD, 0x28, 0xFC, 0xD3, 0x74, 0x8A, 0x83, 0xF3, 0xCA, 0x92, 0x84, 0xE7, 0x4E, 0x10, 0xC2, 0x25, 0x2C, 0x07, 0x3A, 0x64, 0x29, 0x16, 0xFF, 0xF5, 0xA5, 0x0B, 0xA2, 0xE0, 0xBD, 0xDC, 0xCE,
0x05, 0x62, 0xC7, 0xBE, 0x99, 0x73, 0xED, 0x90, 0xB5, 0x6F, 0xDA, 0x64, 0x71, 0x2D, 0x99, 0x39, 0x93, 0x3F, 0xEF, 0x6B, 0x08, 0xF4, 0x4D, 0x6A, 0x6E, 0x14, 0x13, 0x10, 0x98, 0x11, 0xE1, 0x13,
0x29, 0xDB, 0x22, 0x2B, 0x97, 0xB6, 0x37, 0x0E, 0x9A, 0x03, 0x65, 0xCC, 0xF7, 0xD0, 0x9A, 0xB7, 0xF6, 0x9D, 0x3D, 0x31, 0xC4, 0x3A, 0xA9, 0x44, 0x4C, 0x38, 0xAB, 0xB5, 0x4B, 0xD9, 0xFB, 0xE6,
0x68, 0xCE, 0x07, 0x3E, 0x15, 0x40, 0x3C, 0xCE, 0x8C, 0x63, 0x16, 0x72, 0xB5, 0x74, 0x84, 0xF4, 0x98, 0xB9, 0x46, 0xE2, 0x00, 0xEB, 0x56, 0x33, 0x1E, 0xBC, 0xEB, 0xF1, 0xF6, 0x88, 0xD3, 0xF0
0xA1, 0xE7, 0x53, 0x85, 0xFB, 0x72, 0xDD, 0x75, 0x90, 0x39, 0xB2, 0x3D, 0xC3, 0x08, 0x2C, 0xD5,
0x01, 0x08, 0x27, 0x75, 0x86, 0xB9, 0xBB, 0x9B, 0xDF, 0xEA, 0x49, 0xDE, 0x46, 0xCB, 0x83, 0x45
}; };
#endif #endif

View file

@ -868,7 +868,7 @@ inline void cryptonight_single_hash_asm(const uint8_t *__restrict__ input, size_
} }
} }
# ifdef XMRIG_ALGO_CN_PICO # ifdef XMRIG_ALGO_CN_PICO
else if (ALGO == Algorithm::CN_PICO_0 || ALGO == Algorithm::CN_PICO_TLO) { else if (ALGO == Algorithm::CN_PICO_0) {
if (ASM == Assembly::INTEL) { if (ASM == Assembly::INTEL) {
cn_trtl_mainloop_ivybridge_asm(ctx); cn_trtl_mainloop_ivybridge_asm(ctx);
} }
@ -879,6 +879,19 @@ inline void cryptonight_single_hash_asm(const uint8_t *__restrict__ input, size_
cn_trtl_mainloop_bulldozer_asm(ctx); cn_trtl_mainloop_bulldozer_asm(ctx);
} }
} }
# endif
# ifdef XMRIG_ALGO_CN_ULTRA
else if (ALGO == Algorithm::CN_ULTRA_0) {
if (ASM == Assembly::INTEL) {
cn_tlo_mainloop_ivybridge_asm(ctx);
}
else if (ASM == Assembly::RYZEN) {
cn_tlo_mainloop_ryzen_asm(ctx);
}
else {
cn_tlo_mainloop_bulldozer_asm(ctx);
}
}
# endif # endif
else if (ALGO == Algorithm::CN_RWZ) { else if (ALGO == Algorithm::CN_RWZ) {
cnv2_rwz_mainloop_asm(ctx); cnv2_rwz_mainloop_asm(ctx);
@ -941,9 +954,14 @@ inline void cryptonight_double_hash_asm(const uint8_t *__restrict__ input, size_
cn_half_double_mainloop_sandybridge_asm(ctx); cn_half_double_mainloop_sandybridge_asm(ctx);
} }
# ifdef XMRIG_ALGO_CN_PICO # ifdef XMRIG_ALGO_CN_PICO
else if (ALGO == Algorithm::CN_PICO_0 || ALGO == Algorithm::CN_PICO_TLO) { else if (ALGO == Algorithm::CN_PICO_0) {
cn_trtl_double_mainloop_sandybridge_asm(ctx); cn_trtl_double_mainloop_sandybridge_asm(ctx);
} }
# endif
# ifdef XMRIG_ALGO_CN_ULTRA
else if (ALGO == Algorithm::CN_ULTRA_0) {
cn_tlo_double_mainloop_sandybridge_asm(ctx);
}
# endif # endif
else if (ALGO == Algorithm::CN_RWZ) { else if (ALGO == Algorithm::CN_RWZ) {
cnv2_rwz_double_mainloop_asm(ctx); cnv2_rwz_double_mainloop_asm(ctx);

View file

@ -101,9 +101,13 @@ static AlgoName const algorithm_names[] = {
{ "cryptonight-turtle", "cn-trtl", Algorithm::CN_PICO_0 }, { "cryptonight-turtle", "cn-trtl", Algorithm::CN_PICO_0 },
{ "cryptonight-ultralite", "cn-ultralite", Algorithm::CN_PICO_0 }, { "cryptonight-ultralite", "cn-ultralite", Algorithm::CN_PICO_0 },
{ "cryptonight_turtle", "cn_turtle", Algorithm::CN_PICO_0 }, { "cryptonight_turtle", "cn_turtle", Algorithm::CN_PICO_0 },
{ "cryptonight-pico/tlo", "cn-pico/tlo", Algorithm::CN_PICO_TLO }, # endif
{ "cryptonight-talleo", "cn-talleo", Algorithm::CN_PICO_TLO }, # ifdef XMRIG_ALGO_CN_ULTRA
{ "cryptonight_talleo", "cn_talleo", Algorithm::CN_PICO_TLO }, { "cryptonight-ultra", "cn-ultra", Algorithm::CN_ULTRA_0 },
{ "cryptonight-ultra/tlo", "cn-ultra/tlo", Algorithm::CN_ULTRA_0 },
{ "cryptonight-talleo", "cn-talleo", Algorithm::CN_ULTRA_0 },
{ "cryptonight_talleo", "cn_talleo", Algorithm::CN_ULTRA_0 },
{ "cryptonight/ultra", "cn/ultra", Algorithm::CN_ULTRA_0 },
# endif # endif
# ifdef XMRIG_ALGO_RANDOMX # ifdef XMRIG_ALGO_RANDOMX
{ "randomx/0", "rx/0", Algorithm::RX_0 }, { "randomx/0", "rx/0", Algorithm::RX_0 },
@ -275,10 +279,14 @@ xmrig::Algorithm::Family xmrig::Algorithm::family(Id id)
# ifdef XMRIG_ALGO_CN_PICO # ifdef XMRIG_ALGO_CN_PICO
case CN_PICO_0: case CN_PICO_0:
case CN_PICO_TLO:
return CN_PICO; return CN_PICO;
# endif # endif
# ifdef XMRIG_ALGO_CN_ULTRA
case CN_ULTRA_0:
return CN_ULTRA;
# endif
# ifdef XMRIG_ALGO_RANDOMX # ifdef XMRIG_ALGO_RANDOMX
case RX_0: case RX_0:
case RX_WOW: case RX_WOW:

View file

@ -63,7 +63,7 @@ public:
CN_HEAVY_TUBE, // "cn-heavy/tube" CryptoNight-Heavy (modified, TUBE only). CN_HEAVY_TUBE, // "cn-heavy/tube" CryptoNight-Heavy (modified, TUBE only).
CN_HEAVY_XHV, // "cn-heavy/xhv" CryptoNight-Heavy (modified, Haven Protocol only). CN_HEAVY_XHV, // "cn-heavy/xhv" CryptoNight-Heavy (modified, Haven Protocol only).
CN_PICO_0, // "cn-pico" CryptoNight Turtle (TRTL) CN_PICO_0, // "cn-pico" CryptoNight Turtle (TRTL)
CN_PICO_TLO, // "cn-pico/tlo" CryptoNight Talleo (TLO) CN_ULTRA_0, // "cn-ultra" CryptoNight Talleo (TLO)
RX_0, // "rx/0" RandomX (reference configuration). RX_0, // "rx/0" RandomX (reference configuration).
RX_WOW, // "rx/wow" RandomWOW (Wownero). RX_WOW, // "rx/wow" RandomWOW (Wownero).
RX_LOKI, // "rx/loki" RandomXL (Loki). RX_LOKI, // "rx/loki" RandomXL (Loki).
@ -81,6 +81,7 @@ public:
CN_LITE, CN_LITE,
CN_HEAVY, CN_HEAVY,
CN_PICO, CN_PICO,
CN_ULTRA,
RANDOM_X, RANDOM_X,
ARGON2 ARGON2
}; };
@ -89,7 +90,7 @@ public:
inline Algorithm(const char *algo) : m_id(parse(algo)) {} inline Algorithm(const char *algo) : m_id(parse(algo)) {}
inline Algorithm(Id id) : m_id(id) {} inline Algorithm(Id id) : m_id(id) {}
inline bool isCN() const { auto f = family(); return f == CN || f == CN_LITE || f == CN_HEAVY || f == CN_PICO; } inline bool isCN() const { auto f = family(); return f == CN || f == CN_LITE || f == CN_HEAVY || f == CN_PICO || f == CN_ULTRA; }
inline bool isEqual(const Algorithm &other) const { return m_id == other.m_id; } inline bool isEqual(const Algorithm &other) const { return m_id == other.m_id; }
inline bool isValid() const { return m_id != INVALID; } inline bool isValid() const { return m_id != INVALID; }
inline const char *name() const { return name(false); } inline const char *name() const { return name(false); }