diff --git a/src/backend/cuda/runners/CudaRxRunner.cpp b/src/backend/cuda/runners/CudaRxRunner.cpp index c02fc0e9..2ade7d26 100644 --- a/src/backend/cuda/runners/CudaRxRunner.cpp +++ b/src/backend/cuda/runners/CudaRxRunner.cpp @@ -5,8 +5,8 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright 2018-2024 SChernykh + * Copyright 2016-2024 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ * along with this program. If not, see . */ - #include "backend/cuda/runners/CudaRxRunner.h" #include "backend/cuda/CudaLaunchData.h" #include "backend/cuda/wrappers/CudaLib.h" @@ -59,7 +58,7 @@ bool xmrig::CudaRxRunner::set(const Job &job, uint8_t *blob) m_seed = job.seed(); if (m_ready) { - auto dataset = Rx::dataset(job, 0); + const auto *dataset = Rx::dataset(job, 0); callWrapper(CudaLib::rxUpdateDataset(m_ctx, dataset->raw(), dataset->size(false))); } } @@ -69,7 +68,7 @@ bool xmrig::CudaRxRunner::set(const Job &job, uint8_t *blob) return rc; } - auto dataset = Rx::dataset(job, 0); + const auto *dataset = Rx::dataset(job, 0); m_ready = callWrapper(CudaLib::rxPrepare(m_ctx, dataset->raw(), dataset->size(false), m_datasetHost, m_intensity)); return m_ready; diff --git a/src/backend/cuda/runners/CudaRxRunner.h b/src/backend/cuda/runners/CudaRxRunner.h index c8a923df..12e90783 100644 --- a/src/backend/cuda/runners/CudaRxRunner.h +++ b/src/backend/cuda/runners/CudaRxRunner.h @@ -5,8 +5,8 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright 2018-2024 SChernykh + * Copyright 2016-2024 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/backend/cuda/wrappers/CudaLib.cpp b/src/backend/cuda/wrappers/CudaLib.cpp index ef028323..87501f41 100644 --- a/src/backend/cuda/wrappers/CudaLib.cpp +++ b/src/backend/cuda/wrappers/CudaLib.cpp @@ -19,10 +19,10 @@ #include #include - #include "backend/cuda/wrappers/CudaLib.h" #include "base/io/Env.h" #include "base/io/log/Log.h" +#include "base/io/log/Tags.h" #include "base/kernel/Process.h" #include "crypto/rx/RxAlgo.h" @@ -205,13 +205,23 @@ bool xmrig::CudaLib::rxHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, bool xmrig::CudaLib::rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datasetSize, bool dataset_host, uint32_t batchSize) noexcept { +# ifdef XMRIG_ALGO_RANDOMX + if (!pRxUpdateDataset) { + LOG_WARN("%s" YELLOW_BOLD("CUDA plugin is outdated. Please update to the latest version"), Tags::randomx()); + } +# endif + return pRxPrepare(ctx, dataset, datasetSize, dataset_host, batchSize); } -bool xmrig::CudaLib::rxUpdateDataset(nvid_ctx* ctx, const void* dataset, size_t datasetSize) noexcept +bool xmrig::CudaLib::rxUpdateDataset(nvid_ctx *ctx, const void *dataset, size_t datasetSize) noexcept { - return pRxUpdateDataset(ctx, dataset, datasetSize); + if (pRxUpdateDataset) { + return pRxUpdateDataset(ctx, dataset, datasetSize); + } + + return true; } @@ -397,7 +407,6 @@ void xmrig::CudaLib::load() DLSYM(Release); DLSYM(RxHash); DLSYM(RxPrepare); - DLSYM(RxUpdateDataset); DLSYM(KawPowHash); DLSYM(KawPowPrepare_v2); DLSYM(KawPowStopHash); @@ -411,5 +420,7 @@ void xmrig::CudaLib::load() DLSYM(SetJob_v2); } + uv_dlsym(&cudaLib, kRxUpdateDataset, reinterpret_cast(&pRxUpdateDataset)); + pInit(); } diff --git a/src/backend/cuda/wrappers/CudaLib.h b/src/backend/cuda/wrappers/CudaLib.h index e92ac11c..ff7533ba 100644 --- a/src/backend/cuda/wrappers/CudaLib.h +++ b/src/backend/cuda/wrappers/CudaLib.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2021 SChernykh - * Copyright (c) 2016-2021 XMRig , + * Copyright (c) 2018-2024 SChernykh + * Copyright (c) 2016-2024 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -71,7 +71,7 @@ public: static bool deviceInit(nvid_ctx *ctx) noexcept; static bool rxHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce) noexcept; static bool rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datasetSize, bool dataset_host, uint32_t batchSize) noexcept; - static bool rxUpdateDataset(nvid_ctx* ctx, const void* dataset, size_t datasetSize) noexcept; + static bool rxUpdateDataset(nvid_ctx *ctx, const void *dataset, size_t datasetSize) noexcept; static bool kawPowHash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t *skipped_hashes) noexcept; static bool kawPowPrepare(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) noexcept; static bool kawPowStopHash(nvid_ctx *ctx) noexcept; diff --git a/src/crypto/rx/RxBasicStorage.cpp b/src/crypto/rx/RxBasicStorage.cpp index eacb6295..9e43adf4 100644 --- a/src/crypto/rx/RxBasicStorage.cpp +++ b/src/crypto/rx/RxBasicStorage.cpp @@ -1,7 +1,7 @@ /* XMRig * Copyright (c) 2018-2019 tevador - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2024 SChernykh + * Copyright (c) 2016-2024 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,9 +17,7 @@ * along with this program. If not, see . */ - #include "crypto/rx/RxBasicStorage.h" -#include "backend/common/Tags.h" #include "base/io/log/Log.h" #include "base/io/log/Tags.h" #include "base/tools/Chrono.h"