diff options
author | psychocrypt <psychocrypt@users.noreply.github.com> | 2017-10-01 00:36:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-01 00:36:33 +0200 |
commit | 4e5e98a095ed0ec038b9ea5421407b630bda273d (patch) | |
tree | 85c1401542a888b9d48255342095c8b6952d71bf /xmrstak/backend/amd/amd_gpu/gpu.hpp | |
parent | 0afbc279e0db816dbb9d4d623929e2faf8108451 (diff) | |
parent | 2c8d64abfa1c989f260dd4fcaa5c6d7707a5f668 (diff) | |
download | xmr-stak-4e5e98a095ed0ec038b9ea5421407b630bda273d.zip xmr-stak-4e5e98a095ed0ec038b9ea5421407b630bda273d.tar.gz |
Merge pull request #1 from psychocrypt/topic-restructure11
refactor xmr-stak
Diffstat (limited to 'xmrstak/backend/amd/amd_gpu/gpu.hpp')
-rw-r--r-- | xmrstak/backend/amd/amd_gpu/gpu.hpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/xmrstak/backend/amd/amd_gpu/gpu.hpp b/xmrstak/backend/amd/amd_gpu/gpu.hpp new file mode 100644 index 0000000..5ff7ea1 --- /dev/null +++ b/xmrstak/backend/amd/amd_gpu/gpu.hpp @@ -0,0 +1,51 @@ +#pragma once + +#include "xmrstak/misc/console.hpp" + +#if defined(__APPLE__) +#include <OpenCL/cl.h> +#else +#include <CL/cl.h> +#endif + +#include <stdint.h> +#include <vector> + +#define ERR_SUCCESS (0) +#define ERR_OCL_API (2) +#define ERR_STUPID_PARAMS (1) + + + +struct GpuContext +{ + /*Input vars*/ + size_t deviceIdx; + size_t rawIntensity; + size_t workSize; + + /*Output vars*/ + cl_device_id DeviceID; + cl_command_queue CommandQueues; + cl_mem InputBuffer; + cl_mem OutputBuffer; + cl_mem ExtraBuffers[6]; + cl_program Program; + cl_kernel Kernels[7]; + size_t freeMem; + int computeUnits; + std::string name; + + size_t Nonce; + +}; + +uint32_t getNumPlatforms(); +int getAMDPlatformIdx(); +std::vector<GpuContext> getAMDDevices(int index); + +size_t InitOpenCL(GpuContext* ctx, size_t num_gpus, size_t platform_idx); +size_t XMRSetJob(GpuContext* ctx, uint8_t* input, size_t input_len, uint32_t target); +size_t XMRRunJob(GpuContext* ctx, cl_uint* HashOutput); + + |