Code style cleanup

This commit is contained in:
XMRig 2020-04-04 17:19:23 +07:00
parent 7f01c5c6f3
commit 2e6c518a1c
No known key found for this signature in database
GPG key ID: 446A53638BE94409
6 changed files with 35 additions and 47 deletions

View file

@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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

View file

@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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

View file

@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@ -46,24 +46,12 @@ public:
ICudaRunner() = default;
virtual ~ICudaRunner() = default;
// virtual cl_context ctx() const = 0;
// virtual const Algorithm &algorithm() const = 0;
// virtual const char *buildOptions() const = 0;
// virtual const char *deviceKey() const = 0;
// virtual const char *source() const = 0;
// virtual const OclLaunchData &data() const = 0;
virtual size_t intensity() const = 0;
virtual size_t roundSize() const = 0;
virtual size_t processedHashes() const = 0;
// virtual size_t threadId() const = 0;
// virtual uint32_t deviceIndex() const = 0;
// virtual void build() = 0;
virtual bool init() = 0;
virtual size_t intensity() const = 0;
virtual size_t roundSize() const = 0;
virtual size_t processedHashes() const = 0;
virtual bool init() = 0;
virtual bool run(uint32_t startNonce, uint32_t *rescount, uint32_t *resnonce) = 0;
virtual bool set(const Job &job, uint8_t *blob) = 0;
protected:
// virtual size_t bufferSize() const = 0;
virtual bool set(const Job &job, uint8_t *blob) = 0;
};

View file

@ -50,7 +50,7 @@ xmrig::CudaAstroBWTRunner::CudaAstroBWTRunner(size_t index, const CudaLaunchData
bool xmrig::CudaAstroBWTRunner::run(uint32_t startNonce, uint32_t *rescount, uint32_t *resnonce)
{
return callWrapper(CudaLib::AstroBWTHash(m_ctx, startNonce, m_target, rescount, resnonce));
return callWrapper(CudaLib::astroBWTHash(m_ctx, startNonce, m_target, rescount, resnonce));
}
@ -60,7 +60,7 @@ bool xmrig::CudaAstroBWTRunner::set(const Job &job, uint8_t *blob)
return false;
}
return callWrapper(CudaLib::AstroBWTPrepare(m_ctx, static_cast<uint32_t>(m_intensity)));
return callWrapper(CudaLib::astroBWTPrepare(m_ctx, static_cast<uint32_t>(m_intensity)));
}
size_t xmrig::CudaAstroBWTRunner::roundSize() const

View file

@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@ -47,6 +47,8 @@ static uv_lib_t cudaLib;
static const char *kAlloc = "alloc";
static const char *kAstroBWTHash = "astroBWTHash";
static const char *kAstroBWTPrepare = "astroBWTPrepare";
static const char *kCnHash = "cnHash";
static const char *kDeviceCount = "deviceCount";
static const char *kDeviceInfo = "deviceInfo";
@ -62,8 +64,6 @@ static const char *kPluginVersion = "pluginVersion";
static const char *kRelease = "release";
static const char *kRxHash = "rxHash";
static const char *kRxPrepare = "rxPrepare";
static const char *kAstroBWTHash = "AstroBWTHash";
static const char *kAstroBWTPrepare = "AstroBWTPrepare";
static const char *kSetJob = "setJob";
static const char *kSetJob_v2 = "setJob_v2";
static const char *kSymbolNotFound = "symbol not found";
@ -71,6 +71,8 @@ static const char *kVersion = "version";
using alloc_t = nvid_ctx * (*)(uint32_t, int32_t, int32_t);
using astroBWTHash_t = bool (*)(nvid_ctx *, uint32_t, uint64_t, uint32_t *, uint32_t *);
using astroBWTPrepare_t = bool (*)(nvid_ctx *, uint32_t);
using cnHash_t = bool (*)(nvid_ctx *, uint32_t, uint64_t, uint64_t, uint32_t *, uint32_t *);
using deviceCount_t = uint32_t (*)();
using deviceInfo_t = int32_t (*)(nvid_ctx *, int32_t, int32_t, int32_t, int32_t);
@ -85,8 +87,6 @@ using lastError_t = const char * (*)(nvid_
using pluginVersion_t = const char * (*)();
using release_t = void (*)(nvid_ctx *);
using rxHash_t = bool (*)(nvid_ctx *, uint32_t, uint64_t, uint32_t *, uint32_t *);
using AstroBWTHash_t = bool (*)(nvid_ctx *, uint32_t, uint64_t, uint32_t *, uint32_t *);
using AstroBWTPrepare_t = bool (*)(nvid_ctx *, uint32_t);
using rxPrepare_t = bool (*)(nvid_ctx *, const void *, size_t, bool, uint32_t);
using setJob_t = bool (*)(nvid_ctx *, const void *, size_t, int32_t);
using setJob_v2_t = bool (*)(nvid_ctx *, const void *, size_t, const char *);
@ -94,6 +94,8 @@ using version_t = uint32_t (*)(Version);
static alloc_t pAlloc = nullptr;
static astroBWTHash_t pAstroBWTHash = nullptr;
static astroBWTPrepare_t pAstroBWTPrepare = nullptr;
static cnHash_t pCnHash = nullptr;
static deviceCount_t pDeviceCount = nullptr;
static deviceInfo_t pDeviceInfo = nullptr;
@ -108,8 +110,6 @@ static lastError_t pLastError = nullptr;
static pluginVersion_t pPluginVersion = nullptr;
static release_t pRelease = nullptr;
static rxHash_t pRxHash = nullptr;
static AstroBWTHash_t pAstroBWTHash = nullptr;
static AstroBWTPrepare_t pAstroBWTPrepare = nullptr;
static rxPrepare_t pRxPrepare = nullptr;
static setJob_t pSetJob = nullptr;
static setJob_v2_t pSetJob_v2 = nullptr;
@ -151,6 +151,18 @@ void xmrig::CudaLib::close()
}
bool xmrig::CudaLib::astroBWTHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce) noexcept
{
return pAstroBWTHash(ctx, startNonce, target, rescount, resnonce);
}
bool xmrig::CudaLib::astroBWTPrepare(nvid_ctx *ctx, uint32_t batchSize) noexcept
{
return pAstroBWTPrepare(ctx, batchSize);
}
bool xmrig::CudaLib::cnHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t height, uint64_t target, uint32_t *rescount, uint32_t *resnonce)
{
return pCnHash(ctx, startNonce, height, target, rescount, resnonce);
@ -187,18 +199,6 @@ bool xmrig::CudaLib::rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datase
}
bool xmrig::CudaLib::AstroBWTHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce) noexcept
{
return pAstroBWTHash(ctx, startNonce, target, rescount, resnonce);
}
bool xmrig::CudaLib::AstroBWTPrepare(nvid_ctx *ctx, uint32_t batchSize) noexcept
{
return pAstroBWTPrepare(ctx, batchSize);
}
bool xmrig::CudaLib::setJob(nvid_ctx *ctx, const void *data, size_t size, const Algorithm &algorithm) noexcept
{
const Algorithm algo = RxAlgo::id(algorithm);

View file

@ -73,13 +73,13 @@ public:
static inline bool isReady() noexcept { return m_ready; }
static inline const String &loader() { return m_loader; }
static bool astroBWTHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce) noexcept;
static bool astroBWTPrepare(nvid_ctx *ctx, uint32_t batchSize) noexcept;
static bool cnHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t height, uint64_t target, uint32_t *rescount, uint32_t *resnonce);
static bool deviceInfo(nvid_ctx *ctx, int32_t blocks, int32_t threads, const Algorithm &algorithm, int32_t dataset_host = -1) noexcept;
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 AstroBWTHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce) noexcept;
static bool AstroBWTPrepare(nvid_ctx *ctx, uint32_t batchSize) noexcept;
static bool setJob(nvid_ctx *ctx, const void *data, size_t size, const Algorithm &algorithm) noexcept;
static const char *deviceName(nvid_ctx *ctx) noexcept;
static const char *lastError(nvid_ctx *ctx) noexcept;