KawPow: reduced stale/expired shares
This commit is contained in:
parent
95ef32c913
commit
9cbdb7f1f2
22 changed files with 218 additions and 104 deletions
|
@ -49,16 +49,17 @@ public:
|
|||
~OclBaseRunner() override;
|
||||
|
||||
protected:
|
||||
inline cl_context ctx() const override { return m_ctx; }
|
||||
inline const Algorithm &algorithm() const override { return m_algorithm; }
|
||||
inline const char *buildOptions() const override { return m_options.c_str(); }
|
||||
inline const char *deviceKey() const override { return m_deviceKey.c_str(); }
|
||||
inline const char *source() const override { return m_source; }
|
||||
inline const OclLaunchData &data() const override { return m_data; }
|
||||
inline size_t intensity() const override { return m_intensity; }
|
||||
inline size_t threadId() const override { return m_threadId; }
|
||||
inline uint32_t roundSize() const override { return m_intensity; }
|
||||
inline uint32_t processedHashes() const override { return m_intensity; }
|
||||
inline cl_context ctx() const override { return m_ctx; }
|
||||
inline const Algorithm &algorithm() const override { return m_algorithm; }
|
||||
inline const char *buildOptions() const override { return m_options.c_str(); }
|
||||
inline const char *deviceKey() const override { return m_deviceKey.c_str(); }
|
||||
inline const char *source() const override { return m_source; }
|
||||
inline const OclLaunchData &data() const override { return m_data; }
|
||||
inline size_t intensity() const override { return m_intensity; }
|
||||
inline size_t threadId() const override { return m_threadId; }
|
||||
inline uint32_t roundSize() const override { return m_intensity; }
|
||||
inline uint32_t processedHashes() const override { return m_intensity; }
|
||||
inline void jobEarlyNotification(const Job&) override {}
|
||||
|
||||
size_t bufferSize() const override;
|
||||
uint32_t deviceIndex() const override;
|
||||
|
|
|
@ -71,6 +71,9 @@ OclKawPowRunner::~OclKawPowRunner()
|
|||
|
||||
OclLib::release(m_searchKernel);
|
||||
|
||||
OclLib::release(m_controlQueue);
|
||||
OclLib::release(m_stop);
|
||||
|
||||
OclKawPow::clear();
|
||||
}
|
||||
|
||||
|
@ -83,8 +86,11 @@ void OclKawPowRunner::run(uint32_t nonce, uint32_t *hashOutput)
|
|||
|
||||
enqueueWriteBuffer(m_input, CL_FALSE, 0, 40, m_blob);
|
||||
|
||||
const uint32_t zero = 0;
|
||||
enqueueWriteBuffer(m_output, CL_FALSE, 0, sizeof(uint32_t), &zero);
|
||||
const uint32_t zero[2] = {};
|
||||
enqueueWriteBuffer(m_output, CL_FALSE, 0, sizeof(uint32_t), zero);
|
||||
enqueueWriteBuffer(m_stop, CL_FALSE, 0, sizeof(uint32_t) * 2, zero);
|
||||
|
||||
m_skippedHashes = 0;
|
||||
|
||||
const cl_int ret = OclLib::enqueueNDRangeKernel(m_queue, m_searchKernel, 1, &global_work_offset, &global_work_size, &local_work_size, 0, nullptr, nullptr);
|
||||
if (ret != CL_SUCCESS) {
|
||||
|
@ -94,9 +100,14 @@ void OclKawPowRunner::run(uint32_t nonce, uint32_t *hashOutput)
|
|||
throw std::runtime_error(OclError::toString(ret));
|
||||
}
|
||||
|
||||
uint32_t stop[2] = {};
|
||||
enqueueReadBuffer(m_stop, CL_FALSE, 0, sizeof(stop), stop);
|
||||
|
||||
uint32_t output[16] = {};
|
||||
enqueueReadBuffer(m_output, CL_TRUE, 0, sizeof(output), output);
|
||||
|
||||
m_skippedHashes = stop[1] * m_workGroupSize;
|
||||
|
||||
if (output[0] > 15) {
|
||||
output[0] = 15;
|
||||
}
|
||||
|
@ -166,12 +177,23 @@ void OclKawPowRunner::set(const Job &job, uint8_t *blob)
|
|||
OclLib::setKernelArg(m_searchKernel, 2, sizeof(target), &target);
|
||||
OclLib::setKernelArg(m_searchKernel, 3, sizeof(hack_false), &hack_false);
|
||||
OclLib::setKernelArg(m_searchKernel, 4, sizeof(m_output), &m_output);
|
||||
OclLib::setKernelArg(m_searchKernel, 5, sizeof(m_stop), &m_stop);
|
||||
|
||||
m_blob = blob;
|
||||
enqueueWriteBuffer(m_input, CL_TRUE, 0, sizeof(m_blob), m_blob);
|
||||
}
|
||||
|
||||
|
||||
void OclKawPowRunner::jobEarlyNotification(const Job&)
|
||||
{
|
||||
const uint32_t one = 1;
|
||||
const cl_int ret = OclLib::enqueueWriteBuffer(m_controlQueue, m_stop, CL_TRUE, 0, sizeof(one), &one, 0, nullptr, nullptr);
|
||||
if (ret != CL_SUCCESS) {
|
||||
throw std::runtime_error(OclError::toString(ret));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::OclKawPowRunner::build()
|
||||
{
|
||||
OclBaseRunner::build();
|
||||
|
@ -183,6 +205,9 @@ void xmrig::OclKawPowRunner::build()
|
|||
void xmrig::OclKawPowRunner::init()
|
||||
{
|
||||
OclBaseRunner::init();
|
||||
|
||||
m_controlQueue = OclLib::createCommandQueue(m_ctx, data().device.id());
|
||||
m_stop = OclLib::createBuffer(m_ctx, CL_MEM_READ_ONLY, sizeof(uint32_t) * 2);
|
||||
}
|
||||
|
||||
} // namespace xmrig
|
||||
|
|
|
@ -50,9 +50,12 @@ protected:
|
|||
void set(const Job &job, uint8_t *blob) override;
|
||||
void build() override;
|
||||
void init() override;
|
||||
void jobEarlyNotification(const Job& job) override;
|
||||
uint32_t processedHashes() const override { return m_intensity - m_skippedHashes; }
|
||||
|
||||
private:
|
||||
uint8_t* m_blob = nullptr;
|
||||
uint32_t m_skippedHashes = 0;
|
||||
|
||||
uint32_t m_blockHeight = 0;
|
||||
uint32_t m_epoch = 0xFFFFFFFFUL;
|
||||
|
@ -71,6 +74,9 @@ private:
|
|||
|
||||
size_t m_workGroupSize = 256;
|
||||
size_t m_dagWorkGroupSize = 64;
|
||||
|
||||
cl_command_queue m_controlQueue = nullptr;
|
||||
cl_mem m_stop = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue