From 24eebd9ac95e9e779a36f7a78c300a856523a3ab Mon Sep 17 00:00:00 2001 From: James Piechota Date: Wed, 27 Nov 2024 01:52:05 +0000 Subject: [PATCH] Expose L1 and L2 cache size --- CMakeLists.txt | 10 ++++++++++ src/configuration.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbea5fe..590bee0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,6 +220,8 @@ set(RANDOMX_DATASET_BASE_SIZE "" CACHE STRING "Set the RANDOMX_DATASET_BASE_SIZE set(RANDOMX_PROGRAM_SIZE "" CACHE STRING "Set the RANDOMX_PROGRAM_SIZE value") set(RANDOMX_PROGRAM_ITERATIONS "" CACHE STRING "Set the RANDOMX_PROGRAM_ITERATIONS value") set(RANDOMX_PROGRAM_COUNT "" CACHE STRING "Set the RANDOMX_PROGRAM_COUNT value") +set(RANDOMX_SCRATCHPAD_L1 "" CACHE STRING "Set the RANDOMX_SCRATCHPAD_L1 value") +set(RANDOMX_SCRATCHPAD_L2 "" CACHE STRING "Set the RANDOMX_SCRATCHPAD_L2 value") set(RANDOMX_SCRATCHPAD_L3 "" CACHE STRING "Set the RANDOMX_SCRATCHPAD_L3 value") set(RANDOMX_FREQ_IADD_RS "" CACHE STRING "Set the RANDOMX_FREQ_IADD_RS value") set(RANDOMX_FREQ_IADD_M "" CACHE STRING "Set the RANDOMX_FREQ_IADD_M value") @@ -279,6 +281,14 @@ if(RANDOMX_PROGRAM_COUNT) target_compile_definitions(randomx PRIVATE RANDOMX_PROGRAM_COUNT=${RANDOMX_PROGRAM_COUNT}) endif() +if(RANDOMX_SCRATCHPAD_L1) + target_compile_definitions(randomx PRIVATE RANDOMX_SCRATCHPAD_L1=${RANDOMX_SCRATCHPAD_L1}) +endif() + +if(RANDOMX_SCRATCHPAD_L2) + target_compile_definitions(randomx PRIVATE RANDOMX_SCRATCHPAD_L2=${RANDOMX_SCRATCHPAD_L2}) +endif() + if(RANDOMX_SCRATCHPAD_L3) target_compile_definitions(randomx PRIVATE RANDOMX_SCRATCHPAD_L3=${RANDOMX_SCRATCHPAD_L3}) endif() diff --git a/src/configuration.h b/src/configuration.h index 7e53ef0..8945d92 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -77,10 +77,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif //Scratchpad L2 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L3. +#ifndef RANDOMX_SCRATCHPAD_L2 #define RANDOMX_SCRATCHPAD_L2 262144 +#endif //Scratchpad L1 size in bytes. Must be a power of two (minimum 64) and less than or equal to RANDOMX_SCRATCHPAD_L2. +#ifndef RANDOMX_SCRATCHPAD_L1 #define RANDOMX_SCRATCHPAD_L1 16384 +#endif //Jump condition mask size in bits. #define RANDOMX_JUMP_BITS 8