Initial stub for setting job in OpenCL backend.
This commit is contained in:
parent
fcfb738ded
commit
aa294ff066
10 changed files with 67 additions and 23 deletions
|
@ -73,15 +73,21 @@ xmrig::OclBaseRunner::~OclBaseRunner()
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::OclBaseRunner::selfTest() const
|
||||
bool xmrig::OclBaseRunner::isReadyToBuild() const
|
||||
{
|
||||
return m_queue != nullptr && m_input != nullptr && m_output != nullptr && !m_options.empty() && m_source != nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::OclBaseRunner::selfTest() const
|
||||
{
|
||||
return isReadyToBuild() && m_program != nullptr;
|
||||
}
|
||||
|
||||
|
||||
void xmrig::OclBaseRunner::build()
|
||||
{
|
||||
if (!selfTest()) {
|
||||
if (!isReadyToBuild()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -93,9 +99,3 @@ void xmrig::OclBaseRunner::run(uint32_t *hashOutput)
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void xmrig::OclBaseRunner::set(const Job &job)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -53,10 +53,10 @@ protected:
|
|||
inline const OclLaunchData &data() const override { return m_data; }
|
||||
inline size_t threadId() const override { return m_threadId; }
|
||||
|
||||
bool isReadyToBuild() const override;
|
||||
bool selfTest() const override;
|
||||
void build() override;
|
||||
void run(uint32_t *hashOutput) override;
|
||||
void set(const Job &job) override;
|
||||
|
||||
protected:
|
||||
Algorithm m_algorithm;
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "backend/opencl/OclLaunchData.h"
|
||||
#include "backend/opencl/runners/OclCnRunner.h"
|
||||
#include "backend/opencl/wrappers/OclLib.h"
|
||||
#include "backend/opencl/OclLaunchData.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/net/stratum/Job.h"
|
||||
#include "crypto/cn/CnAlgo.h"
|
||||
|
||||
|
||||
|
@ -87,9 +89,9 @@ xmrig::OclCnRunner::~OclCnRunner()
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::OclCnRunner::selfTest() const
|
||||
bool xmrig::OclCnRunner::isReadyToBuild() const
|
||||
{
|
||||
return OclBaseRunner::selfTest() &&
|
||||
return OclBaseRunner::isReadyToBuild() &&
|
||||
m_scratchpads != nullptr &&
|
||||
m_states != nullptr &&
|
||||
m_blake256 != nullptr &&
|
||||
|
@ -97,3 +99,20 @@ bool xmrig::OclCnRunner::selfTest() const
|
|||
m_jh256 != nullptr &&
|
||||
m_skein512 != nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::OclCnRunner::set(const Job &job, uint8_t *blob)
|
||||
{
|
||||
if (job.size() > (Job::kMaxBlobSize - 4)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
blob[job.size()] = 0x01;
|
||||
memset(blob + job.size() + 1, 0, Job::kMaxBlobSize - job.size() - 1);
|
||||
|
||||
if (OclLib::enqueueWriteBuffer(m_queue, m_input, CL_TRUE, 0, Job::kMaxBlobSize, blob, 0, nullptr, nullptr) != CL_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,8 @@ public:
|
|||
~OclCnRunner() override;
|
||||
|
||||
protected:
|
||||
bool selfTest() const override;
|
||||
bool isReadyToBuild() const override;
|
||||
bool set(const Job &job, uint8_t *blob) override;
|
||||
|
||||
private:
|
||||
cl_mem m_blake256 = nullptr;
|
||||
|
|
|
@ -34,3 +34,9 @@ bool xmrig::OclRxRunner::selfTest() const
|
|||
{
|
||||
return false; // TODO
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::OclRxRunner::set(const Job &job, uint8_t *blob)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
|
||||
protected:
|
||||
bool selfTest() const override;
|
||||
bool set(const Job &job, uint8_t *blob) override;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue