diff --git a/src/backend/cpu/CpuConfig_gen.h b/src/backend/cpu/CpuConfig_gen.h index a7319eea..1b3ac5be 100644 --- a/src/backend/cpu/CpuConfig_gen.h +++ b/src/backend/cpu/CpuConfig_gen.h @@ -99,7 +99,8 @@ size_t inline generate(Threads &threads, uint32 template<> size_t inline generate(Threads &threads, uint32_t limit) { - return generate("cn-pico", threads, Algorithm::CN_PICO_0, limit); + return generate("cn-pico", threads, Algorithm::CN_PICO_0, limit) && + generate("cn-pico/tlo", threads, Algorithm::CN_PICO_TLO, limit); } #endif diff --git a/src/backend/cpu/CpuWorker.cpp b/src/backend/cpu/CpuWorker.cpp index f93f7dac..0403d9c5 100644 --- a/src/backend/cpu/CpuWorker.cpp +++ b/src/backend/cpu/CpuWorker.cpp @@ -154,7 +154,8 @@ bool xmrig::CpuWorker::selfTest() # ifdef XMRIG_ALGO_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 diff --git a/src/backend/cpu/platform/AdvancedCpuInfo.cpp b/src/backend/cpu/platform/AdvancedCpuInfo.cpp index 20496ff1..caab150e 100644 --- a/src/backend/cpu/platform/AdvancedCpuInfo.cpp +++ b/src/backend/cpu/platform/AdvancedCpuInfo.cpp @@ -195,7 +195,7 @@ xmrig::CpuThreads xmrig::AdvancedCpuInfo::threads(const Algorithm &algorithm, ui uint32_t intensity = algorithm.maxIntensity() == 1 ? 0 : 1; # ifdef XMRIG_ALGO_CN_PICO - if (algorithm == Algorithm::CN_PICO_0 && (count / cores()) >= 2) { + if ((algorithm == Algorithm::CN_PICO_0 || algorithm == Algorithm::CN_PICO_TLO) && (count / cores()) >= 2) { intensity = 2; } # endif diff --git a/src/backend/cpu/platform/HwlocCpuInfo.cpp b/src/backend/cpu/platform/HwlocCpuInfo.cpp index a66bf9fd..1cc7b1b0 100644 --- a/src/backend/cpu/platform/HwlocCpuInfo.cpp +++ b/src/backend/cpu/platform/HwlocCpuInfo.cpp @@ -307,7 +307,7 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith size_t cacheHashes = ((L3 + extra) + (scratchpad / 2)) / scratchpad; # ifdef XMRIG_ALGO_CN_PICO - if (algorithm == Algorithm::CN_PICO_0 && (cacheHashes / PUs) >= 2) { + if ((algorithm == Algorithm::CN_PICO_0 || algorithm == Algorithm::CN_PICO_TLO) && (cacheHashes / PUs) >= 2) { intensity = 2; } # endif diff --git a/src/backend/cuda/CudaConfig_gen.h b/src/backend/cuda/CudaConfig_gen.h index 87e35dc4..87458de3 100644 --- a/src/backend/cuda/CudaConfig_gen.h +++ b/src/backend/cuda/CudaConfig_gen.h @@ -101,7 +101,8 @@ size_t inline generate(Threads &threads, const template<> size_t inline generate(Threads &threads, const std::vector &devices) { - return generate("cn-pico", threads, Algorithm::CN_PICO_0, devices); + return generate("cn-pico", threads, Algorithm::CN_PICO_0, devices) && + generate("cn-pico/tlo", threads, Algorithm::CN_PICO_TLO, devices); } #endif diff --git a/src/backend/opencl/OclConfig_gen.h b/src/backend/opencl/OclConfig_gen.h index 1c8a6a43..55e85b96 100644 --- a/src/backend/opencl/OclConfig_gen.h +++ b/src/backend/opencl/OclConfig_gen.h @@ -100,7 +100,8 @@ size_t inline generate(Threads &threads, const template<> size_t inline generate(Threads &threads, const std::vector &devices) { - return generate("cn-pico", threads, Algorithm::CN_PICO_0, devices); + return generate("cn-pico", threads, Algorithm::CN_PICO_0, devices) && + generate("cn-pico/tlo", threads, Algorithm::CN_PICO_TLO, devices); } #endif diff --git a/src/backend/opencl/cl/cn/algorithm.cl b/src/backend/opencl/cl/cn/algorithm.cl index 4f33a680..7677f4e0 100644 --- a/src/backend/opencl/cl/cn/algorithm.cl +++ b/src/backend/opencl/cl/cn/algorithm.cl @@ -16,14 +16,15 @@ #define ALGO_CN_HEAVY_TUBE 15 #define ALGO_CN_HEAVY_XHV 16 #define ALGO_CN_PICO_0 17 -#define ALGO_RX_0 18 -#define ALGO_RX_WOW 19 -#define ALGO_RX_LOKI 20 -#define ALGO_RX_ARQMA 21 -#define ALGO_RX_SFX 22 -#define ALGO_RX_V 23 -#define ALGO_AR2_CHUKWA 24 -#define ALGO_AR2_WRKZ 25 +#define ALGO_CN_PICO_TLO 18 +#define ALGO_RX_0 19 +#define ALGO_RX_WOW 20 +#define ALGO_RX_LOKI 21 +#define ALGO_RX_ARQMA 22 +#define ALGO_RX_SFX 23 +#define ALGO_RX_V 24 +#define ALGO_AR2_CHUKWA 25 +#define ALGO_AR2_WRKZ 26 #define FAMILY_UNKNOWN 0 #define FAMILY_CN 1 diff --git a/src/crypto/cn/CnAlgo.h b/src/crypto/cn/CnAlgo.h index b6a76089..68976f77 100644 --- a/src/crypto/cn/CnAlgo.h +++ b/src/crypto/cn/CnAlgo.h @@ -111,6 +111,7 @@ public: # ifdef XMRIG_ALGO_CN_PICO case Algorithm::CN_PICO_0: + case Algorithm::CN_PICO_TLO: return CN_ITER / 8; # endif @@ -132,6 +133,8 @@ public: # ifdef XMRIG_ALGO_CN_PICO if (algo == Algorithm::CN_PICO_0) { return 0x1FFF0; + } else if (algo == Algorithm::CN_PICO_TLO) { + return 0x3FFF0; } # endif @@ -171,6 +174,7 @@ public: case Algorithm::CN_DOUBLE: # ifdef XMRIG_ALGO_CN_PICO case Algorithm::CN_PICO_0: + case Algorithm::CN_PICO_TLO: # endif return Algorithm::CN_2; @@ -217,6 +221,7 @@ template<> constexpr inline uint32_t CnAlgo::iterations() con template<> constexpr inline uint32_t CnAlgo::iterations() const { return 0x60000; } template<> constexpr inline uint32_t CnAlgo::iterations() const { return 0xC000; } template<> constexpr inline uint32_t CnAlgo::iterations() const { return CN_ITER / 8; } +template<> constexpr inline uint32_t CnAlgo::iterations() const { return CN_ITER / 8; } template<> constexpr inline size_t CnAlgo::memory() const { return CN_MEMORY / 2; } @@ -225,10 +230,12 @@ template<> constexpr inline size_t CnAlgo::memory() const template<> constexpr inline size_t CnAlgo::memory() const { return CN_MEMORY * 2; } template<> constexpr inline size_t CnAlgo::memory() const { return CN_MEMORY * 2; } template<> constexpr inline size_t CnAlgo::memory() const { return CN_MEMORY / 8; } +template<> constexpr inline size_t CnAlgo::memory() const { return CN_MEMORY / 8; } template<> constexpr inline uint32_t CnAlgo::mask() const { return 0x1FFFC0; } template<> constexpr inline uint32_t CnAlgo::mask() const { return 0x1FFF0; } +template<> constexpr inline uint32_t CnAlgo::mask() const { return 0x3FFF0; } } /* namespace xmrig */ diff --git a/src/crypto/cn/CnHash.cpp b/src/crypto/cn/CnHash.cpp index c6fe944e..2a5cb5db 100644 --- a/src/crypto/cn/CnHash.cpp +++ b/src/crypto/cn/CnHash.cpp @@ -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_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_ryzen_asm = nullptr; cn_mainloop_fun cn_zls_mainloop_bulldozer_asm = nullptr; @@ -141,6 +146,11 @@ static void patchAsmVariants() cn_trtl_mainloop_ryzen_asm = reinterpret_cast (base + 0x5000); cn_trtl_mainloop_bulldozer_asm = reinterpret_cast (base + 0x6000); cn_trtl_double_mainloop_sandybridge_asm = reinterpret_cast (base + 0x7000); + + cn_tlo_mainloop_ivybridge_asm = reinterpret_cast (base + 0x4000); + cn_tlo_mainloop_ryzen_asm = reinterpret_cast (base + 0x5000); + cn_tlo_mainloop_bulldozer_asm = reinterpret_cast (base + 0x6000); + cn_tlo_double_mainloop_sandybridge_asm = reinterpret_cast (base + 0x7000); # endif cn_zls_mainloop_ivybridge_asm = reinterpret_cast (base + 0x8000); @@ -172,6 +182,16 @@ static void patchAsmVariants() 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); } + + { + constexpr uint32_t ITER = CnAlgo().iterations(); + constexpr uint32_t MASK = CnAlgo().mask(); + + patchCode(cn_tlo_mainloop_ivybridge_asm, cnv2_mainloop_ivybridge_asm, ITER, MASK); + patchCode(cn_tlo_mainloop_ryzen_asm, cnv2_mainloop_ryzen_asm, ITER, MASK); + patchCode(cn_tlo_mainloop_bulldozer_asm, cnv2_mainloop_bulldozer_asm, ITER, MASK); + patchCode(cn_tlo_double_mainloop_sandybridge_asm, cnv2_double_mainloop_sandybridge_asm, ITER, MASK); + } # endif { @@ -244,6 +264,8 @@ xmrig::CnHash::CnHash() # ifdef XMRIG_ALGO_CN_PICO ADD_FN(Algorithm::CN_PICO_0); ADD_FN_ASM(Algorithm::CN_PICO_0); + ADD_FN(Algorithm::CN_PICO_TLO); + ADD_FN_ASM(Algorithm::CN_PICO_TLO); # endif # ifdef XMRIG_ALGO_ARGON2 diff --git a/src/crypto/cn/CryptoNight_test.h b/src/crypto/cn/CryptoNight_test.h index 64489570..e492553a 100644 --- a/src/crypto/cn/CryptoNight_test.h +++ b/src/crypto/cn/CryptoNight_test.h @@ -338,6 +338,22 @@ 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, 0x01, 0x08, 0x27, 0x75, 0x86, 0xB9, 0xBB, 0x9B, 0xDF, 0xEA, 0x49, 0xDE, 0x46, 0xCB, 0x83, 0x45 }; + + +// FIXME: Needs working test code +// "cn-pico/tlo" +const static uint8_t test_output_pico_tlo[160] = { + 0x08, 0xF4, 0x21, 0xD7, 0x83, 0x31, 0x17, 0x30, 0x0E, 0xDA, 0x66, 0xE9, 0x8F, 0x4A, 0x25, 0x69, + 0x09, 0x3D, 0xF3, 0x00, 0x50, 0x01, 0x73, 0x94, 0x4E, 0xFC, 0x40, 0x1E, 0x9A, 0x4A, 0x17, 0xAF, + 0xB2, 0x17, 0x2E, 0xC9, 0x46, 0x6E, 0x1A, 0xEE, 0x70, 0xEC, 0x85, 0x72, 0xA1, 0x4C, 0x23, 0x3E, + 0xE3, 0x54, 0x58, 0x2B, 0xCB, 0x93, 0xF8, 0x69, 0xD4, 0x29, 0x74, 0x4D, 0xE5, 0x72, 0x6A, 0x26, + 0x4E, 0xFD, 0x28, 0xFC, 0xD3, 0x74, 0x8A, 0x83, 0xF3, 0xCA, 0x92, 0x84, 0xE7, 0x4E, 0x10, 0xC2, + 0x05, 0x62, 0xC7, 0xBE, 0x99, 0x73, 0xED, 0x90, 0xB5, 0x6F, 0xDA, 0x64, 0x71, 0x2D, 0x99, 0x39, + 0x29, 0xDB, 0x22, 0x2B, 0x97, 0xB6, 0x37, 0x0E, 0x9A, 0x03, 0x65, 0xCC, 0xF7, 0xD0, 0x9A, 0xB7, + 0x68, 0xCE, 0x07, 0x3E, 0x15, 0x40, 0x3C, 0xCE, 0x8C, 0x63, 0x16, 0x72, 0xB5, 0x74, 0x84, 0xF4, + 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 diff --git a/src/crypto/cn/CryptoNight_x86.h b/src/crypto/cn/CryptoNight_x86.h index 9fb606d4..b63c3292 100644 --- a/src/crypto/cn/CryptoNight_x86.h +++ b/src/crypto/cn/CryptoNight_x86.h @@ -794,6 +794,11 @@ extern cn_mainloop_fun cn_trtl_mainloop_ryzen_asm; extern cn_mainloop_fun cn_trtl_mainloop_bulldozer_asm; extern cn_mainloop_fun cn_trtl_double_mainloop_sandybridge_asm; +extern cn_mainloop_fun cn_tlo_mainloop_ivybridge_asm; +extern cn_mainloop_fun cn_tlo_mainloop_ryzen_asm; +extern cn_mainloop_fun cn_tlo_mainloop_bulldozer_asm; +extern cn_mainloop_fun cn_tlo_double_mainloop_sandybridge_asm; + extern cn_mainloop_fun cn_zls_mainloop_ivybridge_asm; extern cn_mainloop_fun cn_zls_mainloop_ryzen_asm; extern cn_mainloop_fun cn_zls_mainloop_bulldozer_asm; @@ -879,6 +884,17 @@ inline void cryptonight_single_hash_asm(const uint8_t *__restrict__ input, size_ cn_trtl_mainloop_bulldozer_asm(ctx); } } + else if (ALGO == Algorithm::CN_PICO_TLO) { + 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 else if (ALGO == Algorithm::CN_RWZ) { cnv2_rwz_mainloop_asm(ctx); @@ -944,6 +960,9 @@ inline void cryptonight_double_hash_asm(const uint8_t *__restrict__ input, size_ else if (ALGO == Algorithm::CN_PICO_0) { cn_trtl_double_mainloop_sandybridge_asm(ctx); } + else if (ALGO == Algorithm::CN_PICO_TLO) { + cn_tlo_double_mainloop_sandybridge_asm(ctx); + } # endif else if (ALGO == Algorithm::CN_RWZ) { cnv2_rwz_double_mainloop_asm(ctx); diff --git a/src/crypto/common/Algorithm.cpp b/src/crypto/common/Algorithm.cpp index a725890f..11981873 100644 --- a/src/crypto/common/Algorithm.cpp +++ b/src/crypto/common/Algorithm.cpp @@ -101,6 +101,9 @@ static AlgoName const algorithm_names[] = { { "cryptonight-turtle", "cn-trtl", Algorithm::CN_PICO_0 }, { "cryptonight-ultralite", "cn-ultralite", Algorithm::CN_PICO_0 }, { "cryptonight_turtle", "cn_turtle", Algorithm::CN_PICO_0 }, + { "cryptonight-pico/tlo", "cn-pico/tlo", Algorithm::CN_PICO_TLO }, + { "cryptonight-talleo", "cn-talleo", Algorithm::CN_PICO_TLO }, + { "cryptonight_talleo", "cn_talleo", Algorithm::CN_PICO_TLO }, # endif # ifdef XMRIG_ALGO_RANDOMX { "randomx/0", "rx/0", Algorithm::RX_0 }, @@ -272,6 +275,7 @@ xmrig::Algorithm::Family xmrig::Algorithm::family(Id id) # ifdef XMRIG_ALGO_CN_PICO case CN_PICO_0: + case CN_PICO_TLO: return CN_PICO; # endif diff --git a/src/crypto/common/Algorithm.h b/src/crypto/common/Algorithm.h index c72b4e6a..b0594f55 100644 --- a/src/crypto/common/Algorithm.h +++ b/src/crypto/common/Algorithm.h @@ -63,6 +63,7 @@ public: CN_HEAVY_TUBE, // "cn-heavy/tube" CryptoNight-Heavy (modified, TUBE only). CN_HEAVY_XHV, // "cn-heavy/xhv" CryptoNight-Heavy (modified, Haven Protocol only). CN_PICO_0, // "cn-pico" CryptoNight Turtle (TRTL) + CN_PICO_TLO, // "cn-pico/tlo" CryptoNight Talleo (TLO) RX_0, // "rx/0" RandomX (reference configuration). RX_WOW, // "rx/wow" RandomWOW (Wownero). RX_LOKI, // "rx/loki" RandomXL (Loki).