Implemented option "dataset_host".
This commit is contained in:
parent
7f0891a0f0
commit
ad7141fe21
5 changed files with 31 additions and 9 deletions
|
@ -23,19 +23,32 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "backend/opencl/wrappers/OclLib.h"
|
||||
#include "backend/opencl/runners/tools/OclRxDataset.h"
|
||||
#include "backend/opencl/wrappers/OclLib.h"
|
||||
#include "crypto/rx/Rx.h"
|
||||
#include "crypto/rx/RxDataset.h"
|
||||
|
||||
|
||||
void xmrig::OclRxDataset::createBuffer(cl_context ctx, const Algorithm &algorithm, bool host)
|
||||
void xmrig::OclRxDataset::createBuffer(cl_context ctx, const Job &job, bool host)
|
||||
{
|
||||
if (m_dataset) {
|
||||
return;
|
||||
}
|
||||
|
||||
cl_int ret;
|
||||
|
||||
if (host) {
|
||||
// TODO use host memory for dataset
|
||||
auto dataset = Rx::dataset(job, 0);
|
||||
|
||||
m_dataset = OclLib::createBuffer(ctx, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, RxDataset::maxSize(), dataset->raw(), &ret);
|
||||
}
|
||||
else {
|
||||
m_dataset = OclLib::createBuffer(ctx, CL_MEM_READ_ONLY, RxDataset::maxSize(), nullptr, &ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xmrig::OclRxDataset::~OclRxDataset()
|
||||
{
|
||||
OclLib::release(m_dataset);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
#define XMRIG_OCLRXDATASET_H
|
||||
|
||||
|
||||
#include "base/tools/Object.h"
|
||||
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
@ -36,17 +39,20 @@ using cl_mem = struct _cl_mem *;
|
|||
namespace xmrig {
|
||||
|
||||
|
||||
class Algorithm;
|
||||
class Job;
|
||||
|
||||
|
||||
class OclRxDataset
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE(OclRxDataset)
|
||||
|
||||
OclRxDataset() = default;
|
||||
~OclRxDataset();
|
||||
|
||||
inline cl_mem get() const { return m_dataset; }
|
||||
|
||||
void createBuffer(cl_context ctx, const Algorithm &algorithm, bool host);
|
||||
void createBuffer(cl_context ctx,const Job &job, bool host);
|
||||
|
||||
private:
|
||||
cl_mem m_dataset = nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue