Implemented cn0 kernel launch.

This commit is contained in:
XMRig 2019-09-01 07:05:49 +07:00
parent ce3e2401cb
commit b541960611
15 changed files with 108 additions and 49 deletions

View file

@ -93,9 +93,3 @@ void xmrig::OclBaseRunner::build()
m_program = OclCache::build(this);
}
void xmrig::OclBaseRunner::run(uint32_t *hashOutput)
{
}

View file

@ -56,7 +56,6 @@ protected:
bool isReadyToBuild() const override;
bool selfTest() const override;
void build() override;
void run(uint32_t *hashOutput) override;
protected:
Algorithm m_algorithm;

View file

@ -110,6 +110,37 @@ bool xmrig::OclCnRunner::isReadyToBuild() const
}
bool xmrig::OclCnRunner::run(uint32_t nonce, uint32_t *hashOutput)
{
static const cl_uint zero = 0;
cl_int ret;
size_t branchNonces[4] = { 0 };
const size_t g_intensity = data().thread.intensity();
const size_t w_size = data().thread.worksize();
const size_t g_thd = ((g_intensity + w_size - 1u) / w_size) * w_size;
for (size_t i = 0; i < BRANCH_MAX; ++i) {
if (OclLib::enqueueWriteBuffer(m_queue, m_branches[i], CL_FALSE, sizeof(cl_uint) * g_intensity, sizeof(cl_uint), &zero, 0, nullptr, nullptr) != CL_SUCCESS) {
return false;
}
}
if (OclLib::enqueueWriteBuffer(m_queue, m_output, CL_FALSE, sizeof(cl_uint) * 0xFF, sizeof(cl_uint), &zero, 0, nullptr, nullptr) != CL_SUCCESS) {
return false;
}
if (!m_cn0->enqueue(m_queue, nonce, g_thd)) {
return false;
}
OclLib::finish(m_queue);
return true;
}
bool xmrig::OclCnRunner::selfTest() const
{
return OclBaseRunner::selfTest() && m_cn0->isValid();
@ -133,8 +164,7 @@ bool xmrig::OclCnRunner::set(const Job &job, uint8_t *blob)
return false;
}
LOG_WARN(GREEN_S "OK");
return false;
return true;
}

View file

@ -43,6 +43,7 @@ public:
protected:
bool isReadyToBuild() const override;
bool run(uint32_t nonce, uint32_t *hashOutput) override;
bool selfTest() const override;
bool set(const Job &job, uint8_t *blob) override;
void build() override;

View file

@ -30,6 +30,12 @@ xmrig::OclRxRunner::OclRxRunner(size_t index, const OclLaunchData &data) : OclBa
}
bool xmrig::OclRxRunner::run(uint32_t nonce, uint32_t *hashOutput)
{
return false;
}
bool xmrig::OclRxRunner::selfTest() const
{
return false; // TODO

View file

@ -38,6 +38,7 @@ public:
OclRxRunner(size_t index, const OclLaunchData &data);
protected:
bool run(uint32_t nonce, uint32_t *hashOutput) override;
bool selfTest() const override;
bool set(const Job &job, uint8_t *blob) override;
};