KawPow: reduced stale/expired shares
This commit is contained in:
parent
95ef32c913
commit
9cbdb7f1f2
22 changed files with 218 additions and 104 deletions
|
@ -372,8 +372,11 @@ void xmrig::CudaBackend::execCommand(char)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::CudaBackend::prepare(const Job &)
|
||||
void xmrig::CudaBackend::prepare(const Job &job)
|
||||
{
|
||||
if (d_ptr) {
|
||||
d_ptr->workers.jobEarlyNotification(job);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -118,6 +118,14 @@ xmrig::CudaWorker::~CudaWorker()
|
|||
}
|
||||
|
||||
|
||||
void xmrig::CudaWorker::jobEarlyNotification(const Job& job)
|
||||
{
|
||||
if (m_runner) {
|
||||
m_runner->jobEarlyNotification(job);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaWorker::selfTest()
|
||||
{
|
||||
return m_runner != nullptr;
|
||||
|
|
|
@ -49,6 +49,8 @@ public:
|
|||
|
||||
~CudaWorker() override;
|
||||
|
||||
void jobEarlyNotification(const Job&) override;
|
||||
|
||||
static std::atomic<bool> ready;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
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;
|
||||
virtual void jobEarlyNotification(const Job&) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ protected:
|
|||
size_t intensity() const override;
|
||||
size_t roundSize() const override { return intensity(); }
|
||||
size_t processedHashes() const override { return intensity(); }
|
||||
void jobEarlyNotification(const Job&) override {}
|
||||
|
||||
protected:
|
||||
bool callWrapper(bool result) const;
|
||||
|
|
|
@ -43,7 +43,7 @@ xmrig::CudaKawPowRunner::CudaKawPowRunner(size_t index, const CudaLaunchData &da
|
|||
|
||||
bool xmrig::CudaKawPowRunner::run(uint32_t /*startNonce*/, uint32_t *rescount, uint32_t *resnonce)
|
||||
{
|
||||
return callWrapper(CudaLib::kawPowHash(m_ctx, m_jobBlob, m_target, rescount, resnonce));
|
||||
return callWrapper(CudaLib::kawPowHash(m_ctx, m_jobBlob, m_target, rescount, resnonce, &m_skippedHashes));
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,3 +75,9 @@ bool xmrig::CudaKawPowRunner::set(const Job &job, uint8_t *blob)
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CudaKawPowRunner::jobEarlyNotification(const Job&)
|
||||
{
|
||||
CudaLib::kawPowStopHash(m_ctx);
|
||||
}
|
||||
|
|
|
@ -40,9 +40,12 @@ public:
|
|||
protected:
|
||||
bool run(uint32_t startNonce, uint32_t *rescount, uint32_t *resnonce) override;
|
||||
bool set(const Job &job, uint8_t *blob) override;
|
||||
size_t processedHashes() const override { return intensity() - m_skippedHashes; }
|
||||
void jobEarlyNotification(const Job&) override;
|
||||
|
||||
private:
|
||||
uint8_t* m_jobBlob;
|
||||
uint8_t* m_jobBlob = nullptr;
|
||||
uint32_t m_skippedHashes = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ static const char *kRxHash = "rxHash";
|
|||
static const char *kRxPrepare = "rxPrepare";
|
||||
static const char *kKawPowHash = "kawPowHash";
|
||||
static const char *kKawPowPrepare = "kawPowPrepare";
|
||||
static const char *kKawPowStopHash = "kawPowStopHash";
|
||||
static const char *kSetJob = "setJob";
|
||||
static const char *kSetJob_v2 = "setJob_v2";
|
||||
static const char *kVersion = "version";
|
||||
|
@ -90,8 +91,9 @@ 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 rxPrepare_t = bool (*)(nvid_ctx *, const void *, size_t, bool, uint32_t);
|
||||
using kawPowHash_t = bool (*)(nvid_ctx *, uint8_t*, uint64_t, uint32_t *, uint32_t *);
|
||||
using kawPowHash_t = bool (*)(nvid_ctx *, uint8_t*, uint64_t, uint32_t *, uint32_t *, uint32_t *);
|
||||
using kawPowPrepare_t = bool (*)(nvid_ctx *, const void *, size_t, size_t, uint32_t, const uint64_t*);
|
||||
using kawPowStopHash_t = bool (*)(nvid_ctx *);
|
||||
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 *);
|
||||
using version_t = uint32_t (*)(Version);
|
||||
|
@ -117,6 +119,7 @@ static rxHash_t pRxHash = nullptr;
|
|||
static rxPrepare_t pRxPrepare = nullptr;
|
||||
static kawPowHash_t pKawPowHash = nullptr;
|
||||
static kawPowPrepare_t pKawPowPrepare = nullptr;
|
||||
static kawPowStopHash_t pKawPowStopHash = nullptr;
|
||||
static setJob_t pSetJob = nullptr;
|
||||
static setJob_v2_t pSetJob_v2 = nullptr;
|
||||
static version_t pVersion = nullptr;
|
||||
|
@ -205,9 +208,9 @@ bool xmrig::CudaLib::rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datase
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::kawPowHash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t target, uint32_t *rescount, uint32_t *resnonce) noexcept
|
||||
bool xmrig::CudaLib::kawPowHash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t *skipped_hashes) noexcept
|
||||
{
|
||||
return pKawPowHash(ctx, job_blob, target, rescount, resnonce);
|
||||
return pKawPowHash(ctx, job_blob, target, rescount, resnonce, skipped_hashes);
|
||||
}
|
||||
|
||||
|
||||
|
@ -217,6 +220,12 @@ bool xmrig::CudaLib::kawPowPrepare(nvid_ctx *ctx, const void* cache, size_t cach
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::kawPowStopHash(nvid_ctx *ctx) noexcept
|
||||
{
|
||||
return pKawPowStopHash(ctx);
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::setJob(nvid_ctx *ctx, const void *data, size_t size, const Algorithm &algorithm) noexcept
|
||||
{
|
||||
const Algorithm algo = RxAlgo::id(algorithm);
|
||||
|
@ -367,6 +376,7 @@ bool xmrig::CudaLib::load()
|
|||
DLSYM(AstroBWTPrepare);
|
||||
DLSYM(KawPowHash);
|
||||
DLSYM(KawPowPrepare);
|
||||
DLSYM(KawPowStopHash);
|
||||
DLSYM(Version);
|
||||
|
||||
if (!pDeviceInfo_v2) {
|
||||
|
|
|
@ -80,8 +80,9 @@ 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 kawPowHash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t target, uint32_t *rescount, uint32_t *resnonce) 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, size_t dag_size, uint32_t height, const uint64_t* dag_sizes) noexcept;
|
||||
static bool kawPowStopHash(nvid_ctx *ctx) 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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue