mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-25 13:42:54 -05:00
Added rx/yada OpenCL support
This commit is contained in:
@@ -87,7 +87,7 @@ size_t xmrig::OclCnRunner::bufferSize() const
|
||||
}
|
||||
|
||||
|
||||
void xmrig::OclCnRunner::run(uint32_t nonce, uint32_t *hashOutput)
|
||||
void xmrig::OclCnRunner::run(uint32_t nonce, uint32_t /*nonce_offset*/, uint32_t *hashOutput)
|
||||
{
|
||||
static const cl_uint zero = 0;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
protected:
|
||||
size_t bufferSize() const override;
|
||||
void run(uint32_t nonce, uint32_t *hashOutput) override;
|
||||
void run(uint32_t nonce, uint32_t nonce_offset, uint32_t *hashOutput) override;
|
||||
void set(const Job &job, uint8_t *blob) override;
|
||||
void build() override;
|
||||
void init() override;
|
||||
|
||||
@@ -75,7 +75,7 @@ OclKawPowRunner::~OclKawPowRunner()
|
||||
}
|
||||
|
||||
|
||||
void OclKawPowRunner::run(uint32_t nonce, uint32_t *hashOutput)
|
||||
void OclKawPowRunner::run(uint32_t nonce, uint32_t /*nonce_offset*/, uint32_t *hashOutput)
|
||||
{
|
||||
const size_t local_work_size = m_workGroupSize;
|
||||
const size_t global_work_offset = nonce;
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
~OclKawPowRunner() override;
|
||||
|
||||
protected:
|
||||
void run(uint32_t nonce, uint32_t *hashOutput) override;
|
||||
void run(uint32_t nonce, uint32_t nonce_offset, uint32_t *hashOutput) override;
|
||||
void set(const Job &job, uint8_t *blob) override;
|
||||
void build() override;
|
||||
void init() override;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "backend/opencl/kernels/rx/Blake2bHashRegistersKernel.h"
|
||||
#include "backend/opencl/kernels/rx/Blake2bInitialHashKernel.h"
|
||||
#include "backend/opencl/kernels/rx/Blake2bInitialHashDoubleKernel.h"
|
||||
#include "backend/opencl/kernels/rx/Blake2bInitialHashBigKernel.h"
|
||||
#include "backend/opencl/kernels/rx/FillAesKernel.h"
|
||||
#include "backend/opencl/kernels/rx/FindSharesKernel.h"
|
||||
#include "backend/opencl/kernels/rx/HashAesKernel.h"
|
||||
@@ -73,6 +74,7 @@ xmrig::OclRxBaseRunner::~OclRxBaseRunner()
|
||||
delete m_hashAes1Rx4;
|
||||
delete m_blake2b_initial_hash;
|
||||
delete m_blake2b_initial_hash_double;
|
||||
delete m_blake2b_initial_hash_big;
|
||||
delete m_blake2b_hash_registers_32;
|
||||
delete m_blake2b_hash_registers_64;
|
||||
delete m_find_shares;
|
||||
@@ -85,7 +87,7 @@ xmrig::OclRxBaseRunner::~OclRxBaseRunner()
|
||||
}
|
||||
|
||||
|
||||
void xmrig::OclRxBaseRunner::run(uint32_t nonce, uint32_t *hashOutput)
|
||||
void xmrig::OclRxBaseRunner::run(uint32_t nonce, uint32_t nonce_offset, uint32_t *hashOutput)
|
||||
{
|
||||
static const uint32_t zero = 0;
|
||||
|
||||
@@ -96,8 +98,7 @@ void xmrig::OclRxBaseRunner::run(uint32_t nonce, uint32_t *hashOutput)
|
||||
m_blake2b_initial_hash_double->setNonce(nonce);
|
||||
}
|
||||
else {
|
||||
hashOutput[0xFF] = 0;
|
||||
return;
|
||||
m_blake2b_initial_hash_big->setNonce(nonce, nonce_offset);
|
||||
}
|
||||
|
||||
m_find_shares->setNonce(nonce);
|
||||
@@ -107,9 +108,12 @@ void xmrig::OclRxBaseRunner::run(uint32_t nonce, uint32_t *hashOutput)
|
||||
if (m_jobSize <= 128) {
|
||||
m_blake2b_initial_hash->enqueue(m_queue, m_intensity);
|
||||
}
|
||||
else {
|
||||
else if (m_jobSize <= 256) {
|
||||
m_blake2b_initial_hash_double->enqueue(m_queue, m_intensity);
|
||||
}
|
||||
else {
|
||||
m_blake2b_initial_hash_big->enqueue(m_queue, m_intensity);
|
||||
}
|
||||
|
||||
m_fillAes1Rx4_scratchpad->enqueue(m_queue, m_intensity);
|
||||
|
||||
@@ -150,12 +154,15 @@ void xmrig::OclRxBaseRunner::set(const Job &job, uint8_t *blob)
|
||||
memset(blob + job.size(), 0, Job::kMaxBlobSize - job.size());
|
||||
}
|
||||
|
||||
memset(blob + job.nonceOffset(), 0, job.nonceSize());
|
||||
|
||||
enqueueWriteBuffer(m_input, CL_TRUE, 0, Job::kMaxBlobSize, blob);
|
||||
|
||||
m_jobSize = job.size();
|
||||
|
||||
m_blake2b_initial_hash->setBlobSize(job.size());
|
||||
m_blake2b_initial_hash_double->setBlobSize(job.size());
|
||||
m_blake2b_initial_hash_big->setBlobSize(job.size());
|
||||
|
||||
m_find_shares->setTarget(job.target());
|
||||
}
|
||||
@@ -191,6 +198,9 @@ void xmrig::OclRxBaseRunner::build()
|
||||
m_blake2b_initial_hash_double = new Blake2bInitialHashDoubleKernel(m_program);
|
||||
m_blake2b_initial_hash_double->setArgs(m_hashes, m_input);
|
||||
|
||||
m_blake2b_initial_hash_big = new Blake2bInitialHashBigKernel(m_program);
|
||||
m_blake2b_initial_hash_big->setArgs(m_hashes, m_input);
|
||||
|
||||
m_blake2b_hash_registers_32 = new Blake2bHashRegistersKernel(m_program, "blake2b_hash_registers_32");
|
||||
m_blake2b_hash_registers_64 = new Blake2bHashRegistersKernel(m_program, "blake2b_hash_registers_64");
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace xmrig {
|
||||
class Blake2bHashRegistersKernel;
|
||||
class Blake2bInitialHashKernel;
|
||||
class Blake2bInitialHashDoubleKernel;
|
||||
class Blake2bInitialHashBigKernel;
|
||||
class FillAesKernel;
|
||||
class FindSharesKernel;
|
||||
class HashAesKernel;
|
||||
@@ -53,7 +54,7 @@ protected:
|
||||
size_t bufferSize() const override;
|
||||
void build() override;
|
||||
void init() override;
|
||||
void run(uint32_t nonce, uint32_t *hashOutput) override;
|
||||
void run(uint32_t nonce, uint32_t nonce_offset, uint32_t *hashOutput) override;
|
||||
void set(const Job &job, uint8_t *blob) override;
|
||||
|
||||
protected:
|
||||
@@ -63,6 +64,7 @@ protected:
|
||||
Blake2bHashRegistersKernel *m_blake2b_hash_registers_64 = nullptr;
|
||||
Blake2bInitialHashKernel *m_blake2b_initial_hash = nullptr;
|
||||
Blake2bInitialHashDoubleKernel *m_blake2b_initial_hash_double = nullptr;
|
||||
Blake2bInitialHashBigKernel* m_blake2b_initial_hash_big = nullptr;
|
||||
Buffer m_seed;
|
||||
cl_mem m_dataset = nullptr;
|
||||
cl_mem m_entropy = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user