Skip to content

Commit

Permalink
Add "rx/yada" algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
pdxwebdev committed Dec 10, 2021
1 parent 5b8501f commit 3f0c5a9
Show file tree
Hide file tree
Showing 22 changed files with 3,813 additions and 3,659 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v6.17.0
- [#2411](https://github.com/xmrig/xmrig/pull/2411) Added support for Yada (`rx/yada` algorithm).

# v6.16.2
- [#2751](https://github.com/xmrig/xmrig/pull/2751) Fixed crash on CPUs supporting VAES and running GCC-compiled xmrig.
- [#2761](https://github.com/xmrig/xmrig/pull/2761) Fixed broken auto-tuning in GCC Windows build.
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option(WITH_CN_HEAVY "Enable CryptoNight-Heavy algorithms family" ON)
option(WITH_CN_PICO "Enable CryptoNight-Pico algorithm" ON)
option(WITH_CN_FEMTO "Enable CryptoNight-UPX2 algorithm" ON)
option(WITH_RANDOMX "Enable RandomX algorithms family" ON)
option(WITH_RX_YADA "Enable RandomX YADA algorithm (requires RandomX)" ON)
option(WITH_ARGON2 "Enable Argon2 algorithms family" ON)
option(WITH_ASTROBWT "Enable AstroBWT algorithms family" ON)
option(WITH_KAWPOW "Enable KawPow algorithms family" ON)
Expand Down
16 changes: 16 additions & 0 deletions cmake/randomx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ if (WITH_RANDOMX)
src/crypto/rx/RxVm.cpp
)

if (WITH_RX_YADA)
add_definitions(/DXMRIG_ALGO_RX_YADA)
message("-- WITH_RX_YADA=ON (YADACoin algorithm)")
else()
remove_definitions(/DXMRIG_ALGO_RX_YADA)
message("-- WITH_RX_YADA=OFF (YADACoin algorithm)")
endif()

if (WITH_ASM AND CMAKE_C_COMPILER_ID MATCHES MSVC)
enable_language(ASM_MASM)
list(APPEND SOURCES_CRYPTO
Expand Down Expand Up @@ -137,4 +145,12 @@ if (WITH_RANDOMX)
endif()
else()
remove_definitions(/DXMRIG_ALGO_RANDOMX)
if (WITH_RX_YADA)
message("-- WITH_RANDOMX=OFF but WITH_RX_YADA=ON... forcing OFF")
set(WITH_RX_YADA OFF)
endif()
# intentionally not an `else` in case above negated it
if (NOT WITH_RX_YADA)
remove_definitions(/DXMRIG_ALGO_RX_YADA)
endif()
endif()
1 change: 1 addition & 0 deletions doc/ALGORITHMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Option `coin` useful for pools without [algorithm negotiation](https://xmrig.com

| Name | Memory | Version | Description | Notes |
|------|--------|---------|-------------|-------|
| `rx/yada` | 2 MB | 6.17.0+ | RandomYADA (RandomX variant for Yada). | |
| `kawpow` | - | 6.0.0+ | KawPow (Ravencoin) | GPU only |
| `rx/keva` | 1 MB | 5.9.0+ | RandomKEVA (RandomX variant for Keva). | |
| `astrobwt` | 20 MB | 5.8.0+ | AstroBWT (Dero). | |
Expand Down
1 change: 1 addition & 0 deletions scripts/generate_cl.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function rx()
'randomx_constants_arqma.h',
'randomx_constants_keva.h',
'randomx_constants_graft.h',
'randomx_constants_yada.h',
'aes.cl',
'blake2b.cl',
'randomx_vm.cl',
Expand Down
7 changes: 7 additions & 0 deletions src/backend/cpu/CpuConfig_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<CpuThreads> &threads, uint32
count += threads.move(Algorithm::kRX_WOW, std::move(wow));
}

# ifdef XMRIG_ALGO_RX_YADA
if (!threads.isExist(Algorithm::RX_YADA)) {
auto yada = cpuInfo->threads(Algorithm::RX_YADA, limit);
count += threads.move(Algorithm::kRX_YADA, std::move(yada));
}
# endif

count += generate(Algorithm::kRX, threads, Algorithm::RX_0, limit);

return count;
Expand Down
9 changes: 9 additions & 0 deletions src/backend/cuda/CudaConfig_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<CudaThreads> &threads, const
auto wow = CudaThreads(devices, Algorithm::RX_WOW);
auto arq = CudaThreads(devices, Algorithm::RX_ARQ);
auto kva = CudaThreads(devices, Algorithm::RX_KEVA);
# ifdef XMRIG_ALGO_RX_YADA
auto yda = CudaThreads(devices, Algorithm::RX_YADA);
# endif

if (!threads.isExist(Algorithm::RX_WOW) && wow != rx) {
count += threads.move(Algorithm::kRX_WOW, std::move(wow));
Expand All @@ -128,6 +131,12 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<CudaThreads> &threads, const
count += threads.move(Algorithm::kRX_KEVA, std::move(kva));
}

# ifdef XMRIG_ALGO_RX_YADA
if (!threads.isExist(Algorithm::RX_YADA) && yda != rx) {
count += threads.move(Algorithm::kRX_YADA, std::move(yda));
}
# endif

count += threads.move(Algorithm::kRX, std::move(rx));

return count;
Expand Down
9 changes: 9 additions & 0 deletions src/backend/opencl/OclConfig_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<OclThreads> &threads, const
auto rx = OclThreads(devices, Algorithm::RX_0);
auto wow = OclThreads(devices, Algorithm::RX_WOW);
auto arq = OclThreads(devices, Algorithm::RX_ARQ);
# ifdef XMRIG_ALGO_RX_YADA
auto yda = OclThreads(devices, Algorithm::RX_YADA);
# endif

if (!threads.isExist(Algorithm::RX_WOW) && wow != rx) {
count += threads.move(Algorithm::kRX_WOW, std::move(wow));
Expand All @@ -122,6 +125,12 @@ size_t inline generate<Algorithm::RANDOM_X>(Threads<OclThreads> &threads, const
count += threads.move(Algorithm::kRX_ARQ, std::move(arq));
}

# ifdef XMRIG_ALGO_RX_YADA
if (!threads.isExist(Algorithm::RX_YADA) && yda != rx) {
count += threads.move(Algorithm::kRX_YADA, std::move(yda));
}
# endif

count += threads.move(Algorithm::kRX, std::move(rx));

return count;
Expand Down
1 change: 1 addition & 0 deletions src/backend/opencl/cl/cn/algorithm.cl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#define ALGO_RX_SFX 0x72151273
#define ALGO_RX_KEVA 0x7214116b
#define ALGO_RX_GRAFT 0x72151267
#define ALGO_RX_YADA 0x72151279
#define ALGO_AR2_CHUKWA 0x61130000
#define ALGO_AR2_CHUKWA_V2 0x61140000
#define ALGO_AR2_WRKZ 0x61120000
Expand Down
5 changes: 3 additions & 2 deletions src/backend/opencl/cl/cn/cryptonight_cl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace xmrig {

static const char cryptonight_cl[61520] = {
static const char cryptonight_cl[61552] = {
0x23,0x69,0x66,0x64,0x65,0x66,0x20,0x53,0x54,0x41,0x54,0x49,0x43,0x0a,0x23,0x75,0x6e,0x64,0x65,0x66,0x20,0x53,0x54,0x41,0x54,0x49,0x43,0x0a,0x23,0x65,0x6e,0x64,
0x69,0x66,0x0a,0x23,0x69,0x66,0x64,0x65,0x66,0x20,0x63,0x6c,0x5f,0x61,0x6d,0x64,0x5f,0x6d,0x65,0x64,0x69,0x61,0x5f,0x6f,0x70,0x73,0x0a,0x23,0x64,0x65,0x66,0x69,
0x6e,0x65,0x20,0x53,0x54,0x41,0x54,0x49,0x43,0x20,0x73,0x74,0x61,0x74,0x69,0x63,0x0a,0x23,0x65,0x6c,0x73,0x65,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x53,
Expand Down Expand Up @@ -36,7 +36,8 @@ static const char cryptonight_cl[61520] = {
0x31,0x32,0x31,0x30,0x36,0x31,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x41,0x4c,0x47,0x4f,0x5f,0x52,0x58,0x5f,0x53,0x46,0x58,0x20,0x30,0x78,0x37,0x32,0x31,
0x35,0x31,0x32,0x37,0x33,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x41,0x4c,0x47,0x4f,0x5f,0x52,0x58,0x5f,0x4b,0x45,0x56,0x41,0x20,0x30,0x78,0x37,0x32,0x31,
0x34,0x31,0x31,0x36,0x62,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x41,0x4c,0x47,0x4f,0x5f,0x52,0x58,0x5f,0x47,0x52,0x41,0x46,0x54,0x20,0x30,0x78,0x37,0x32,
0x31,0x35,0x31,0x32,0x36,0x37,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x41,0x4c,0x47,0x4f,0x5f,0x41,0x52,0x32,0x5f,0x43,0x48,0x55,0x4b,0x57,0x41,0x20,0x30,
0x31,0x35,0x31,0x32,0x36,0x37,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x41,0x4c,0x47,0x4f,0x5f,0x52,0x58,0x5f,0x59,0x41,0x44,0x41,0x20,0x30,0x78,0x37,0x32,
0x31,0x35,0x31,0x32,0x37,0x39,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x41,0x4c,0x47,0x4f,0x5f,0x41,0x52,0x32,0x5f,0x43,0x48,0x55,0x4b,0x57,0x41,0x20,0x30,
0x78,0x36,0x31,0x31,0x33,0x30,0x30,0x30,0x30,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x41,0x4c,0x47,0x4f,0x5f,0x41,0x52,0x32,0x5f,0x43,0x48,0x55,0x4b,0x57,
0x41,0x5f,0x56,0x32,0x20,0x30,0x78,0x36,0x31,0x31,0x34,0x30,0x30,0x30,0x30,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x41,0x4c,0x47,0x4f,0x5f,0x41,0x52,0x32,
0x5f,0x57,0x52,0x4b,0x5a,0x20,0x30,0x78,0x36,0x31,0x31,0x32,0x30,0x30,0x30,0x30,0x0a,0x23,0x64,0x65,0x66,0x69,0x6e,0x65,0x20,0x41,0x4c,0x47,0x4f,0x5f,0x41,0x53,
Expand Down
2 changes: 2 additions & 0 deletions src/backend/opencl/cl/rx/randomx.cl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "randomx_constants_keva.h"
#elif (ALGO == ALGO_RX_GRAFT)
#include "randomx_constants_graft.h"
#elif (ALGO == ALGO_RX_YADA)
#include "randomx_constants_yada.h"
#endif

#include "aes.cl"
Expand Down
Loading

0 comments on commit 3f0c5a9

Please sign in to comment.