Skip to content

Commit

Permalink
Expose L1 and L2 cache size
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPiechota committed Nov 27, 2024
1 parent 465806f commit 24eebd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 24eebd9

Please sign in to comment.