-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Optimized dataset read There was a false dependency on readReg2 and readReg3 (caused by `xor rbp, rax` instruction) when reading dataset item (see design.md - 4.6.2 Loop execution, steps 5 and 7). This change uses `ma` register to read dataset item before the whole `rbp` (`ma` and `mx`) is changed, so superscalar and out-of-order CPU can start executing it earlier. Results: https://i.imgur.com/Bpeq9mx.png ~1% speedup on modern Intel/AMD CPUs. * ARMv8: optimized dataset read Break dependency from readReg2 and readReg3. * Fixed light mode hashing
- Loading branch information
Showing
5 changed files
with
20 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
mov rsi, rdx ;# uint8_t* scratchpad | ||
|
||
mov rax, rbp | ||
ror rbp, 32 | ||
|
||
;# zero integer registers | ||
xor r8, r8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
mov rbx, r9 ;# loop counter | ||
|
||
mov rax, rbp | ||
ror rbp, 32 | ||
|
||
;# zero integer registers | ||
xor r8, r8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
mov ecx, ebp ;# ecx = ma | ||
and ecx, RANDOMX_DATASET_BASE_MASK | ||
xor r8, qword ptr [rdi+rcx] | ||
ror rbp, 32 ;# swap "ma" and "mx" | ||
xor rbp, rax ;# modify "mx" | ||
mov edx, ebp ;# edx = mx | ||
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, RANDOMX_DATASET_BASE_MASK | ||
lea rcx, [rdi+rdx] ;# dataset cache line | ||
xor r8, qword ptr [rcx+0] | ||
xor r9, qword ptr [rcx+8] | ||
xor r10, qword ptr [rcx+16] | ||
xor r11, qword ptr [rcx+24] | ||
xor r12, qword ptr [rcx+32] | ||
xor r13, qword ptr [rcx+40] | ||
xor r14, qword ptr [rcx+48] | ||
xor r15, qword ptr [rcx+56] | ||
xor r9, qword ptr [rdi+rcx+8] | ||
xor r10, qword ptr [rdi+rcx+16] | ||
xor r11, qword ptr [rdi+rcx+24] | ||
xor r12, qword ptr [rdi+rcx+32] | ||
xor r13, qword ptr [rdi+rcx+40] | ||
xor r14, qword ptr [rdi+rcx+48] | ||
xor r15, qword ptr [rdi+rcx+56] | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters