mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-24 20:49:25 +00:00
Merge pull request #1901 from cohcho/fix_math1
WorkerJob: fix calls of add/nextRound
This commit is contained in:
commit
ccebf6bb20
3 changed files with 4 additions and 35 deletions
|
@ -64,19 +64,6 @@ std::atomic<bool> CudaWorker::ready;
|
||||||
static inline bool isReady() { return !Nonce::isPaused() && CudaWorker::ready; }
|
static inline bool isReady() { return !Nonce::isPaused() && CudaWorker::ready; }
|
||||||
|
|
||||||
|
|
||||||
static inline uint32_t roundSize(uint32_t intensity)
|
|
||||||
{
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
unsigned long index;
|
|
||||||
_BitScanReverse(&index, intensity - 1);
|
|
||||||
const uint32_t n = 31 - index;
|
|
||||||
#else
|
|
||||||
const uint32_t n = __builtin_clz(intensity - 1);
|
|
||||||
#endif
|
|
||||||
return 1U << (32 - n);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace xmrig
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,8 +175,7 @@ void xmrig::CudaWorker::start()
|
||||||
JobResults::submit(m_job.currentJob(), foundNonce, foundCount, m_deviceIndex);
|
JobResults::submit(m_job.currentJob(), foundNonce, foundCount, m_deviceIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t batch_size = intensity();
|
if (!Nonce::isOutdated(Nonce::CUDA, m_job.sequence()) && !m_job.nextRound(1, intensity())) {
|
||||||
if (!Nonce::isOutdated(Nonce::CUDA, m_job.sequence()) && !m_job.nextRound(1, roundSize(batch_size))) {
|
|
||||||
JobResults::done(m_job.currentJob());
|
JobResults::done(m_job.currentJob());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,8 +196,7 @@ bool xmrig::CudaWorker::consumeJob()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t batch_size = intensity();
|
m_job.add(m_miner->job(), intensity(), Nonce::CUDA);
|
||||||
m_job.add(m_miner->job(), roundSize(batch_size), Nonce::CUDA);
|
|
||||||
|
|
||||||
return m_runner->set(m_job.currentJob(), m_job.blob());
|
return m_runner->set(m_job.currentJob(), m_job.blob());
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,18 +61,6 @@ std::atomic<bool> OclWorker::ready;
|
||||||
|
|
||||||
static inline bool isReady() { return !Nonce::isPaused() && OclWorker::ready; }
|
static inline bool isReady() { return !Nonce::isPaused() && OclWorker::ready; }
|
||||||
|
|
||||||
static inline uint32_t roundSize(uint32_t intensity)
|
|
||||||
{
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
unsigned long index;
|
|
||||||
_BitScanReverse(&index, intensity - 1);
|
|
||||||
const uint32_t n = 31 - index;
|
|
||||||
#else
|
|
||||||
const uint32_t n = __builtin_clz(intensity - 1);
|
|
||||||
#endif
|
|
||||||
return 1U << (32 - n);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline void printError(size_t id, const char *error)
|
static inline void printError(size_t id, const char *error)
|
||||||
{
|
{
|
||||||
|
@ -88,7 +76,6 @@ xmrig::OclWorker::OclWorker(size_t id, const OclLaunchData &data) :
|
||||||
Worker(id, data.affinity, -1),
|
Worker(id, data.affinity, -1),
|
||||||
m_algorithm(data.algorithm),
|
m_algorithm(data.algorithm),
|
||||||
m_miner(data.miner),
|
m_miner(data.miner),
|
||||||
m_intensity(data.thread.intensity()),
|
|
||||||
m_sharedData(OclSharedState::get(data.device.index())),
|
m_sharedData(OclSharedState::get(data.device.index())),
|
||||||
m_deviceIndex(data.device.index())
|
m_deviceIndex(data.device.index())
|
||||||
{
|
{
|
||||||
|
@ -180,8 +167,6 @@ void xmrig::OclWorker::start()
|
||||||
{
|
{
|
||||||
cl_uint results[0x100];
|
cl_uint results[0x100];
|
||||||
|
|
||||||
const uint32_t runnerRoundSize = roundSize(m_runner->roundSize());
|
|
||||||
|
|
||||||
while (Nonce::sequence(Nonce::OPENCL) > 0) {
|
while (Nonce::sequence(Nonce::OPENCL) > 0) {
|
||||||
if (!isReady()) {
|
if (!isReady()) {
|
||||||
m_sharedData.setResumeCounter(0);
|
m_sharedData.setResumeCounter(0);
|
||||||
|
@ -220,7 +205,7 @@ void xmrig::OclWorker::start()
|
||||||
JobResults::submit(m_job.currentJob(), results, results[0xFF], m_deviceIndex);
|
JobResults::submit(m_job.currentJob(), results, results[0xFF], m_deviceIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Nonce::isOutdated(Nonce::OPENCL, m_job.sequence()) && !m_job.nextRound(1, runnerRoundSize)) {
|
if (!Nonce::isOutdated(Nonce::OPENCL, m_job.sequence()) && !m_job.nextRound(1, intensity())) {
|
||||||
JobResults::done(m_job.currentJob());
|
JobResults::done(m_job.currentJob());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +226,7 @@ bool xmrig::OclWorker::consumeJob()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_job.add(m_miner->job(), roundSize(m_intensity), Nonce::OPENCL);
|
m_job.add(m_miner->job(), intensity(), Nonce::OPENCL);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
m_runner->set(m_job.currentJob(), m_job.blob());
|
m_runner->set(m_job.currentJob(), m_job.blob());
|
||||||
|
|
|
@ -67,7 +67,6 @@ private:
|
||||||
|
|
||||||
const Algorithm m_algorithm;
|
const Algorithm m_algorithm;
|
||||||
const Miner *m_miner;
|
const Miner *m_miner;
|
||||||
const uint32_t m_intensity;
|
|
||||||
IOclRunner *m_runner = nullptr;
|
IOclRunner *m_runner = nullptr;
|
||||||
OclSharedData &m_sharedData;
|
OclSharedData &m_sharedData;
|
||||||
WorkerJob<1> m_job;
|
WorkerJob<1> m_job;
|
||||||
|
|
Loading…
Reference in a new issue