mirror of
https://github.com/wownero/RandomWOW.git
synced 2026-10-17 15:31:46 +02:00
Use values from configuration.h in assembly code
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
; File start: ..\src\configuration.h
|
||||
RANDOMX_ARGON_MEMORY EQU 262144t
|
||||
RANDOMX_ARGON_ITERATIONS EQU 3t
|
||||
RANDOMX_ARGON_LANES EQU 1t
|
||||
RANDOMX_ARGON_SALT TEXTEQU <"RandomX\x03">
|
||||
RANDOMX_CACHE_ACCESSES EQU 8t
|
||||
RANDOMX_SUPERSCALAR_LATENCY EQU 170t
|
||||
RANDOMX_SUPERSCALAR_MAX_SIZE EQU 512t
|
||||
RANDOMX_DATASET_BASE_SIZE EQU 2147483648t
|
||||
RANDOMX_DATASET_EXTRA_SIZE EQU 33554368t
|
||||
RANDOMX_PROGRAM_SIZE EQU 256t
|
||||
RANDOMX_PROGRAM_ITERATIONS EQU 2048t
|
||||
RANDOMX_PROGRAM_COUNT EQU 8t
|
||||
RANDOMX_SCRATCHPAD_L3 EQU 2097152t
|
||||
RANDOMX_SCRATCHPAD_L2 EQU 262144t
|
||||
RANDOMX_SCRATCHPAD_L1 EQU 16384t
|
||||
RANDOMX_JUMP_BITS EQU 8t
|
||||
RANDOMX_JUMP_OFFSET EQU 8t
|
||||
RANDOMX_FREQ_IADD_RS EQU 25t
|
||||
RANDOMX_FREQ_IADD_M EQU 7t
|
||||
RANDOMX_FREQ_ISUB_R EQU 16t
|
||||
RANDOMX_FREQ_ISUB_M EQU 7t
|
||||
RANDOMX_FREQ_IMUL_R EQU 16t
|
||||
RANDOMX_FREQ_IMUL_M EQU 4t
|
||||
RANDOMX_FREQ_IMULH_R EQU 4t
|
||||
RANDOMX_FREQ_IMULH_M EQU 1t
|
||||
RANDOMX_FREQ_ISMULH_R EQU 4t
|
||||
RANDOMX_FREQ_ISMULH_M EQU 1t
|
||||
RANDOMX_FREQ_IMUL_RCP EQU 8t
|
||||
RANDOMX_FREQ_INEG_R EQU 2t
|
||||
RANDOMX_FREQ_IXOR_R EQU 15t
|
||||
RANDOMX_FREQ_IXOR_M EQU 5t
|
||||
RANDOMX_FREQ_IROR_R EQU 10t
|
||||
RANDOMX_FREQ_IROL_R EQU 0t
|
||||
RANDOMX_FREQ_ISWAP_R EQU 4t
|
||||
RANDOMX_FREQ_FSWAP_R EQU 8t
|
||||
RANDOMX_FREQ_FADD_R EQU 20t
|
||||
RANDOMX_FREQ_FADD_M EQU 5t
|
||||
RANDOMX_FREQ_FSUB_R EQU 20t
|
||||
RANDOMX_FREQ_FSUB_M EQU 5t
|
||||
RANDOMX_FREQ_FSCAL_R EQU 6t
|
||||
RANDOMX_FREQ_FMUL_R EQU 20t
|
||||
RANDOMX_FREQ_FDIV_M EQU 4t
|
||||
RANDOMX_FREQ_FSQRT_R EQU 6t
|
||||
RANDOMX_FREQ_CBRANCH EQU 16t
|
||||
RANDOMX_FREQ_CFROUND EQU 1t
|
||||
RANDOMX_FREQ_ISTORE EQU 16t
|
||||
RANDOMX_FREQ_NOP EQU 0t
|
||||
; File end: ..\src\configuration.h
|
||||
@@ -1,5 +1,5 @@
|
||||
mov rdx, rax
|
||||
and eax, 2097088
|
||||
and eax, RANDOMX_SCRATCHPAD_MASK
|
||||
lea rcx, [rsi+rax]
|
||||
push rcx
|
||||
xor r8, qword ptr [rcx+0]
|
||||
@@ -11,7 +11,7 @@
|
||||
xor r14, qword ptr [rcx+48]
|
||||
xor r15, qword ptr [rcx+56]
|
||||
ror rdx, 32
|
||||
and edx, 2097088
|
||||
and edx, RANDOMX_SCRATCHPAD_MASK
|
||||
lea rcx, [rsi+rdx]
|
||||
push rcx
|
||||
cvtdq2pd xmm0, qword ptr [rcx+0]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
xor rbp, rax ;# modify "mx"
|
||||
mov edx, ebp ;# edx = mx
|
||||
and edx, 2147483584 ;# align "mx" to the start of a cache line
|
||||
and edx, RANDOMX_DATASET_BASE_MASK
|
||||
prefetchnta byte ptr [rdi+rdx]
|
||||
ror rbp, 32 ;# swap "ma" and "mx"
|
||||
mov edx, ebp ;# edx = ma
|
||||
and edx, 2147483584 ;# align "ma" to the start of a cache line
|
||||
and edx, RANDOMX_DATASET_BASE_MASK
|
||||
lea rcx, [rdi+rdx] ;# dataset cache line
|
||||
xor r8, qword ptr [rcx+0]
|
||||
xor r9, qword ptr [rcx+8]
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
xor rbp, rax ;# modify "mx"
|
||||
ror rbp, 32 ;# swap "ma" and "mx"
|
||||
mov ebx, ebp ;# ecx = ma
|
||||
and ebx, 2147483584 ;# align "ma" to the start of a cache line
|
||||
and ebx, RANDOMX_DATASET_BASE_MASK
|
||||
shr ebx, 6 ;# ebx = Dataset block number
|
||||
;# add ebx, datasetOffset / 64
|
||||
;# call 32768
|
||||
@@ -1,4 +1,4 @@
|
||||
and rbx, 4194303
|
||||
and rbx, RANDOMX_CACHE_MASK
|
||||
shl rbx, 6
|
||||
add rbx, rdi
|
||||
prefetchnta byte ptr [rbx]
|
||||
+5
-5
@@ -20,7 +20,7 @@ along with RandomX. If not, see<http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
//Cache size in KiB. Must be a power of 2.
|
||||
#define RANDOMX_ARGON_MEMORY (256 * 1024)
|
||||
#define RANDOMX_ARGON_MEMORY 262144
|
||||
|
||||
//Number of Argon2d iterations for Cache initialization
|
||||
#define RANDOMX_ARGON_ITERATIONS 3
|
||||
@@ -41,7 +41,7 @@ along with RandomX. If not, see<http://www.gnu.org/licenses/>.
|
||||
#define RANDOMX_SUPERSCALAR_MAX_SIZE 512
|
||||
|
||||
//Dataset base size in bytes. Must be a power of 2.
|
||||
#define RANDOMX_DATASET_BASE_SIZE (2ULL * 1024 * 1024 * 1024)
|
||||
#define RANDOMX_DATASET_BASE_SIZE 2147483648
|
||||
|
||||
//Dataset extra size. Must be divisible by 64.
|
||||
#define RANDOMX_DATASET_EXTRA_SIZE 33554368
|
||||
@@ -56,13 +56,13 @@ along with RandomX. If not, see<http://www.gnu.org/licenses/>.
|
||||
#define RANDOMX_PROGRAM_COUNT 8
|
||||
|
||||
//Scratchpad L3 size in bytes. Must be a power of 2.
|
||||
#define RANDOMX_SCRATCHPAD_L3 (2 * 1024 * 1024)
|
||||
#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 (256 * 1024)
|
||||
#define RANDOMX_SCRATCHPAD_L2 262144
|
||||
|
||||
//Scratchpad L1 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L2.
|
||||
#define RANDOMX_SCRATCHPAD_L1 (16 * 1024)
|
||||
#define RANDOMX_SCRATCHPAD_L1 16384
|
||||
|
||||
//Jump condition mask size in bits.
|
||||
#define RANDOMX_JUMP_BITS 8
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
.global DECL(randomx_program_end)
|
||||
.global DECL(randomx_reciprocal_fast)
|
||||
|
||||
#include "configuration.h"
|
||||
|
||||
#define RANDOMX_SCRATCHPAD_MASK (RANDOMX_SCRATCHPAD_L3-64)
|
||||
#define RANDOMX_DATASET_BASE_MASK (RANDOMX_DATASET_BASE_SIZE-64)
|
||||
#define RANDOMX_CACHE_MASK (RANDOMX_ARGON_MEMORY*16-1)
|
||||
|
||||
#define db .byte
|
||||
|
||||
.balign 64
|
||||
|
||||
@@ -37,6 +37,12 @@ PUBLIC randomx_sshash_init
|
||||
PUBLIC randomx_program_end
|
||||
PUBLIC randomx_reciprocal_fast
|
||||
|
||||
include asm/configuration.asm
|
||||
|
||||
RANDOMX_SCRATCHPAD_MASK EQU (RANDOMX_SCRATCHPAD_L3-64)
|
||||
RANDOMX_DATASET_BASE_MASK EQU (RANDOMX_DATASET_BASE_SIZE-64)
|
||||
RANDOMX_CACHE_MASK EQU (RANDOMX_ARGON_MEMORY*16-1)
|
||||
|
||||
ALIGN 64
|
||||
randomx_program_prologue PROC
|
||||
include asm/program_prologue_win64.inc
|
||||
|
||||
Reference in New Issue
Block a user