Implemented verification on CPU.

This commit is contained in:
XMRig 2019-09-01 19:31:25 +07:00
parent e2d2591281
commit eef5d91606
15 changed files with 1164 additions and 999 deletions

View file

@ -208,7 +208,7 @@ void xmrig::CpuWorker<N>::start()
for (size_t i = 0; i < N; ++i) {
if (*reinterpret_cast<uint64_t*>(m_hash + (i * 32) + 24) < job.target()) {
JobResults::submit(JobResult(job, *m_job.nonce(i), m_hash + (i * 32)));
JobResults::submit(job, *m_job.nonce(i), m_hash + (i * 32));
}
}

View file

@ -41,6 +41,6 @@ xmrig::OclLaunchData::OclLaunchData(const Miner *miner, const Algorithm &algorit
bool xmrig::OclLaunchData::isEqual(const OclLaunchData &other) const
{
return (other.algorithm.l3() == algorithm.l3() &&
other.thread == thread);
return (other.algorithm == algorithm &&
other.thread == thread);
}

View file

@ -68,7 +68,7 @@ xmrig::OclWorker::OclWorker(size_t id, const OclLaunchData &data) :
case Algorithm::ARGON2:
# ifdef XMRIG_ALGO_ARGON2
m_runner = nullptr; // TODO
m_runner = nullptr; // TODO OclArgon2Runner
# endif
break;
@ -120,6 +120,10 @@ void xmrig::OclWorker::start()
return;
}
if (results[0xFF] > 0) {
JobResults::submit(m_job.currentJob(), results, results[0xFF]);
}
m_job.nextRound(roundSize(m_intensity), m_intensity);
m_count += m_intensity;

View file

@ -74,7 +74,7 @@ inline ulong getIdx()
__attribute__((reqd_work_group_size(8, 8, 1)))
__kernel void cn0(__global ulong *input, __global uint4 *Scratchpad, __global ulong *states)
__kernel void cn0(__global ulong *input, __global uint4 *Scratchpad, __global ulong *states, uint Threads)
{
uint ExpandedKey1[40];
__local uint AES0[256], AES1[256], AES2[256], AES3[256];
@ -476,7 +476,7 @@ __kernel void cn1_v2(__global uint4 *Scratchpad, __global ulong *states, uint va
__attribute__((reqd_work_group_size(WORKSIZE, 1, 1)))
__kernel void cn1(__global ulong *input, __global uint4 *Scratchpad, __global ulong *states)
__kernel void cn1(__global ulong *input, __global uint4 *Scratchpad, __global ulong *states, uint Threads)
{
ulong a[2], b[2];
__local uint AES0[256], AES1[256];
@ -548,11 +548,11 @@ __kernel void cn1(__global ulong *input, __global uint4 *Scratchpad, __global ul
long q = fast_div_heavy(n.s0, as_int4(n).s2 | 0x5);
*((__global long*)(Scratchpad + (IDX((idx0 & MASK) >> 4)))) = n.s0 ^ q;
if (variant == VARIANT_XHV) {
idx0 = (~as_int4(n).s2) ^ q;
} else {
idx0 = as_int4(n).s2 ^ q;
}
# if (ALGO == ALGO_CN_HEAVY_XHV) {
idx0 = (~as_int4(n).s2) ^ q;
# else
idx0 = as_int4(n).s2 ^ q;
# endif
}
# endif
}

File diff suppressed because it is too large Load diff

View file

@ -42,10 +42,11 @@ bool xmrig::Cn0Kernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t th
}
// __kernel void cn0(__global ulong *input, __global uint4 *Scratchpad, __global ulong *states)
bool xmrig::Cn0Kernel::setArgs(cl_mem input, cl_mem scratchpads, cl_mem states)
// __kernel void cn0(__global ulong *input, __global uint4 *Scratchpad, __global ulong *states, uint Threads)
bool xmrig::Cn0Kernel::setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads)
{
return setArg(0, sizeof(cl_mem), &input) &&
setArg(1, sizeof(cl_mem), &scratchpads) &&
setArg(2, sizeof(cl_mem), &states);
setArg(2, sizeof(cl_mem), &states) &&
setArg(3, sizeof(uint32_t), &threads);
}

View file

@ -37,7 +37,7 @@ class Cn0Kernel : public OclKernel
public:
Cn0Kernel(cl_program program);
bool enqueue(cl_command_queue queue, uint32_t nonce, size_t threads);
bool setArgs(cl_mem input, cl_mem scratchpads, cl_mem states);
bool setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads);
};

View file

@ -42,10 +42,11 @@ bool xmrig::Cn1Kernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t th
}
// __kernel void cn1(__global ulong *input, __global uint4 *Scratchpad, __global ulong *states)
bool xmrig::Cn1Kernel::setArgs(cl_mem input, cl_mem scratchpads, cl_mem states)
// __kernel void cn1(__global ulong *input, __global uint4 *Scratchpad, __global ulong *states, uint Threads)
bool xmrig::Cn1Kernel::setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads)
{
return setArg(0, sizeof(cl_mem), &input) &&
setArg(1, sizeof(cl_mem), &scratchpads) &&
setArg(2, sizeof(cl_mem), &states);
setArg(2, sizeof(cl_mem), &states) &&
setArg(3, sizeof(uint32_t), &threads);
}

View file

@ -37,7 +37,7 @@ class Cn1Kernel : public OclKernel
public:
Cn1Kernel(cl_program program);
bool enqueue(cl_command_queue queue, uint32_t nonce, size_t threads, size_t worksize);
bool setArgs(cl_mem input, cl_mem scratchpads, cl_mem states);
bool setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads);
};

View file

@ -188,16 +188,16 @@ bool xmrig::OclCnRunner::set(const Job &job, uint8_t *blob)
return false;
}
if (!m_cn0->setArgs(m_input, m_scratchpads, m_states)) {
return false;
}
if (!m_cn1->setArgs(m_input, m_scratchpads, m_states)) {
return false;
}
const uint32_t intensity = data().thread.intensity();
if (!m_cn0->setArgs(m_input, m_scratchpads, m_states, intensity)) {
return false;
}
if (!m_cn1->setArgs(m_input, m_scratchpads, m_states, intensity)) {
return false;
}
if (!m_cn2->setArgs(m_scratchpads, m_states, m_branches, intensity)) {
return false;
}

View file

@ -38,7 +38,7 @@ bool xmrig::OclRxRunner::run(uint32_t nonce, uint32_t *hashOutput)
bool xmrig::OclRxRunner::selfTest() const
{
return false; // TODO
return false; // TODO OclRxRunner
}