OpenCL RandomX WIP

This commit is contained in:
XMRig 2019-09-11 15:48:02 +07:00
parent ff89ec660c
commit 4c90f9960e
72 changed files with 1717 additions and 505 deletions

View file

@ -27,17 +27,18 @@
#include "backend/opencl/wrappers/OclLib.h"
bool xmrig::Cn00RyoKernel::enqueue(cl_command_queue queue, size_t threads)
void xmrig::Cn00RyoKernel::enqueue(cl_command_queue queue, size_t threads)
{
const size_t gthreads = threads * 64;
const size_t lthreads = 64;
return enqueueNDRange(queue, 1, nullptr, &gthreads, &lthreads);
enqueueNDRange(queue, 1, nullptr, &gthreads, &lthreads);
}
// __kernel void cn00(__global int *Scratchpad, __global ulong *states)
bool xmrig::Cn00RyoKernel::setArgs(cl_mem scratchpads, cl_mem states)
void xmrig::Cn00RyoKernel::setArgs(cl_mem scratchpads, cl_mem states)
{
return setArg(0, sizeof(cl_mem), &scratchpads) && setArg(1, sizeof(cl_mem), &states);
setArg(0, sizeof(cl_mem), &scratchpads);
setArg(1, sizeof(cl_mem), &states);
}

View file

@ -37,8 +37,8 @@ class Cn00RyoKernel : public OclKernel
public:
inline Cn00RyoKernel(cl_program program) : OclKernel(program, "cn00") {}
bool enqueue(cl_command_queue queue, size_t threads);
bool setArgs(cl_mem scratchpads, cl_mem states);
void enqueue(cl_command_queue queue, size_t threads);
void setArgs(cl_mem scratchpads, cl_mem states);
};

View file

@ -27,21 +27,21 @@
#include "backend/opencl/wrappers/OclLib.h"
bool xmrig::Cn0Kernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t threads)
void xmrig::Cn0Kernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t threads)
{
const size_t offset[2] = { nonce, 1 };
const size_t gthreads[2] = { threads, 8 };
static const size_t lthreads[2] = { 8, 8 };
return enqueueNDRange(queue, 2, offset, gthreads, lthreads);
enqueueNDRange(queue, 2, offset, gthreads, lthreads);
}
// __kernel void cn0(__global ulong *input, __global uint4 *Scratchpad, __global ulong *states, uint Threads)
bool xmrig::Cn0Kernel::setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads)
void xmrig::Cn0Kernel::setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads)
{
return setArg(0, sizeof(cl_mem), &input) &&
setArg(1, sizeof(cl_mem), &scratchpads) &&
setArg(2, sizeof(cl_mem), &states) &&
setArg(3, sizeof(uint32_t), &threads);
setArg(0, sizeof(cl_mem), &input);
setArg(1, sizeof(cl_mem), &scratchpads);
setArg(2, sizeof(cl_mem), &states);
setArg(3, sizeof(uint32_t), &threads);
}

View file

@ -37,8 +37,8 @@ class Cn0Kernel : public OclKernel
public:
inline Cn0Kernel(cl_program program) : OclKernel(program, "cn0") {}
bool enqueue(cl_command_queue queue, uint32_t nonce, size_t threads);
bool setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads);
void enqueue(cl_command_queue queue, uint32_t nonce, size_t threads);
void setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads);
};

View file

@ -43,21 +43,21 @@ xmrig::Cn1Kernel::Cn1Kernel(cl_program program, uint64_t height)
}
bool xmrig::Cn1Kernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t threads, size_t worksize)
void xmrig::Cn1Kernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t threads, size_t worksize)
{
const size_t offset = nonce;
const size_t gthreads = threads;
const size_t lthreads = worksize;
return enqueueNDRange(queue, 1, &offset, &gthreads, &lthreads);
enqueueNDRange(queue, 1, &offset, &gthreads, &lthreads);
}
// __kernel void cn1(__global ulong *input, __global uint4 *Scratchpad, __global ulong *states, uint Threads)
bool xmrig::Cn1Kernel::setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads)
void xmrig::Cn1Kernel::setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads)
{
return setArg(0, sizeof(cl_mem), &input) &&
setArg(1, sizeof(cl_mem), &scratchpads) &&
setArg(2, sizeof(cl_mem), &states) &&
setArg(3, sizeof(uint32_t), &threads);
setArg(0, sizeof(cl_mem), &input);
setArg(1, sizeof(cl_mem), &scratchpads);
setArg(2, sizeof(cl_mem), &states);
setArg(3, sizeof(uint32_t), &threads);
}

View file

@ -38,8 +38,8 @@ public:
Cn1Kernel(cl_program program);
Cn1Kernel(cl_program program, uint64_t height);
bool enqueue(cl_command_queue queue, uint32_t nonce, size_t threads, size_t worksize);
bool setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads);
void enqueue(cl_command_queue queue, uint32_t nonce, size_t threads, size_t worksize);
void setArgs(cl_mem input, cl_mem scratchpads, cl_mem states, uint32_t threads);
};

View file

@ -30,19 +30,19 @@
#include "backend/opencl/wrappers/OclLib.h"
bool xmrig::Cn1RyoKernel::enqueue(cl_command_queue queue, size_t threads, size_t worksize)
void xmrig::Cn1RyoKernel::enqueue(cl_command_queue queue, size_t threads, size_t worksize)
{
const size_t gthreads = threads * 16;
const size_t lthreads = worksize * 16;
return enqueueNDRange(queue, 1, nullptr, &gthreads, &lthreads);
enqueueNDRange(queue, 1, nullptr, &gthreads, &lthreads);
}
// __kernel void cn1(__global int *lpad_in, __global int *spad, uint numThreads)
bool xmrig::Cn1RyoKernel::setArgs(cl_mem scratchpads, cl_mem states, uint32_t threads)
void xmrig::Cn1RyoKernel::setArgs(cl_mem scratchpads, cl_mem states, uint32_t threads)
{
return setArg(0, sizeof(cl_mem), &scratchpads) &&
setArg(1, sizeof(cl_mem), &states) &&
setArg(2, sizeof(uint32_t), &threads);
setArg(0, sizeof(cl_mem), &scratchpads);
setArg(1, sizeof(cl_mem), &states);
setArg(2, sizeof(uint32_t), &threads);
}

View file

@ -37,8 +37,8 @@ class Cn1RyoKernel : public OclKernel
public:
inline Cn1RyoKernel(cl_program program) : OclKernel(program, "cn1") {}
bool enqueue(cl_command_queue queue, size_t threads, size_t worksize);
bool setArgs(cl_mem scratchpads, cl_mem states, uint32_t threads);
void enqueue(cl_command_queue queue, size_t threads, size_t worksize);
void setArgs(cl_mem scratchpads, cl_mem states, uint32_t threads);
};

View file

@ -27,28 +27,24 @@
#include "backend/opencl/wrappers/OclLib.h"
bool xmrig::Cn2Kernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t threads)
void xmrig::Cn2Kernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t threads)
{
const size_t offset[2] = { nonce, 1 };
const size_t gthreads[2] = { threads, 8 };
static const size_t lthreads[2] = { 8, 8 };
return enqueueNDRange(queue, 2, offset, gthreads, lthreads);
enqueueNDRange(queue, 2, offset, gthreads, lthreads);
}
// __kernel void cn2(__global uint4 *Scratchpad, __global ulong *states, __global uint *Branch0, __global uint *Branch1, __global uint *Branch2, __global uint *Branch3, uint Threads)
bool xmrig::Cn2Kernel::setArgs(cl_mem scratchpads, cl_mem states, const std::vector<cl_mem> &branches, uint32_t threads)
void xmrig::Cn2Kernel::setArgs(cl_mem scratchpads, cl_mem states, const std::vector<cl_mem> &branches, uint32_t threads)
{
if (!setArg(0, sizeof(cl_mem), &scratchpads) || !setArg(1, sizeof(cl_mem), &states) || !setArg(6, sizeof(uint32_t), &threads)) {
return false;
}
setArg(0, sizeof(cl_mem), &scratchpads);
setArg(1, sizeof(cl_mem), &states);
setArg(6, sizeof(uint32_t), &threads);
for (uint32_t i = 0; i < branches.size(); ++i) {
if (!setArg(i + 2, sizeof(cl_mem), &branches[i])) {
return false;
}
setArg(i + 2, sizeof(cl_mem), &branches[i]);
}
return true;
}

View file

@ -37,8 +37,8 @@ class Cn2Kernel : public OclKernel
public:
inline Cn2Kernel(cl_program program) : OclKernel(program, "cn2") {}
bool enqueue(cl_command_queue queue, uint32_t nonce, size_t threads);
bool setArgs(cl_mem scratchpads, cl_mem states, const std::vector<cl_mem> &branches, uint32_t threads);
void enqueue(cl_command_queue queue, uint32_t nonce, size_t threads);
void setArgs(cl_mem scratchpads, cl_mem states, const std::vector<cl_mem> &branches, uint32_t threads);
};

View file

@ -27,22 +27,27 @@
#include "backend/opencl/wrappers/OclLib.h"
bool xmrig::Cn2RyoKernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t threads)
void xmrig::Cn2RyoKernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t threads)
{
const size_t offset[2] = { nonce, 1 };
const size_t gthreads[2] = { threads, 8 };
static const size_t lthreads[2] = { 8, 8 };
return enqueueNDRange(queue, 2, offset, gthreads, lthreads);
enqueueNDRange(queue, 2, offset, gthreads, lthreads);
}
// __kernel void cn2(__global uint4 *Scratchpad, __global ulong *states, __global uint *output, ulong Target, uint Threads)
bool xmrig::Cn2RyoKernel::setArgs(cl_mem scratchpads, cl_mem states, cl_mem output, uint64_t target, uint32_t threads)
void xmrig::Cn2RyoKernel::setArgs(cl_mem scratchpads, cl_mem states, cl_mem output, uint32_t threads)
{
return setArg(0, sizeof(cl_mem), &scratchpads) &&
setArg(1, sizeof(cl_mem), &states) &&
setArg(2, sizeof(cl_mem), &output) &&
setArg(3, sizeof(cl_ulong), &target) &&
setArg(4, sizeof(uint32_t), &threads);
setArg(0, sizeof(cl_mem), &scratchpads);
setArg(1, sizeof(cl_mem), &states);
setArg(2, sizeof(cl_mem), &output);
setArg(4, sizeof(uint32_t), &threads);
}
void xmrig::Cn2RyoKernel::setTarget(uint64_t target)
{
setArg(3, sizeof(cl_ulong), &target);
}

View file

@ -37,8 +37,9 @@ class Cn2RyoKernel : public OclKernel
public:
inline Cn2RyoKernel(cl_program program) : OclKernel(program, "cn2") {}
bool enqueue(cl_command_queue queue, uint32_t nonce, size_t threads);
bool setArgs(cl_mem scratchpads, cl_mem states, cl_mem output, uint64_t target, uint32_t threads);
void enqueue(cl_command_queue queue, uint32_t nonce, size_t threads);
void setArgs(cl_mem scratchpads, cl_mem states, cl_mem output, uint32_t threads);
void setTarget(uint64_t target);
};

View file

@ -41,22 +41,27 @@ xmrig::CnBranchKernel::CnBranchKernel(size_t index, cl_program program) : OclKer
}
bool xmrig::CnBranchKernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t threads, size_t worksize)
void xmrig::CnBranchKernel::enqueue(cl_command_queue queue, uint32_t nonce, size_t threads, size_t worksize)
{
const size_t offset = nonce;
const size_t gthreads = threads;
const size_t lthreads = worksize;
return enqueueNDRange(queue, 1, &offset, &gthreads, &lthreads);
enqueueNDRange(queue, 1, &offset, &gthreads, &lthreads);
}
// __kernel void Skein(__global ulong *states, __global uint *BranchBuf, __global uint *output, ulong Target, uint Threads)
bool xmrig::CnBranchKernel::setArgs(cl_mem states, cl_mem branch, cl_mem output, uint64_t target, uint32_t threads)
void xmrig::CnBranchKernel::setArgs(cl_mem states, cl_mem branch, cl_mem output, uint32_t threads)
{
return setArg(0, sizeof(cl_mem), &states) &&
setArg(1, sizeof(cl_mem), &branch) &&
setArg(2, sizeof(cl_mem), &output) &&
setArg(3, sizeof(cl_ulong), &target) &&
setArg(4, sizeof(cl_uint), &threads);
setArg(0, sizeof(cl_mem), &states);
setArg(1, sizeof(cl_mem), &branch);
setArg(2, sizeof(cl_mem), &output);
setArg(4, sizeof(cl_uint), &threads);
}
void xmrig::CnBranchKernel::setTarget(uint64_t target)
{
setArg(3, sizeof(cl_ulong), &target);
}

View file

@ -36,8 +36,9 @@ class CnBranchKernel : public OclKernel
{
public:
CnBranchKernel(size_t index, cl_program program);
bool enqueue(cl_command_queue queue, uint32_t nonce, size_t threads, size_t worksize);
bool setArgs(cl_mem states, cl_mem branch, cl_mem output, uint64_t target, uint32_t threads);
void enqueue(cl_command_queue queue, uint32_t nonce, size_t threads, size_t worksize);
void setArgs(cl_mem states, cl_mem branch, cl_mem output, uint32_t threads);
void setTarget(uint64_t target);
};

View file

@ -0,0 +1,37 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "backend/opencl/kernels/rx/Blake2bHashRegistersKernel.h"
#include "backend/opencl/wrappers/OclLib.h"
// __kernel void blake2b_hash_registers_32(__global void *out, __global const void* in, uint inStrideBytes)
// __kernel void blake2b_hash_registers_64(__global void *out, __global const void* in, uint inStrideBytes)
void xmrig::Blake2bHashRegistersKernel::setArgs(cl_mem out, cl_mem in, uint32_t inStrideBytes)
{
setArg(0, sizeof(cl_mem), &out);
setArg(1, sizeof(cl_mem), &in);
setArg(2, sizeof(uint32_t), &inStrideBytes);
}

View file

@ -0,0 +1,47 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_BLAKE2BHASHREGISTERSKERNEL_H
#define XMRIG_BLAKE2BHASHREGISTERSKERNEL_H
#include "backend/opencl/wrappers/OclKernel.h"
namespace xmrig {
class Blake2bHashRegistersKernel : public OclKernel
{
public:
inline Blake2bHashRegistersKernel(cl_program program, const char *name) : OclKernel(program, name) {}
void setArgs(cl_mem out, cl_mem in, uint32_t inStrideBytes);
};
} // namespace xmrig
#endif /* XMRIG_BLAKE2BHASHREGISTERSKERNEL_H */

View file

@ -0,0 +1,35 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "backend/opencl/kernels/rx/Blake2bInitialHashKernel.h"
#include "backend/opencl/wrappers/OclLib.h"
// __kernel void blake2b_initial_hash(__global void *out, __global const void* blockTemplate, uint blockTemplateSize, uint start_nonce)
void xmrig::Blake2bInitialHashKernel::setArgs(cl_mem out, cl_mem blockTemplate)
{
setArg(0, sizeof(cl_mem), &out);
setArg(1, sizeof(cl_mem), &blockTemplate);
}

View file

@ -0,0 +1,47 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_BLAKE2BINITIALHASHKERNEL_H
#define XMRIG_BLAKE2BINITIALHASHKERNEL_H
#include "backend/opencl/wrappers/OclKernel.h"
namespace xmrig {
class Blake2bInitialHashKernel : public OclKernel
{
public:
inline Blake2bInitialHashKernel(cl_program program) : OclKernel(program, "blake2b_initial_hash") {}
void setArgs(cl_mem out, cl_mem blockTemplate);
};
} // namespace xmrig
#endif /* XMRIG_BLAKE2BINITIALHASHKERNEL_H */

View file

@ -0,0 +1,38 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "backend/opencl/kernels/rx/ExecuteVmKernel.h"
#include "backend/opencl/wrappers/OclLib.h"
// __kernel void execute_vm(__global void* vm_states, __global void* rounding, __global void* scratchpads, __global const void* dataset_ptr, uint32_t batch_size, uint32_t num_iterations, uint32_t first, uint32_t last)
void xmrig::ExecuteVmKernel::setArgs(cl_mem vm_states, cl_mem rounding, cl_mem scratchpads, cl_mem dataset_ptr, uint32_t batch_size)
{
setArg(0, sizeof(cl_mem), &vm_states);
setArg(1, sizeof(cl_mem), &rounding);
setArg(2, sizeof(cl_mem), &scratchpads);
setArg(3, sizeof(cl_mem), &dataset_ptr);
setArg(4, sizeof(uint32_t), &batch_size);
}

View file

@ -0,0 +1,47 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_EXECUTEVMKERNEL_H
#define XMRIG_EXECUTEVMKERNEL_H
#include "backend/opencl/wrappers/OclKernel.h"
namespace xmrig {
class ExecuteVmKernel : public OclKernel
{
public:
inline ExecuteVmKernel(cl_program program) : OclKernel(program, "execute_vm") {}
void setArgs(cl_mem vm_states, cl_mem rounding, cl_mem scratchpads, cl_mem dataset_ptr, uint32_t batch_size);
};
} // namespace xmrig
#endif /* XMRIG_EXECUTEVMKERNEL_H */

View file

@ -0,0 +1,38 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "backend/opencl/kernels/rx/FillAesKernel.h"
#include "backend/opencl/wrappers/OclLib.h"
// __kernel void fillAes1Rx4_scratchpad(__global void* state, __global void* out, uint batch_size, uint rx_version)
// __kernel void fillAes4Rx4_entropy(__global void* state, __global void* out, uint batch_size, uint rx_version)
void xmrig::FillAesKernel::setArgs(cl_mem state, cl_mem out, uint32_t batch_size, uint32_t rx_version)
{
setArg(0, sizeof(cl_mem), &state);
setArg(1, sizeof(cl_mem), &out);
setArg(2, sizeof(uint32_t), &batch_size);
setArg(3, sizeof(uint32_t), &rx_version);
}

View file

@ -0,0 +1,47 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_FILLAESKERNEL_H
#define XMRIG_FILLAESKERNEL_H
#include "backend/opencl/wrappers/OclKernel.h"
namespace xmrig {
class FillAesKernel : public OclKernel
{
public:
inline FillAesKernel(cl_program program, const char *name) : OclKernel(program, name) {}
void setArgs(cl_mem state, cl_mem out, uint32_t batch_size, uint32_t rx_version);
};
} // namespace xmrig
#endif /* XMRIG_FILLAESKERNEL_H */

View file

@ -0,0 +1,35 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "backend/opencl/kernels/rx/FindSharesKernel.h"
#include "backend/opencl/wrappers/OclLib.h"
// __kernel void find_shares(__global const uint64_t* hashes, uint64_t target, uint32_t start_nonce, __global uint32_t* shares)
void xmrig::FindSharesKernel::setArgs(cl_mem hashes, cl_mem shares)
{
setArg(0, sizeof(cl_mem), &hashes);
setArg(3, sizeof(cl_mem), &shares);
}

View file

@ -0,0 +1,47 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_FINDSHARESKERNEL_H
#define XMRIG_FINDSHARESKERNEL_H
#include "backend/opencl/wrappers/OclKernel.h"
namespace xmrig {
class FindSharesKernel : public OclKernel
{
public:
inline FindSharesKernel(cl_program program) : OclKernel(program, "find_shares") {}
void setArgs(cl_mem hashes, cl_mem shares);
};
} // namespace xmrig
#endif /* XMRIG_FINDSHARESKERNEL_H */

View file

@ -0,0 +1,40 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "backend/opencl/kernels/rx/HashAesKernel.h"
#include "backend/opencl/wrappers/OclLib.h"
// __kernel void hashAes1Rx4(__global const void* input, __global void* hash, uint hashOffsetBytes, uint hashStrideBytes, uint batch_size)
void xmrig::HashAesKernel::setArgs(cl_mem input, cl_mem hash, uint32_t hashStrideBytes, uint32_t batch_size)
{
const uint32_t hashOffsetBytes = 192;
setArg(0, sizeof(cl_mem), &input);
setArg(1, sizeof(cl_mem), &hash);
setArg(2, sizeof(uint32_t), &hashOffsetBytes);
setArg(3, sizeof(uint32_t), &hashStrideBytes);
setArg(4, sizeof(uint32_t), &batch_size);
}

View file

@ -0,0 +1,47 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_HASHAESKERNEL_H
#define XMRIG_HASHAESKERNEL_H
#include "backend/opencl/wrappers/OclKernel.h"
namespace xmrig {
class HashAesKernel : public OclKernel
{
public:
inline HashAesKernel(cl_program program) : OclKernel(program, "hashAes1Rx4") {}
void setArgs(cl_mem input, cl_mem hash, uint32_t hashStrideBytes, uint32_t batch_size);
};
} // namespace xmrig
#endif /* XMRIG_HASHAESKERNEL_H */

View file

@ -0,0 +1,36 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "backend/opencl/kernels/rx/InitVmKernel.h"
#include "backend/opencl/wrappers/OclLib.h"
// __kernel void init_vm(__global const void* entropy_data, __global void* vm_states, __global uint32_t* rounding, uint32_t iteration)
void xmrig::InitVmKernel::setArgs(cl_mem entropy_data, cl_mem vm_states, cl_mem rounding)
{
setArg(0, sizeof(cl_mem), &entropy_data);
setArg(1, sizeof(cl_mem), &vm_states);
setArg(2, sizeof(cl_mem), &rounding);
}

View file

@ -0,0 +1,47 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_INITVMKERNEL_H
#define XMRIG_INITVMKERNEL_H
#include "backend/opencl/wrappers/OclKernel.h"
namespace xmrig {
class InitVmKernel : public OclKernel
{
public:
inline InitVmKernel(cl_program program) : OclKernel(program, "init_vm") {}
void setArgs(cl_mem entropy_data, cl_mem vm_states, cl_mem rounding);
};
} // namespace xmrig
#endif /* XMRIG_INITVMKERNEL_H */