ocl.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef BFG_OCL_H
  2. #define BFG_OCL_H
  3. #include "config.h"
  4. #include <stdbool.h>
  5. #include <stdio.h>
  6. #ifdef HAVE_OPENCL
  7. #include "CL/cl.h"
  8. #include "miner.h"
  9. typedef struct {
  10. cl_device_id devid;
  11. char *platform_ver_str;
  12. bool is_mesa;
  13. cl_context context;
  14. bool kernel_loaded;
  15. cl_kernel kernel;
  16. cl_command_queue commandQueue;
  17. cl_program program;
  18. cl_mem outputBuffer;
  19. #ifdef USE_SCRYPT
  20. cl_mem CLbuffer0;
  21. cl_mem padbuffer8;
  22. size_t padbufsize;
  23. void * cldata;
  24. #endif
  25. bool hasBitAlign;
  26. bool hasOpenCL11plus;
  27. bool goffset;
  28. cl_uint preferred_vwidth;
  29. cl_uint vwidth;
  30. size_t max_work_size;
  31. size_t wsize;
  32. cl_uint max_compute_units;
  33. enum cl_kernels chosen_kernel;
  34. } _clState;
  35. extern FILE *opencl_open_kernel(const char *filename);
  36. extern char *file_contents(const char *filename, int *length);
  37. extern int clDevicesNum(void);
  38. extern _clState *opencl_create_clState(unsigned int gpu, char *name, size_t nameSize);
  39. extern bool opencl_load_kernel(struct cgpu_info *, _clState *clState, const char *name);
  40. #endif /* HAVE_OPENCL */
  41. #endif /* __OCL_H__ */