From a1668856e757f9cb012d0fa84dc231d66b44d380 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 2 Sep 2020 14:25:29 +0700 Subject: [PATCH 1/4] v6.3.3-dev --- src/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/version.h b/src/version.h index ce052ee..dcba458 100644 --- a/src/version.h +++ b/src/version.h @@ -28,14 +28,14 @@ #define APP_ID "xmrig-cuda" #define APP_NAME "XMRig" #define APP_DESC "XMRig CUDA plugin" -#define APP_VERSION "6.3.2" +#define APP_VERSION "6.3.3-dev" #define APP_DOMAIN "xmrig.com" #define APP_SITE "www.xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2020 xmrig.com" #define APP_VER_MAJOR 6 #define APP_VER_MINOR 3 -#define APP_VER_PATCH 2 +#define APP_VER_PATCH 3 #define API_VERSION 3 From e78783572b9898360ff6140efc9a17ec30438eff Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 2 Sep 2020 18:09:09 +0700 Subject: [PATCH 2/4] Added CMake option WITH_DRIVER_API. --- CMakeLists.txt | 17 +++---- cmake/CUDA.cmake | 78 +++++++++++++++++++-------------- src/crypto/common/Algorithm.cpp | 4 +- src/cryptonight.h | 18 ++++++-- src/cuda_core.cu | 9 +++- src/cuda_device.hpp | 2 + src/cuda_extra.cu | 6 ++- src/xmrig-cuda.cpp | 32 +++++++++++++- 8 files changed, 114 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20912b3..47e146d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8) project(xmrig-cuda) -option(WITH_RANDOMX "Enable RandomX algorithms family" ON) +option(WITH_DRIVER_API "Enable CUDA Driver API and NVRTC, required for cn/r and kawpow algorithms" ON) include_directories(src) @@ -16,28 +16,23 @@ include(cmake/CUDA.cmake) set(SOURCES src/crypto/cn/c_blake256.c - src/crypto/common/Algorithm.h src/crypto/common/Algorithm.cpp - src/CudaCryptonightR_gen.cpp + src/crypto/common/Algorithm.h src/version.h src/xmrig-cuda.cpp src/xmrig-cuda.h ) -if (WIN32) - set(SOURCES_OS - res/app.rc - ) -else() - set(SOURCES_OS "") +if (WITH_DRIVER_API) + list(APPEND SOURCES src/CudaCryptonightR_gen.cpp) endif() -add_library(${CMAKE_PROJECT_NAME} SHARED ${SOURCES} ${SOURCES_OS}) +add_library(${CMAKE_PROJECT_NAME} SHARED ${SOURCES}) target_link_libraries(${CMAKE_PROJECT_NAME} xmrig-cu ${LIBS}) -if (WIN32) +if (WITH_DRIVER_API AND WIN32) file(GLOB NVRTCDLL "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvrtc64*.dll") add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${NVRTCDLL}" $) diff --git a/cmake/CUDA.cmake b/cmake/CUDA.cmake index 4a73db8..be44a6d 100644 --- a/cmake/CUDA.cmake +++ b/cmake/CUDA.cmake @@ -18,12 +18,20 @@ list(APPEND CMAKE_PREFIX_PATH "$ENV{CUDA_ROOT}") list(APPEND CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}") set(CUDA_STATIC ON) -find_package(CUDA 8.0 REQUIRED) +find_package(CUDA 9.0 REQUIRED) -find_library(CUDA_LIB libcuda cuda HINTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64" "${LIBCUDA_LIBRARY_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" /usr/lib64 /usr/local/cuda/lib64) -find_library(CUDA_NVRTC_LIB libnvrtc nvrtc HINTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64" "${LIBNVRTC_LIBRARY_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" /usr/lib64 /usr/local/cuda/lib64) +if (WITH_DRIVER_API) + find_library(CUDA_LIB libcuda cuda HINTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64" "${LIBCUDA_LIBRARY_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" /usr/lib64 /usr/local/cuda/lib64) + find_library(CUDA_NVRTC_LIB libnvrtc nvrtc HINTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64" "${LIBNVRTC_LIBRARY_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64" /usr/lib64 /usr/local/cuda/lib64) -set(LIBS ${LIBS} ${CUDA_LIBRARIES} ${CUDA_LIB} ${CUDA_NVRTC_LIB}) + set(LIBS ${LIBS} ${CUDA_LIBRARIES} ${CUDA_LIB} ${CUDA_NVRTC_LIB}) + + add_definitions(-DXMRIG_DRIVER_API) +else() + set(LIBS ${LIBS} ${CUDA_LIBRARIES}) + + remove_definitions(-DXMRIG_DRIVER_API) +endif() set(DEFAULT_CUDA_ARCH "50") @@ -64,6 +72,7 @@ foreach(CUDA_ARCH_ELEM ${CUDA_ARCH}) "Use '20' (for compute architecture 2.0) or higher.") endif() endforeach() + list(SORT CUDA_ARCH) option(CUDA_SHOW_REGISTER "Show registers used for each kernel and compute architecture" OFF) @@ -102,8 +111,7 @@ elseif("${CUDA_COMPILER}" STREQUAL "nvcc") if("${CUDA_ARCH_ELEM}" STREQUAL "21") # "2.1" actually does run faster when compiled as itself, versus in "2.0" compatible mode # strange virtual code type on top of compute_20, with no compute_21 (so the normal rule fails) - set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} - "--generate-code arch=compute_20,code=sm_21") + set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "--generate-code arch=compute_20,code=sm_21") else() set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "--generate-code arch=compute_${CUDA_ARCH_ELEM},code=sm_${CUDA_ARCH_ELEM} --generate-code arch=compute_${CUDA_ARCH_ELEM},code=compute_${CUDA_ARCH_ELEM}") @@ -119,21 +127,36 @@ elseif("${CUDA_COMPILER}" STREQUAL "nvcc") if (CUDA_SHOW_CODELINES) set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --source-in-ptx -lineinfo) set(CUDA_KEEP_FILES ON CACHE BOOL "activate keep files" FORCE) - endif(CUDA_SHOW_CODELINES) + endif() if (CUDA_SHOW_REGISTER) set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" -Xptxas=-v) - endif(CUDA_SHOW_REGISTER) + endif() if (CUDA_KEEP_FILES) set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --keep --keep-dir "${PROJECT_BINARY_DIR}") - endif(CUDA_KEEP_FILES) + endif() else() message(FATAL_ERROR "selected CUDA compiler '${CUDA_COMPILER}' is not supported") endif() -set(CUDA_RANDOMX_SOURCES +set(CUDA_SOURCES + src/cryptonight.h + src/cuda_aes.hpp + src/cuda_blake.hpp + src/cuda_core.cu + src/cuda_device.hpp + src/cuda_extra.cu + src/cuda_extra.h + src/cuda_fast_int_math_v2.hpp + src/cuda_groestl.hpp + src/cuda_jh.hpp + src/cuda_keccak.hpp + src/cuda_skein.hpp +) + +list(APPEND CUDA_SOURCES src/RandomX/aes_cuda.hpp src/RandomX/arqma/configuration.h src/RandomX/arqma/randomx_arqma.cu @@ -152,40 +175,27 @@ set(CUDA_RANDOMX_SOURCES src/RandomX/wownero/randomx_wownero.cu ) -set(CUDA_ASTROBWT_SOURCES +list(APPEND CUDA_SOURCES src/AstroBWT/dero/AstroBWT.cu src/AstroBWT/dero/BWT.h src/AstroBWT/dero/salsa20.h src/AstroBWT/dero/sha3.h ) -set(CUDA_KAWPOW_SOURCES - src/KawPow/raven/KawPow.cu - src/KawPow/raven/CudaKawPow_gen.cpp - src/KawPow/raven/CudaKawPow_gen.h -) - -set(CUDA_SOURCES - src/cryptonight.h - src/cuda_aes.hpp - src/cuda_blake.hpp - src/cuda_core.cu - src/cuda_device.hpp - src/cuda_extra.cu - src/cuda_extra.h - src/cuda_fast_int_math_v2.hpp - src/cuda_groestl.hpp - src/cuda_jh.hpp - src/cuda_keccak.hpp - src/cuda_skein.hpp -) +if (WITH_DRIVER_API) + list(APPEND CUDA_SOURCES + src/KawPow/raven/CudaKawPow_gen.cpp + src/KawPow/raven/CudaKawPow_gen.h + src/KawPow/raven/KawPow.cu + ) +endif() if("${CUDA_COMPILER}" STREQUAL "clang") - add_library(xmrig-cu STATIC ${CUDA_SOURCES} ${CUDA_RANDOMX_SOURCES} ${CUDA_ASTROBWT_SOURCES} ${CUDA_KAWPOW_SOURCES}) + add_library(xmrig-cu STATIC ${CUDA_SOURCES}) set_target_properties(xmrig-cu PROPERTIES COMPILE_FLAGS ${CLANG_BUILD_FLAGS}) set_target_properties(xmrig-cu PROPERTIES LINKER_LANGUAGE CXX) - set_source_files_properties(${CUDA_SOURCES} ${CUDA_RANDOMX_SOURCES} PROPERTIES LANGUAGE CXX) + set_source_files_properties(${CUDA_SOURCES} PROPERTIES LANGUAGE CXX) else() - cuda_add_library(xmrig-cu STATIC ${CUDA_SOURCES} ${CUDA_RANDOMX_SOURCES} ${CUDA_ASTROBWT_SOURCES} ${CUDA_KAWPOW_SOURCES}) + cuda_add_library(xmrig-cu STATIC ${CUDA_SOURCES}) endif() diff --git a/src/crypto/common/Algorithm.cpp b/src/crypto/common/Algorithm.cpp index 5d39107..e98aa4e 100644 --- a/src/crypto/common/Algorithm.cpp +++ b/src/crypto/common/Algorithm.cpp @@ -59,7 +59,6 @@ static AlgoName const algorithm_names[] = { { "cn/0", Algorithm::CN_0 }, { "cn/1", Algorithm::CN_1 }, { "cn/2", Algorithm::CN_2 }, - { "cn/r", Algorithm::CN_R }, { "cn/fast", Algorithm::CN_FAST }, { "cn/half", Algorithm::CN_HALF }, { "cn/xao", Algorithm::CN_XAO }, @@ -76,7 +75,10 @@ static AlgoName const algorithm_names[] = { { "cn-pico/tlo", Algorithm::CN_PICO_TLO }, { "cn/ccx", Algorithm::CN_CCX }, { "astrobwt", Algorithm::ASTROBWT_DERO }, +# ifdef XMRIG_DRIVER_API { "kawpow", Algorithm::KAWPOW_RVN }, + { "cn/r", Algorithm::CN_R }, +# endif }; diff --git a/src/cryptonight.h b/src/cryptonight.h index 743a511..7e9265d 100644 --- a/src/cryptonight.h +++ b/src/cryptonight.h @@ -29,15 +29,22 @@ #include "crypto/common/Algorithm.h" + #include -#include + + +#ifdef XMRIG_DRIVER_API +# include +#endif struct nvid_ctx { - CUdevice cuDevice = 0; - CUcontext cuContext = nullptr; +# ifdef XMRIG_DRIVER_API + CUdevice cuDevice = -1; CUmodule module = nullptr; CUfunction kernel = nullptr; +# endif + xmrig::Algorithm algorithm = xmrig::Algorithm::INVALID; uint64_t kernel_height = 0; @@ -94,6 +101,7 @@ struct nvid_ctx { void* astrobwt_offsets_begin = nullptr; void* astrobwt_offsets_end = nullptr; +# ifdef XMRIG_DRIVER_API void* kawpow_cache = nullptr; size_t kawpow_cache_size = 0; size_t kawpow_cache_capacity = 0; @@ -106,8 +114,10 @@ struct nvid_ctx { uint32_t* kawpow_stop_device = nullptr; uint32_t kawpow_period = 0; + CUmodule kawpow_module = nullptr; CUfunction kawpow_kernel = nullptr; +# endif }; @@ -134,7 +144,9 @@ void astrobwt_prepare(nvid_ctx *ctx, uint32_t batch_size); namespace AstroBWT_Dero { void hash(nvid_ctx *ctx, uint32_t nonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce); } +#ifdef XMRIG_DRIVER_API void kawpow_prepare(nvid_ctx *ctx, const void* cache, size_t cache_size, const void* dag_precalc, size_t dag_size, uint32_t height, const uint64_t* dag_sizes); void kawpow_stop_hash(nvid_ctx *ctx); namespace KawPow_Raven { void hash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t *skipped_hashes); } +#endif diff --git a/src/cuda_core.cu b/src/cuda_core.cu index 2b4de1f..8b49270 100644 --- a/src/cuda_core.cu +++ b/src/cuda_core.cu @@ -748,6 +748,7 @@ void cryptonight_core_gpu_hash(nvid_ctx* ctx, uint32_t nonce) } for (int i = 0; i < partcount; i++) { +# ifdef XMRIG_DRIVER_API if (ALGO == Algorithm::CN_R) { int threads = ctx->device_blocks * ctx->device_threads; void* args[] = { &threads, &ctx->device_bfactor, &i, &ctx->d_long_state, &ctx->d_ctx_a, &ctx->d_ctx_b, &ctx->d_ctx_state, &nonce, &ctx->d_input }; @@ -759,7 +760,9 @@ void cryptonight_core_gpu_hash(nvid_ctx* ctx, uint32_t nonce) args, 0 )); CU_CHECK(ctx->device_id, cuCtxSynchronize()); - } else if (BASE == Algorithm::CN_2) { + } else +# endif + if (BASE == Algorithm::CN_2) { CUDA_CHECK_KERNEL(ctx->device_id, cryptonight_core_gpu_phase2_double<<< grid, block2, @@ -820,6 +823,7 @@ void cryptonight_gpu_hash(nvid_ctx *ctx, const xmrig::Algorithm &algorithm, uint if (algorithm.family() == Algorithm::CN) { if (algorithm == Algorithm::CN_R) { +# ifdef XMRIG_DRIVER_API if ((ctx->algorithm != algorithm) || (ctx->kernel_height != height)) { if (ctx->module) { cuModuleUnload(ctx->module); @@ -837,6 +841,7 @@ void cryptonight_gpu_hash(nvid_ctx *ctx, const xmrig::Algorithm &algorithm, uint CryptonightR_get_program(ptx, lowered_name, height + 1, ctx->device_arch[0], ctx->device_arch[1], true); // FIXME } +# endif } switch (algorithm.id()) { @@ -852,9 +857,11 @@ void cryptonight_gpu_hash(nvid_ctx *ctx, const xmrig::Algorithm &algorithm, uint cryptonight_core_gpu_hash(ctx, startNonce); break; +# ifdef XMRIG_DRIVER_API case Algorithm::CN_R: cryptonight_core_gpu_hash(ctx, startNonce); break; +# endif case Algorithm::CN_FAST: cryptonight_core_gpu_hash(ctx, startNonce); diff --git a/src/cuda_device.hpp b/src/cuda_device.hpp index afa1ac7..d3a66ba 100644 --- a/src/cuda_device.hpp +++ b/src/cuda_device.hpp @@ -31,6 +31,7 @@ __VA_ARGS__; \ CUDA_CHECK(id, cudaGetLastError()) +#ifdef XMRIG_DRIVER_API #define CU_CHECK(id, ...) { \ CUresult result = __VA_ARGS__; \ if(result != CUDA_SUCCESS){ \ @@ -40,3 +41,4 @@ } \ } \ ( (void) 0 ) +#endif diff --git a/src/cuda_extra.cu b/src/cuda_extra.cu index bbad456..3a31bd0 100644 --- a/src/cuda_extra.cu +++ b/src/cuda_extra.cu @@ -314,8 +314,12 @@ int cryptonight_extra_cpu_init(nvid_ctx *ctx, const xmrig::Algorithm &algorithm, { using namespace xmrig; +# ifdef XMRIG_DRIVER_API CU_CHECK(ctx->device_id, cuDeviceGet(&ctx->cuDevice, ctx->device_id)); - CU_CHECK(ctx->device_id, cuCtxCreate(&ctx->cuContext, 0, ctx->cuDevice)); + + CUcontext cuContext; + CU_CHECK(ctx->device_id, cuDevicePrimaryCtxRetain(&cuContext, ctx->cuDevice)); +# endif cudaError_t err; err = cudaSetDevice(ctx->device_id); diff --git a/src/xmrig-cuda.cpp b/src/xmrig-cuda.cpp index d8a12e1..e6ed99a 100644 --- a/src/xmrig-cuda.cpp +++ b/src/xmrig-cuda.cpp @@ -267,6 +267,7 @@ bool astroBWTPrepare(nvid_ctx *ctx, uint32_t batchSize) bool kawPowHash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t *skipped_hashes) { +# ifdef XMRIG_DRIVER_API resetError(ctx->device_id); try { @@ -286,11 +287,17 @@ bool kawPowHash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t target, uint32_t *res } return true; +# else + saveError(ctx->device_id, kUnsupportedAlgorithm); + + return false; +# endif } bool kawPowPrepare(nvid_ctx *ctx, const void* cache, size_t cache_size, size_t dag_size, uint32_t height, const uint64_t* dag_sizes) { +# ifdef XMRIG_DRIVER_API resetError(ctx->device_id); try { @@ -303,11 +310,17 @@ bool kawPowPrepare(nvid_ctx *ctx, const void* cache, size_t cache_size, size_t d } return true; +# else + saveError(ctx->device_id, kUnsupportedAlgorithm); + + return false; +# endif } bool kawPowPrepare_v2(nvid_ctx *ctx, const void* cache, size_t cache_size, const void* dag_precalc, size_t dag_size, uint32_t height, const uint64_t* dag_sizes) { +# ifdef XMRIG_DRIVER_API resetError(ctx->device_id); try { @@ -320,11 +333,17 @@ bool kawPowPrepare_v2(nvid_ctx *ctx, const void* cache, size_t cache_size, const } return true; +# else + saveError(ctx->device_id, kUnsupportedAlgorithm); + + return false; +# endif } bool kawPowStopHash(nvid_ctx *ctx) { +# ifdef XMRIG_DRIVER_API try { kawpow_stop_hash(ctx); } @@ -335,6 +354,11 @@ bool kawPowStopHash(nvid_ctx *ctx) } return true; +# else + saveError(ctx->device_id, kUnsupportedAlgorithm); + + return false; +# endif } @@ -560,7 +584,9 @@ uint64_t deviceUlong(nvid_ctx *ctx, DeviceProperty property) void init() { +# ifdef XMRIG_DRIVER_API cuInit(0); +# endif } @@ -608,6 +634,7 @@ void release(nvid_ctx *ctx) cudaFree(ctx->astrobwt_offsets_begin); cudaFree(ctx->astrobwt_offsets_end); +# ifdef XMRIG_DRIVER_API cudaFree(ctx->kawpow_cache); cudaFree(ctx->kawpow_dag); cudaFreeHost(ctx->kawpow_stop_host); @@ -615,7 +642,10 @@ void release(nvid_ctx *ctx) cuModuleUnload(ctx->module); cuModuleUnload(ctx->kawpow_module); - cuCtxDestroy(ctx->cuContext); + if (ctx->cuDevice != -1) { + cuDevicePrimaryCtxRelease(ctx->cuDevice); + } +# endif delete ctx; } From ec8749735b7b5f5a84eca69f2ffcf7b5347dcd02 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Fri, 2 Oct 2020 17:03:40 +0200 Subject: [PATCH 3/4] RandomX: removed rx/loki Loki forks to PoS on October 9th. --- cmake/CUDA.cmake | 2 - src/RandomX/loki/configuration.h | 125 ------------------------------- src/RandomX/loki/randomx_loki.cu | 33 -------- src/crypto/common/Algorithm.cpp | 1 - src/crypto/common/Algorithm.h | 4 - src/cryptonight.h | 1 - src/xmrig-cuda.cpp | 4 - 7 files changed, 170 deletions(-) delete mode 100644 src/RandomX/loki/configuration.h delete mode 100644 src/RandomX/loki/randomx_loki.cu diff --git a/cmake/CUDA.cmake b/cmake/CUDA.cmake index be44a6d..02dbeed 100644 --- a/cmake/CUDA.cmake +++ b/cmake/CUDA.cmake @@ -165,8 +165,6 @@ list(APPEND CUDA_SOURCES src/RandomX/hash.hpp src/RandomX/keva/configuration.h src/RandomX/keva/randomx_keva.cu - src/RandomX/loki/configuration.h - src/RandomX/loki/randomx_loki.cu src/RandomX/monero/configuration.h src/RandomX/monero/randomx_monero.cu src/RandomX/randomx_cuda.hpp diff --git a/src/RandomX/loki/configuration.h b/src/RandomX/loki/configuration.h deleted file mode 100644 index 5e4a3aa..0000000 --- a/src/RandomX/loki/configuration.h +++ /dev/null @@ -1,125 +0,0 @@ -/* -Copyright (c) 2018-2019, tevador - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the copyright holder nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -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. -*/ - -#pragma once - -//Cache size in KiB. Must be a power of 2. -#define RANDOMX_ARGON_MEMORY 262144 - -//Number of Argon2d iterations for Cache initialization. -#define RANDOMX_ARGON_ITERATIONS 4 - -//Number of parallel lanes for Cache initialization. -#define RANDOMX_ARGON_LANES 2 - -//Argon2d salt -#define RANDOMX_ARGON_SALT "RandomXL\x12" - -//Number of random Cache accesses per Dataset item. Minimum is 2. -#define RANDOMX_CACHE_ACCESSES 8 - -//Target latency for SuperscalarHash (in cycles of the reference CPU). -#define RANDOMX_SUPERSCALAR_LATENCY 170 - -//Dataset base size in bytes. Must be a power of 2. -#define RANDOMX_DATASET_BASE_SIZE 2147483648 - -//Dataset extra size. Must be divisible by 64. -#define RANDOMX_DATASET_EXTRA_SIZE 33554368 - -//Number of instructions in a RandomX program. Must be divisible by 8. -#define RANDOMX_PROGRAM_SIZE 320 - -//Number of iterations during VM execution. -#define RANDOMX_PROGRAM_ITERATIONS 2048 - -//Number of chained VM executions per hash. -#define RANDOMX_PROGRAM_COUNT 7 - -//Scratchpad L3 size in bytes. Must be a power of 2. -#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 262144 - -//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 - -//Jump condition mask size in bits. -#define RANDOMX_JUMP_BITS 8 - -//Jump condition mask offset in bits. The sum of RANDOMX_JUMP_BITS and RANDOMX_JUMP_OFFSET must not exceed 16. -#define RANDOMX_JUMP_OFFSET 8 - -/* -Instruction frequencies (per 256 opcodes) -Total sum of frequencies must be 256 -*/ - -//Integer instructions -#define RANDOMX_FREQ_IADD_RS 25 -#define RANDOMX_FREQ_IADD_M 7 -#define RANDOMX_FREQ_ISUB_R 16 -#define RANDOMX_FREQ_ISUB_M 7 -#define RANDOMX_FREQ_IMUL_R 16 -#define RANDOMX_FREQ_IMUL_M 4 -#define RANDOMX_FREQ_IMULH_R 4 -#define RANDOMX_FREQ_IMULH_M 1 -#define RANDOMX_FREQ_ISMULH_R 4 -#define RANDOMX_FREQ_ISMULH_M 1 -#define RANDOMX_FREQ_IMUL_RCP 8 -#define RANDOMX_FREQ_INEG_R 2 -#define RANDOMX_FREQ_IXOR_R 15 -#define RANDOMX_FREQ_IXOR_M 5 -#define RANDOMX_FREQ_IROR_R 8 -#define RANDOMX_FREQ_IROL_R 2 -#define RANDOMX_FREQ_ISWAP_R 4 - -//Floating point instructions -#define RANDOMX_FREQ_FSWAP_R 4 -#define RANDOMX_FREQ_FADD_R 16 -#define RANDOMX_FREQ_FADD_M 5 -#define RANDOMX_FREQ_FSUB_R 16 -#define RANDOMX_FREQ_FSUB_M 5 -#define RANDOMX_FREQ_FSCAL_R 6 -#define RANDOMX_FREQ_FMUL_R 32 -#define RANDOMX_FREQ_FDIV_M 4 -#define RANDOMX_FREQ_FSQRT_R 6 - -//Control instructions -#define RANDOMX_FREQ_CBRANCH 16 -#define RANDOMX_FREQ_CFROUND 1 - -//Store instruction -#define RANDOMX_FREQ_ISTORE 16 - -//No-op instruction -#define RANDOMX_FREQ_NOP 0 -/* ------ - 256 -*/ diff --git a/src/RandomX/loki/randomx_loki.cu b/src/RandomX/loki/randomx_loki.cu deleted file mode 100644 index ef8e7b7..0000000 --- a/src/RandomX/loki/randomx_loki.cu +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright (c) 2019 SChernykh - -This file is part of RandomX CUDA. - -RandomX CUDA is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -RandomX CUDA is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with RandomX CUDA. If not, see. -*/ - -#include "cryptonight.h" -#include "cuda_device.hpp" - - -#include -#include -#include - - -namespace RandomX_Loki { - #include "configuration.h" - #define fillAes4Rx4 fillAes4Rx4_v104 - #include "RandomX/common.hpp" -} diff --git a/src/crypto/common/Algorithm.cpp b/src/crypto/common/Algorithm.cpp index e98aa4e..9e0a931 100644 --- a/src/crypto/common/Algorithm.cpp +++ b/src/crypto/common/Algorithm.cpp @@ -52,7 +52,6 @@ struct AlgoName static AlgoName const algorithm_names[] = { { "rx/0", Algorithm::RX_0 }, { "rx/wow", Algorithm::RX_WOW }, - { "rx/loki", Algorithm::RX_LOKI }, { "rx/arq", Algorithm::RX_ARQ }, { "rx/sfx", Algorithm::RX_SFX }, { "rx/keva", Algorithm::RX_KEVA }, diff --git a/src/crypto/common/Algorithm.h b/src/crypto/common/Algorithm.h index 0618f11..368fa2a 100644 --- a/src/crypto/common/Algorithm.h +++ b/src/crypto/common/Algorithm.h @@ -60,7 +60,6 @@ class Algorithm CN_CCX, // "cn/ccx" Conceal (CCX) RX_0, // "rx/0" RandomX (reference configuration). RX_WOW, // "rx/wow" RandomWOW (Wownero). - RX_LOKI, // "rx/loki" RandomXL (Loki). RX_ARQ, // "rx/arq" RandomARQ (Arqma). RX_SFX, // "rx/sfx" RandomSFX (Safex Cash). RX_KEVA, // "rx/keva" RandomKV (Keva). @@ -106,7 +105,6 @@ class Algorithm { switch (m_id) { case RX_0: - case RX_LOKI: case RX_SFX: return 0x40000; @@ -154,7 +152,6 @@ class Algorithm if (f == RANDOM_X) { switch (m_id) { case RX_0: - case RX_LOKI: case RX_SFX: return oneMiB * 2; @@ -232,7 +229,6 @@ class Algorithm case RX_0: case RX_WOW: - case RX_LOKI: case RX_ARQ: case RX_SFX: case RX_KEVA: diff --git a/src/cryptonight.h b/src/cryptonight.h index 7e9265d..75c88ea 100644 --- a/src/cryptonight.h +++ b/src/cryptonight.h @@ -135,7 +135,6 @@ void cuda_extra_cpu_set_data(nvid_ctx *ctx, const void *data, size_t len); void randomx_prepare(nvid_ctx *ctx, const void *dataset, size_t dataset_size, uint32_t batch_size); namespace RandomX_Arqma { void hash(nvid_ctx *ctx, uint32_t nonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t batch_size); } -namespace RandomX_Loki { void hash(nvid_ctx *ctx, uint32_t nonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t batch_size); } namespace RandomX_Monero { void hash(nvid_ctx *ctx, uint32_t nonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t batch_size); } namespace RandomX_Wownero { void hash(nvid_ctx *ctx, uint32_t nonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t batch_size); } namespace RandomX_Keva { void hash(nvid_ctx *ctx, uint32_t nonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t batch_size); } diff --git a/src/xmrig-cuda.cpp b/src/xmrig-cuda.cpp index e6ed99a..fc5f438 100644 --- a/src/xmrig-cuda.cpp +++ b/src/xmrig-cuda.cpp @@ -181,10 +181,6 @@ bool rxHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, uint32_t *resco RandomX_Wownero::hash(ctx, startNonce, target, rescount, resnonce, ctx->rx_batch_size); break; - case xmrig::Algorithm::RX_LOKI: - RandomX_Loki::hash(ctx, startNonce, target, rescount, resnonce, ctx->rx_batch_size); - break; - case xmrig::Algorithm::RX_ARQ: RandomX_Arqma::hash(ctx, startNonce, target, rescount, resnonce, ctx->rx_batch_size); break; From e3cbb618a7a897571615a694ea138d3a4e7e22fd Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 19 Oct 2020 03:32:38 +0700 Subject: [PATCH 4/4] v6.4.0-dev --- CHANGELOG.md | 3 +++ src/version.h | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ea8816..4603dd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# v6.4.0 +- [#70](https://github.com/xmrig/xmrig-cuda/pull/70) RandomX: removed `rx/loki` algorithm. + # v6.3.2 - [#65](https://github.com/xmrig/xmrig-cuda/pull/65) Fixed broken AstroBWT. diff --git a/src/version.h b/src/version.h index dcba458..6963aaf 100644 --- a/src/version.h +++ b/src/version.h @@ -28,14 +28,14 @@ #define APP_ID "xmrig-cuda" #define APP_NAME "XMRig" #define APP_DESC "XMRig CUDA plugin" -#define APP_VERSION "6.3.3-dev" +#define APP_VERSION "6.4.0-dev" #define APP_DOMAIN "xmrig.com" #define APP_SITE "www.xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2020 xmrig.com" #define APP_VER_MAJOR 6 -#define APP_VER_MINOR 3 -#define APP_VER_PATCH 3 +#define APP_VER_MINOR 4 +#define APP_VER_PATCH 0 #define API_VERSION 3