driver-opencl.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #ifndef __DEVICE_GPU_H__
  2. #define __DEVICE_GPU_H__
  3. #include <stdbool.h>
  4. #include "CL/cl.h"
  5. #ifdef HAVE_SENSORS
  6. #include <sensors/sensors.h>
  7. #endif
  8. #include "miner.h"
  9. struct opencl_device_data {
  10. bool mapped;
  11. int virtual_gpu;
  12. int virtual_adl;
  13. int intensity;
  14. bool dynamic;
  15. cl_uint vwidth;
  16. size_t work_size;
  17. enum cl_kernels kernel;
  18. cl_ulong max_alloc;
  19. #ifdef USE_SCRYPT
  20. int opt_lg, lookup_gap;
  21. size_t opt_tc, thread_concurrency;
  22. size_t shaders;
  23. #endif
  24. struct timeval tv_gpustart;
  25. int intervals;
  26. #ifdef HAVE_ADL
  27. bool has_adl;
  28. struct gpu_adl adl;
  29. int gpu_engine;
  30. int min_engine;
  31. int gpu_fan;
  32. int min_fan;
  33. int gpu_memclock;
  34. int gpu_memdiff;
  35. int gpu_powertune;
  36. float gpu_vddc;
  37. #endif
  38. #ifdef HAVE_SENSORS
  39. const sensors_chip_name *sensor;
  40. #endif
  41. };
  42. struct opencl_work_data {
  43. cl_uint ctx_a; cl_uint ctx_b; cl_uint ctx_c; cl_uint ctx_d;
  44. cl_uint ctx_e; cl_uint ctx_f; cl_uint ctx_g; cl_uint ctx_h;
  45. cl_uint cty_a; cl_uint cty_b; cl_uint cty_c; cl_uint cty_d;
  46. cl_uint cty_e; cl_uint cty_f; cl_uint cty_g; cl_uint cty_h;
  47. cl_uint merkle; cl_uint ntime; cl_uint nbits;
  48. cl_uint fW0; cl_uint fW1; cl_uint fW2; cl_uint fW3; cl_uint fW15;
  49. cl_uint fW01r; cl_uint fcty_e; cl_uint fcty_e2;
  50. cl_uint W16; cl_uint W17; cl_uint W2;
  51. cl_uint PreVal4; cl_uint T1;
  52. cl_uint C1addK5; cl_uint D1A; cl_uint W2A; cl_uint W17_2;
  53. cl_uint PreVal4addT1; cl_uint T1substate0;
  54. cl_uint PreVal4_2;
  55. cl_uint PreVal0;
  56. cl_uint PreW18;
  57. cl_uint PreW19;
  58. cl_uint PreW31;
  59. cl_uint PreW32;
  60. /* For diakgcn */
  61. cl_uint B1addK6, PreVal0addK7, W16addK16, W17addK17;
  62. cl_uint zeroA, zeroB;
  63. cl_uint oneA, twoA, threeA, fourA, fiveA, sixA, sevenA;
  64. #ifdef USE_SCRYPT
  65. struct work *work;
  66. #endif
  67. };
  68. extern void opencl_early_init();
  69. extern char *print_ndevs_and_exit(int *ndevs);
  70. extern void *reinit_gpu(void *userdata);
  71. extern char *set_gpu_map(char *arg);
  72. extern const char *set_gpu_engine(char *arg);
  73. extern const char *set_gpu_fan(char *arg);
  74. extern const char *set_gpu_memclock(char *arg);
  75. extern const char *set_gpu_memdiff(char *arg);
  76. extern const char *set_gpu_powertune(char *arg);
  77. extern const char *set_gpu_threads(char *arg);
  78. extern const char *set_gpu_vddc(char *arg);
  79. extern const char *set_temp_overheat(char *arg);
  80. extern const char *set_intensity(char *arg);
  81. extern const char *set_vector(char *arg);
  82. extern const char *set_worksize(char *arg);
  83. #ifdef USE_SCRYPT
  84. extern const char *set_shaders(char *arg);
  85. extern const char *set_lookup_gap(char *arg);
  86. extern const char *set_thread_concurrency(char *arg);
  87. #endif
  88. extern const char *set_kernel(char *arg);
  89. extern void write_config_opencl(FILE *);
  90. void manage_gpu(void);
  91. extern void opencl_dynamic_cleanup();
  92. extern void pause_dynamic_threads(int gpu);
  93. extern bool have_opencl;
  94. extern int opt_platform_id;
  95. extern bool opt_opencl_binaries;
  96. extern struct device_drv opencl_api;
  97. #endif /* __DEVICE_GPU_H__ */