Added RandomX-Graft

This commit is contained in:
Ilya Kitaev 2021-07-22 21:46:33 +03:00
parent 02b2b87bb6
commit f8f90861f4
12 changed files with 5950 additions and 5774 deletions

View file

@ -51,6 +51,7 @@ function rx()
'randomx_constants_wow.h', 'randomx_constants_wow.h',
'randomx_constants_arqma.h', 'randomx_constants_arqma.h',
'randomx_constants_keva.h', 'randomx_constants_keva.h',
'randomx_constants_graft.h',
'aes.cl', 'aes.cl',
'blake2b.cl', 'blake2b.cl',
'randomx_vm.cl', 'randomx_vm.cl',

View file

@ -23,11 +23,12 @@
#define ALGO_RX_ARQMA 22 #define ALGO_RX_ARQMA 22
#define ALGO_RX_SFX 23 #define ALGO_RX_SFX 23
#define ALGO_RX_KEVA 24 #define ALGO_RX_KEVA 24
#define ALGO_AR2_CHUKWA 25 #define ALGO_RX_GRAFT 25
#define ALGO_AR2_CHUKWA_V2 26 #define ALGO_AR2_CHUKWA 26
#define ALGO_AR2_WRKZ 27 #define ALGO_AR2_CHUKWA_V2 27
#define ALGO_ASTROBWT_DERO 28 #define ALGO_AR2_WRKZ 28
#define ALGO_KAWPOW_RVN 29 #define ALGO_ASTROBWT_DERO 29
#define ALGO_KAWPOW_RVN 30
#define FAMILY_UNKNOWN 0 #define FAMILY_UNKNOWN 0
#define FAMILY_CN 1 #define FAMILY_CN 1

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,8 @@
#include "randomx_constants_arqma.h" #include "randomx_constants_arqma.h"
#elif (ALGO == ALGO_RX_KEVA) #elif (ALGO == ALGO_RX_KEVA)
#include "randomx_constants_keva.h" #include "randomx_constants_keva.h"
#elif (ALGO == ALGO_RX_GRAFT)
#include "randomx_constants_graft.h"
#endif #endif
#include "aes.cl" #include "aes.cl"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,96 @@
/*
Copyright (c) 2019 SChernykh
This file is part of RandomX OpenCL.
RandomX OpenCL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
RandomX OpenCL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with RandomX OpenCL. If not, see <http://www.gnu.org/licenses/>.
*/
//Dataset base size in bytes. Must be a power of 2.
#define RANDOMX_DATASET_BASE_SIZE 2147483648
//Dataset extra size. Must be divisible by 64.
#define RANDOMX_DATASET_EXTRA_SIZE 33554368
//Scratchpad L3 size in bytes. Must be a power of 2.
#define RANDOMX_SCRATCHPAD_L3 2097152
//Scratchpad L2 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L3.
#define RANDOMX_SCRATCHPAD_L2 262144
//Scratchpad L1 size in bytes. Must be a power of two (minimum 64) and less than or equal to RANDOMX_SCRATCHPAD_L2.
#define RANDOMX_SCRATCHPAD_L1 16384
//Jump condition mask size in bits.
#define RANDOMX_JUMP_BITS 8
//Jump condition mask offset in bits. The sum of RANDOMX_JUMP_BITS and RANDOMX_JUMP_OFFSET must not exceed 16.
#define RANDOMX_JUMP_OFFSET 8
//Integer instructions
#define RANDOMX_FREQ_IADD_RS 16
#define RANDOMX_FREQ_IADD_M 7
#define RANDOMX_FREQ_ISUB_R 16
#define RANDOMX_FREQ_ISUB_M 7
#define RANDOMX_FREQ_IMUL_R 16
#define RANDOMX_FREQ_IMUL_M 4
#define RANDOMX_FREQ_IMULH_R 4
#define RANDOMX_FREQ_IMULH_M 1
#define RANDOMX_FREQ_ISMULH_R 4
#define RANDOMX_FREQ_ISMULH_M 1
#define RANDOMX_FREQ_IMUL_RCP 8
#define RANDOMX_FREQ_INEG_R 2
#define RANDOMX_FREQ_IXOR_R 15
#define RANDOMX_FREQ_IXOR_M 5
#define RANDOMX_FREQ_IROR_R 7
#define RANDOMX_FREQ_IROL_R 3
#define RANDOMX_FREQ_ISWAP_R 4
//Floating point instructions
#define RANDOMX_FREQ_FSWAP_R 4
#define RANDOMX_FREQ_FADD_R 16
#define RANDOMX_FREQ_FADD_M 5
#define RANDOMX_FREQ_FSUB_R 16
#define RANDOMX_FREQ_FSUB_M 5
#define RANDOMX_FREQ_FSCAL_R 6
#define RANDOMX_FREQ_FMUL_R 32
#define RANDOMX_FREQ_FDIV_M 4
#define RANDOMX_FREQ_FSQRT_R 6
//Control instructions
#define RANDOMX_FREQ_CBRANCH 25
#define RANDOMX_FREQ_CFROUND 1
//Store instruction
#define RANDOMX_FREQ_ISTORE 16
//No-op instruction
#define RANDOMX_FREQ_NOP 0
#define RANDOMX_DATASET_ITEM_SIZE 64
#define RANDOMX_PROGRAM_SIZE 280
#define HASH_SIZE 64
#define ENTROPY_SIZE (128 + RANDOMX_PROGRAM_SIZE * 8)
#define REGISTERS_SIZE 256
#define IMM_BUF_SIZE (RANDOMX_PROGRAM_SIZE * 4 - REGISTERS_SIZE)
#define IMM_INDEX_COUNT ((IMM_BUF_SIZE / 4) - 2)
#define VM_STATE_SIZE (REGISTERS_SIZE + IMM_BUF_SIZE + RANDOMX_PROGRAM_SIZE * 4)
#define ROUNDING_MODE (RANDOMX_FREQ_CFROUND ? -1 : 0)
// Scratchpad L1/L2/L3 bits
#define LOC_L1 (32 - 14)
#define LOC_L2 (32 - 18)
#define LOC_L3 (32 - 21)

View file

@ -111,6 +111,7 @@ static AlgoName const algorithm_names[] = {
{ "RandomSFX", nullptr, Algorithm::RX_SFX }, { "RandomSFX", nullptr, Algorithm::RX_SFX },
{ "randomx/keva", "rx/keva", Algorithm::RX_KEVA }, { "randomx/keva", "rx/keva", Algorithm::RX_KEVA },
{ "RandomKEVA", nullptr, Algorithm::RX_KEVA }, { "RandomKEVA", nullptr, Algorithm::RX_KEVA },
{ "RandomX-Graft", "rx/graft", Algorithm::RX_GRAFT },
# endif # endif
# ifdef XMRIG_ALGO_ARGON2 # ifdef XMRIG_ALGO_ARGON2
{ "argon2/chukwa", nullptr, Algorithm::AR2_CHUKWA }, { "argon2/chukwa", nullptr, Algorithm::AR2_CHUKWA },
@ -167,6 +168,7 @@ size_t xmrig::Algorithm::l2() const
switch (m_id) { switch (m_id) {
case RX_0: case RX_0:
case RX_SFX: case RX_SFX:
case RX_GRAFT:
return 0x40000; return 0x40000;
case RX_WOW: case RX_WOW:
@ -217,6 +219,7 @@ size_t xmrig::Algorithm::l3() const
switch (m_id) { switch (m_id) {
case RX_0: case RX_0:
case RX_SFX: case RX_SFX:
case RX_GRAFT:
return oneMiB * 2; return oneMiB * 2;
case RX_WOW: case RX_WOW:
@ -349,6 +352,7 @@ xmrig::Algorithm::Family xmrig::Algorithm::family(Id id)
case RX_ARQ: case RX_ARQ:
case RX_SFX: case RX_SFX:
case RX_KEVA: case RX_KEVA:
case RX_GRAFT:
return RANDOM_X; return RANDOM_X;
# endif # endif

View file

@ -70,6 +70,7 @@ public:
RX_ARQ, // "rx/arq" RandomARQ (Arqma). RX_ARQ, // "rx/arq" RandomARQ (Arqma).
RX_SFX, // "rx/sfx" RandomSFX (Safex Cash). RX_SFX, // "rx/sfx" RandomSFX (Safex Cash).
RX_KEVA, // "rx/keva" RandomKEVA (Keva). RX_KEVA, // "rx/keva" RandomKEVA (Keva).
RX_GRAFT, // "rx/graft" RandomX-Graft
AR2_CHUKWA, // "argon2/chukwa" Argon2id (Chukwa). AR2_CHUKWA, // "argon2/chukwa" Argon2id (Chukwa).
AR2_CHUKWA_V2, // "argon2/chukwav2" Argon2id (Chukwa v2). AR2_CHUKWA_V2, // "argon2/chukwav2" Argon2id (Chukwa v2).
AR2_WRKZ, // "argon2/wrkz" Argon2id (WRKZ) AR2_WRKZ, // "argon2/wrkz" Argon2id (WRKZ)

View file

@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define RANDOMX_DATASET_MAX_SIZE 2181038080 #define RANDOMX_DATASET_MAX_SIZE 2181038080
// Increase it if some configs use larger programs // Increase it if some configs use larger programs
#define RANDOMX_PROGRAM_MAX_SIZE 256 #define RANDOMX_PROGRAM_MAX_SIZE 280
// Increase it if some configs use larger scratchpad // Increase it if some configs use larger scratchpad
#define RANDOMX_SCRATCHPAD_L3_MAX_SIZE 2097152 #define RANDOMX_SCRATCHPAD_L3_MAX_SIZE 2097152

View file

@ -98,6 +98,17 @@ RandomX_ConfigurationKeva::RandomX_ConfigurationKeva()
ScratchpadL3_Size = 1048576; ScratchpadL3_Size = 1048576;
} }
RandomX_ConfigurationGraft::RandomX_ConfigurationGraft()
{
ArgonIterations = 3;
ArgonLanes = 2;
ArgonSalt = "RandomX-Graft\x01";
ProgramIterations = 2048;
ProgramSize = 280;
RANDOMX_FREQ_IROR_R = 7;
RANDOMX_FREQ_IROL_R = 3;
}
RandomX_ConfigurationBase::RandomX_ConfigurationBase() RandomX_ConfigurationBase::RandomX_ConfigurationBase()
: ArgonIterations(3) : ArgonIterations(3)
, ArgonLanes(1) , ArgonLanes(1)
@ -348,6 +359,7 @@ RandomX_ConfigurationWownero RandomX_WowneroConfig;
RandomX_ConfigurationArqma RandomX_ArqmaConfig; RandomX_ConfigurationArqma RandomX_ArqmaConfig;
RandomX_ConfigurationSafex RandomX_SafexConfig; RandomX_ConfigurationSafex RandomX_SafexConfig;
RandomX_ConfigurationKeva RandomX_KevaConfig; RandomX_ConfigurationKeva RandomX_KevaConfig;
RandomX_ConfigurationGraft RandomX_GraftConfig;
alignas(64) RandomX_ConfigurationBase RandomX_CurrentConfig; alignas(64) RandomX_ConfigurationBase RandomX_CurrentConfig;

View file

@ -146,13 +146,14 @@ struct RandomX_ConfigurationWownero : public RandomX_ConfigurationBase { RandomX
struct RandomX_ConfigurationArqma : public RandomX_ConfigurationBase { RandomX_ConfigurationArqma(); }; struct RandomX_ConfigurationArqma : public RandomX_ConfigurationBase { RandomX_ConfigurationArqma(); };
struct RandomX_ConfigurationSafex : public RandomX_ConfigurationBase { RandomX_ConfigurationSafex(); }; struct RandomX_ConfigurationSafex : public RandomX_ConfigurationBase { RandomX_ConfigurationSafex(); };
struct RandomX_ConfigurationKeva : public RandomX_ConfigurationBase { RandomX_ConfigurationKeva(); }; struct RandomX_ConfigurationKeva : public RandomX_ConfigurationBase { RandomX_ConfigurationKeva(); };
struct RandomX_ConfigurationGraft : public RandomX_ConfigurationBase { RandomX_ConfigurationGraft(); };
extern RandomX_ConfigurationMonero RandomX_MoneroConfig; extern RandomX_ConfigurationMonero RandomX_MoneroConfig;
extern RandomX_ConfigurationWownero RandomX_WowneroConfig; extern RandomX_ConfigurationWownero RandomX_WowneroConfig;
extern RandomX_ConfigurationArqma RandomX_ArqmaConfig; extern RandomX_ConfigurationArqma RandomX_ArqmaConfig;
extern RandomX_ConfigurationSafex RandomX_SafexConfig; extern RandomX_ConfigurationSafex RandomX_SafexConfig;
extern RandomX_ConfigurationKeva RandomX_KevaConfig; extern RandomX_ConfigurationKeva RandomX_KevaConfig;
extern RandomX_ConfigurationGraft RandomX_GraftConfig;
extern RandomX_ConfigurationBase RandomX_CurrentConfig; extern RandomX_ConfigurationBase RandomX_CurrentConfig;
template<typename T> template<typename T>

View file

@ -44,6 +44,9 @@ const RandomX_ConfigurationBase *xmrig::RxAlgo::base(Algorithm::Id algorithm)
case Algorithm::RX_KEVA: case Algorithm::RX_KEVA:
return &RandomX_KevaConfig; return &RandomX_KevaConfig;
case Algorithm::RX_GRAFT:
return &RandomX_GraftConfig;
default: default:
break; break;