mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 18:11:05 +00:00
Simplify branch buffers.
This commit is contained in:
parent
71329718e4
commit
96f3df3929
2 changed files with 34 additions and 22 deletions
|
@ -46,11 +46,17 @@ xmrig::OclCnRunner::OclCnRunner(size_t index, const OclLaunchData &data) : OclBa
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_states = OclLib::createBuffer(data.ctx, CL_MEM_READ_WRITE, 200 * g_thd, nullptr, &ret);
|
m_states = OclLib::createBuffer(data.ctx, CL_MEM_READ_WRITE, 200 * g_thd, nullptr, &ret);
|
||||||
m_blake256 = OclLib::createBuffer(data.ctx, CL_MEM_READ_WRITE, sizeof(cl_uint) * (g_thd + 2), nullptr, &ret);
|
if (ret != CL_SUCCESS) {
|
||||||
m_groestl256 = OclLib::createBuffer(data.ctx, CL_MEM_READ_WRITE, sizeof(cl_uint) * (g_thd + 2), nullptr, &ret);
|
return;
|
||||||
m_jh256 = OclLib::createBuffer(data.ctx, CL_MEM_READ_WRITE, sizeof(cl_uint) * (g_thd + 2), nullptr, &ret);
|
}
|
||||||
m_skein512 = OclLib::createBuffer(data.ctx, CL_MEM_READ_WRITE, sizeof(cl_uint) * (g_thd + 2), nullptr, &ret);
|
|
||||||
|
for (size_t i = 0; i < BRANCH_MAX; ++i) {
|
||||||
|
m_branches[i] = OclLib::createBuffer(data.ctx, CL_MEM_READ_WRITE, sizeof(cl_uint) * (g_thd + 2), nullptr, &ret);
|
||||||
|
if (ret != CL_SUCCESS) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t stridedIndex = data.thread.stridedIndex();
|
uint32_t stridedIndex = data.thread.stridedIndex();
|
||||||
if (data.device.vendorId() == OCL_VENDOR_NVIDIA) {
|
if (data.device.vendorId() == OCL_VENDOR_NVIDIA) {
|
||||||
|
@ -85,22 +91,22 @@ xmrig::OclCnRunner::~OclCnRunner()
|
||||||
|
|
||||||
OclLib::releaseMemObject(m_scratchpads);
|
OclLib::releaseMemObject(m_scratchpads);
|
||||||
OclLib::releaseMemObject(m_states);
|
OclLib::releaseMemObject(m_states);
|
||||||
OclLib::releaseMemObject(m_blake256);
|
|
||||||
OclLib::releaseMemObject(m_groestl256);
|
for (size_t i = 0; i < BRANCH_MAX; ++i) {
|
||||||
OclLib::releaseMemObject(m_jh256);
|
OclLib::releaseMemObject(m_branches[i]);
|
||||||
OclLib::releaseMemObject(m_skein512);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool xmrig::OclCnRunner::isReadyToBuild() const
|
bool xmrig::OclCnRunner::isReadyToBuild() const
|
||||||
{
|
{
|
||||||
return OclBaseRunner::isReadyToBuild() &&
|
return OclBaseRunner::isReadyToBuild() &&
|
||||||
m_scratchpads != nullptr &&
|
m_scratchpads != nullptr &&
|
||||||
m_states != nullptr &&
|
m_states != nullptr &&
|
||||||
m_blake256 != nullptr &&
|
m_branches[BRANCH_BLAKE_256] != nullptr &&
|
||||||
m_groestl256 != nullptr &&
|
m_branches[BRANCH_GROESTL_256] != nullptr &&
|
||||||
m_jh256 != nullptr &&
|
m_branches[BRANCH_JH_256] != nullptr &&
|
||||||
m_skein512 != nullptr;
|
m_branches[BRANCH_SKEIN_512] != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,13 +48,19 @@ protected:
|
||||||
void build() override;
|
void build() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cl_mem m_blake256 = nullptr;
|
enum Branches : size_t {
|
||||||
cl_mem m_groestl256 = nullptr;
|
BRANCH_BLAKE_256,
|
||||||
cl_mem m_jh256 = nullptr;
|
BRANCH_GROESTL_256,
|
||||||
cl_mem m_scratchpads = nullptr;
|
BRANCH_JH_256,
|
||||||
cl_mem m_skein512 = nullptr;
|
BRANCH_SKEIN_512,
|
||||||
cl_mem m_states = nullptr;
|
BRANCH_MAX
|
||||||
Cn0Kernel *m_cn0 = nullptr;
|
};
|
||||||
|
|
||||||
|
|
||||||
|
cl_mem m_branches[BRANCH_MAX] = { nullptr, nullptr, nullptr, nullptr };
|
||||||
|
cl_mem m_scratchpads = nullptr;
|
||||||
|
cl_mem m_states = nullptr;
|
||||||
|
Cn0Kernel *m_cn0 = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue