Merge pull request #1901 from cohcho/fix_math1

WorkerJob: fix calls of add/nextRound
This commit is contained in:
xmrig 2020-10-15 22:29:20 +07:00 committed by GitHub
commit ccebf6bb20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 35 deletions

View file

@ -64,19 +64,6 @@ std::atomic<bool> 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
@ -188,8 +175,7 @@ void xmrig::CudaWorker::start()
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, roundSize(batch_size))) {
if (!Nonce::isOutdated(Nonce::CUDA, m_job.sequence()) && !m_job.nextRound(1, intensity())) {
JobResults::done(m_job.currentJob());
}
@ -210,8 +196,7 @@ bool xmrig::CudaWorker::consumeJob()
return false;
}
const size_t batch_size = intensity();
m_job.add(m_miner->job(), roundSize(batch_size), Nonce::CUDA);
m_job.add(m_miner->job(), intensity(), Nonce::CUDA);
return m_runner->set(m_job.currentJob(), m_job.blob());
}

View file

@ -61,18 +61,6 @@ std::atomic<bool> 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)
{
@ -88,7 +76,6 @@ xmrig::OclWorker::OclWorker(size_t id, const OclLaunchData &data) :
Worker(id, data.affinity, -1),
m_algorithm(data.algorithm),
m_miner(data.miner),
m_intensity(data.thread.intensity()),
m_sharedData(OclSharedState::get(data.device.index())),
m_deviceIndex(data.device.index())
{
@ -180,8 +167,6 @@ void xmrig::OclWorker::start()
{
cl_uint results[0x100];
const uint32_t runnerRoundSize = roundSize(m_runner->roundSize());
while (Nonce::sequence(Nonce::OPENCL) > 0) {
if (!isReady()) {
m_sharedData.setResumeCounter(0);
@ -220,7 +205,7 @@ void xmrig::OclWorker::start()
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());
}
@ -241,7 +226,7 @@ bool xmrig::OclWorker::consumeJob()
return false;
}
m_job.add(m_miner->job(), roundSize(m_intensity), Nonce::OPENCL);
m_job.add(m_miner->job(), intensity(), Nonce::OPENCL);
try {
m_runner->set(m_job.currentJob(), m_job.blob());

View file

@ -67,7 +67,6 @@ private:
const Algorithm m_algorithm;
const Miner *m_miner;
const uint32_t m_intensity;
IOclRunner *m_runner = nullptr;
OclSharedData &m_sharedData;
WorkerJob<1> m_job;