From a3fd111a95bdbc35b74ed228d5a5b08d9828aefa Mon Sep 17 00:00:00 2001 From: wowario Date: Sun, 10 May 2020 08:21:21 +0300 Subject: [PATCH] RandomWOW Lite --- CMakeLists.txt | 16 ++++++++-------- src/common.hpp | 2 +- src/configuration.h | 28 ++++++++++++++-------------- src/{randomx.cpp => randomx2.cpp} | 2 +- src/{randomx.h => randomx2.h} | 0 src/tests/api-example1.c | 2 +- src/tests/api-example2.cpp | 2 +- src/tests/benchmark.cpp | 2 +- src/tests/scratchpad-entropy.cpp | 2 +- vcxproj/api-example1.vcxproj | 2 +- vcxproj/api-example1.vcxproj.filters | 2 +- vcxproj/randomx-dll.vcxproj | 2 +- vcxproj/randomx-dll.vcxproj.filters | 2 +- vcxproj/randomx.vcxproj | 2 +- vcxproj/randomx.vcxproj.filters | 2 +- 15 files changed, 34 insertions(+), 34 deletions(-) rename src/{randomx.cpp => randomx2.cpp} (99%) rename src/{randomx.h => randomx2.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index de0f818..2c55100 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ cmake_minimum_required(VERSION 2.8.7) project(RandomX) -set(randomx_sources +set(randomx2_sources src/aes_hash.cpp src/argon2_ref.c src/argon2_ssse3.c @@ -44,7 +44,7 @@ src/vm_interpreted.cpp src/allocator.cpp src/assembly_generator_x86.cpp src/instruction.cpp -src/randomx.cpp +src/randomx2.cpp src/superscalar.cpp src/vm_compiled.cpp src/vm_interpreted_light.cpp @@ -97,12 +97,12 @@ endfunction() # x86-64 if(ARCH_ID STREQUAL "x86_64" OR ARCH_ID STREQUAL "x86-64" OR ARCH_ID STREQUAL "amd64") - list(APPEND randomx_sources + list(APPEND randomx2_sources src/jit_compiler_x86.cpp) if(MSVC) enable_language(ASM_MASM) - list(APPEND randomx_sources src/jit_compiler_x86_static.asm) + list(APPEND randomx2_sources src/jit_compiler_x86_static.asm) set_property(SOURCE src/jit_compiler_x86_static.asm PROPERTY LANGUAGE ASM_MASM) @@ -115,7 +115,7 @@ if(ARCH_ID STREQUAL "x86_64" OR ARCH_ID STREQUAL "x86-64" OR ARCH_ID STREQUAL "a add_custom_target(generate-asm DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/asm/configuration.asm) else() - list(APPEND randomx_sources src/jit_compiler_x86_static.S) + list(APPEND randomx2_sources src/jit_compiler_x86_static.S) # cheat because cmake and ccache hate each other set_property(SOURCE src/jit_compiler_x86_static.S PROPERTY LANGUAGE C) @@ -148,7 +148,7 @@ endif() # ARMv8 if(ARM_ID STREQUAL "aarch64" OR ARM_ID STREQUAL "arm64" OR ARM_ID STREQUAL "armv8-a") - list(APPEND randomx_sources + list(APPEND randomx2_sources src/jit_compiler_a64_static.S src/jit_compiler_a64.cpp) # cheat because cmake and ccache hate each other @@ -170,9 +170,9 @@ if(ARM_ID STREQUAL "aarch64" OR ARM_ID STREQUAL "arm64" OR ARM_ID STREQUAL "armv endif() endif() -set(RANDOMX_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/src" CACHE STRING "RandomX Include path") +set(RANDOMX2_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/src" CACHE STRING "RandomX Include path") -add_library(randomx ${randomx_sources}) +add_library(randomx ${randomx2_sources}) if(TARGET generate-asm) add_dependencies(randomx generate-asm) diff --git a/src/common.hpp b/src/common.hpp index 67081a1..3bc4ab4 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "blake2/endian.h" #include "configuration.h" -#include "randomx.h" +#include "randomx2.h" namespace randomx { diff --git a/src/configuration.h b/src/configuration.h index f8fc3b5..1bde3af 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -48,28 +48,28 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define RANDOMX_SUPERSCALAR_LATENCY 170 //Dataset base size in bytes. Must be a power of 2. -#define RANDOMX_DATASET_BASE_SIZE 2147483648 +#define RANDOMX_DATASET_BASE_SIZE 268435456 // 256 MB //Dataset extra size. Must be divisible by 64. -#define RANDOMX_DATASET_EXTRA_SIZE 33554368 +#define RANDOMX_DATASET_EXTRA_SIZE 16777216 // 16 MB //Number of instructions in a RandomX program. Must be divisible by 8. -#define RANDOMX_PROGRAM_SIZE 256 +#define RANDOMX_PROGRAM_SIZE 384 //Number of iterations during VM execution. -#define RANDOMX_PROGRAM_ITERATIONS 1024 +#define RANDOMX_PROGRAM_ITERATIONS 400 //Number of chained VM executions per hash. -#define RANDOMX_PROGRAM_COUNT 16 +#define RANDOMX_PROGRAM_COUNT 8 //Scratchpad L3 size in bytes. Must be a power of 2. -#define RANDOMX_SCRATCHPAD_L3 1048576 +#define RANDOMX_SCRATCHPAD_L3 262144 // 256 KB //Scratchpad L2 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L3. -#define RANDOMX_SCRATCHPAD_L2 131072 +#define RANDOMX_SCRATCHPAD_L2 131072 // 128 KB //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 +#define RANDOMX_SCRATCHPAD_L1 65536 // 64 KB //Jump condition mask size in bits. #define RANDOMX_JUMP_BITS 8 @@ -102,15 +102,15 @@ Total sum of frequencies must be 256 #define RANDOMX_FREQ_ISWAP_R 4 //Floating point instructions -#define RANDOMX_FREQ_FSWAP_R 8 +#define RANDOMX_FREQ_FSWAP_R 4 #define RANDOMX_FREQ_FADD_R 20 -#define RANDOMX_FREQ_FADD_M 5 +#define RANDOMX_FREQ_FADD_M 4 #define RANDOMX_FREQ_FSUB_R 20 -#define RANDOMX_FREQ_FSUB_M 5 -#define RANDOMX_FREQ_FSCAL_R 6 +#define RANDOMX_FREQ_FSUB_M 3 +#define RANDOMX_FREQ_FSCAL_R 3 #define RANDOMX_FREQ_FMUL_R 20 -#define RANDOMX_FREQ_FDIV_M 4 -#define RANDOMX_FREQ_FSQRT_R 6 +#define RANDOMX_FREQ_FDIV_M 8 +#define RANDOMX_FREQ_FSQRT_R 12 //Control instructions #define RANDOMX_FREQ_CBRANCH 16 diff --git a/src/randomx.cpp b/src/randomx2.cpp similarity index 99% rename from src/randomx.cpp rename to src/randomx2.cpp index 898425c..3bb4734 100644 --- a/src/randomx.cpp +++ b/src/randomx2.cpp @@ -26,7 +26,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "randomx.h" +#include "randomx2.h" #include "dataset.hpp" #include "vm_interpreted.hpp" #include "vm_interpreted_light.hpp" diff --git a/src/randomx.h b/src/randomx2.h similarity index 100% rename from src/randomx.h rename to src/randomx2.h diff --git a/src/tests/api-example1.c b/src/tests/api-example1.c index e5f8526..a960728 100644 --- a/src/tests/api-example1.c +++ b/src/tests/api-example1.c @@ -1,4 +1,4 @@ -#include "../randomx.h" +#include "../randomx2.h" #include int main() { diff --git a/src/tests/api-example2.cpp b/src/tests/api-example2.cpp index 610aaa8..0f3e49d 100644 --- a/src/tests/api-example2.cpp +++ b/src/tests/api-example2.cpp @@ -1,4 +1,4 @@ -#include "../randomx.h" +#include "../randomx2.h" #include #include #include diff --git a/src/tests/benchmark.cpp b/src/tests/benchmark.cpp index 47cd026..8ef2a35 100644 --- a/src/tests/benchmark.cpp +++ b/src/tests/benchmark.cpp @@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "stopwatch.hpp" #include "utility.hpp" -#include "../randomx.h" +#include "../randomx2.h" #include "../dataset.hpp" #include "../blake2/endian.h" #include "../common.hpp" diff --git a/src/tests/scratchpad-entropy.cpp b/src/tests/scratchpad-entropy.cpp index ecb3c7d..7a814f2 100644 --- a/src/tests/scratchpad-entropy.cpp +++ b/src/tests/scratchpad-entropy.cpp @@ -1,7 +1,7 @@ #include #include #include "utility.hpp" -#include "../randomx.h" +#include "../randomx2.h" #include "../virtual_machine.hpp" #include "../blake2/endian.h" diff --git a/vcxproj/api-example1.vcxproj b/vcxproj/api-example1.vcxproj index ebd490f..dbbbe26 100644 --- a/vcxproj/api-example1.vcxproj +++ b/vcxproj/api-example1.vcxproj @@ -123,7 +123,7 @@ - + diff --git a/vcxproj/api-example1.vcxproj.filters b/vcxproj/api-example1.vcxproj.filters index 6cd41c2..290054b 100644 --- a/vcxproj/api-example1.vcxproj.filters +++ b/vcxproj/api-example1.vcxproj.filters @@ -20,7 +20,7 @@ - + Header Files diff --git a/vcxproj/randomx-dll.vcxproj b/vcxproj/randomx-dll.vcxproj index 2e7919d..c53415c 100644 --- a/vcxproj/randomx-dll.vcxproj +++ b/vcxproj/randomx-dll.vcxproj @@ -37,7 +37,7 @@ - + diff --git a/vcxproj/randomx-dll.vcxproj.filters b/vcxproj/randomx-dll.vcxproj.filters index 038fb71..b61a771 100644 --- a/vcxproj/randomx-dll.vcxproj.filters +++ b/vcxproj/randomx-dll.vcxproj.filters @@ -15,7 +15,7 @@ - + Header Files diff --git a/vcxproj/randomx.vcxproj b/vcxproj/randomx.vcxproj index bfde9f7..bbe3953 100644 --- a/vcxproj/randomx.vcxproj +++ b/vcxproj/randomx.vcxproj @@ -191,7 +191,7 @@ SET ERRORLEVEL = 0 - + diff --git a/vcxproj/randomx.vcxproj.filters b/vcxproj/randomx.vcxproj.filters index eb4462a..30f6047 100644 --- a/vcxproj/randomx.vcxproj.filters +++ b/vcxproj/randomx.vcxproj.filters @@ -110,7 +110,7 @@ Header Files - + Header Files