Browse Source

opencl: Remove redundant checks for USE_OPENCL

Luke Dashjr 11 years ago
parent
commit
2bfdbc7e32
5 changed files with 3 additions and 37 deletions
  1. 1 27
      driver-opencl.c
  2. 0 2
      findnonce.c
  3. 1 2
      findnonce.h
  4. 0 4
      ocl.c
  5. 1 2
      ocl.h

+ 1 - 27
driver-opencl.c

@@ -50,7 +50,6 @@
 /* TODO: cleanup externals ********************/
 
 
-#ifdef USE_OPENCL
 /* Platform API */
 CL_API_ENTRY cl_int CL_API_CALL
 (*clGetPlatformIDs)(cl_uint          /* num_entries */,
@@ -257,7 +256,6 @@ load_opencl_symbols() {
 	
 	return true;
 }
-#endif
 
 
 struct opencl_kernel_interface {
@@ -371,7 +369,6 @@ const char *set_ ## PNAME(char *arg)  \
 #define _SET_INT_LIST(PNAME, VCHECK, FIELD)  \
 	_SET_INT_LIST2(PNAME, VCHECK, ((struct opencl_device_data *)cgpu->device_data)->FIELD)
 
-#ifdef USE_OPENCL
 _SET_INT_LIST(vector  , (v == 1 || v == 2 || v == 4), vwidth   )
 _SET_INT_LIST(worksize, (v >= 1 && v <= 9999)       , work_size)
 
@@ -435,7 +432,6 @@ const char *set_kernel(char *arg)
 {
 	return _set_list(arg, "Invalid value passed to set_kernel", _set_kernel);
 }
-#endif
 
 static
 const char *opencl_init_binary(struct cgpu_info * const proc, const char * const optname, const char * const newvalue, char * const replybuf, enum bfg_set_device_replytype * const out_success)
@@ -662,7 +658,6 @@ const char *opencl_set_gpu_vddc(struct cgpu_info * const proc, const char * cons
 _SET_INT_LIST(temp_overheat, (v >=     0 && v <   200), adl.overtemp )
 #endif
 
-#ifdef USE_OPENCL
 double oclthreads_to_xintensity(const unsigned long oclthreads, const cl_uint max_compute_units)
 {
 	return (double)oclthreads / (double)max_compute_units / 64.;
@@ -760,7 +755,6 @@ const char *set_intensity(char *arg)
 }
 
 _SET_INT_LIST2(gpu_threads, (v >= 1 && v <= 10), cgpu->threads)
-#endif
 
 void write_config_opencl(FILE * const fcfg)
 {
@@ -771,7 +765,6 @@ void write_config_opencl(FILE * const fcfg)
 }
 
 
-#ifdef USE_OPENCL
 BFG_REGISTER_DRIVER(opencl_api)
 static const struct bfg_set_device_definition opencl_set_device_funcs_probe[];
 static const struct bfg_set_device_definition opencl_set_device_funcs[];
@@ -784,16 +777,12 @@ char *print_ndevs_and_exit(int *ndevs)
 	applog(LOG_INFO, "%i GPU devices max detected", *ndevs);
 	exit(*ndevs);
 }
-#endif
 
 
 struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
 struct cgpu_info *cpus;
 
 
-
-#ifdef USE_OPENCL
-
 /* In dynamic mode, only the first thread of each device will be in use.
  * This potentially could start a thread that was stopped with the start-stop
  * options if one were to disable dynamic from the menu on a paused GPU */
@@ -820,8 +809,6 @@ void pause_dynamic_threads(int gpu)
 
 struct device_drv opencl_api;
 
-#endif /* USE_OPENCL */
-
 float opencl_proc_get_intensity(struct cgpu_info * const proc, const char ** const iunit)
 {
 	struct opencl_device_data * const data = proc->device_data;
@@ -839,7 +826,7 @@ float opencl_proc_get_intensity(struct cgpu_info * const proc, const char ** con
 	return intensity;
 }
 
-#if defined(USE_OPENCL) && defined(HAVE_CURSES)
+#ifdef HAVE_CURSES
 static
 void opencl_wlogprint_status(struct cgpu_info *cgpu)
 {
@@ -992,8 +979,6 @@ const char *opencl_tui_handle_choice(struct cgpu_info *cgpu, int input)
 #endif
 
 
-#ifdef USE_OPENCL
-
 #define CL_SET_BLKARG(blkvar) status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->blkvar)
 #define CL_SET_ARG(var) status |= clSetKernelArg(*kernel, num++, sizeof(var), (void *)&var)
 #define CL_SET_VARG(args, var) status |= clSetKernelArg(*kernel, num++, args * sizeof(uint), (void *)var)
@@ -1268,7 +1253,6 @@ cl_int queue_scrypt_kernel(const struct opencl_kernel_info * const kinfo, _clSta
 	return status;
 }
 #endif
-#endif /* USE_OPENCL */
 
 
 static
@@ -1286,7 +1270,6 @@ struct opencl_kernel_interface kernel_interfaces[] = {
 };
 
 
-#ifdef USE_OPENCL
 /* We have only one thread that ever re-initialises GPUs, thus if any GPU
  * init command fails due to a completely wedged GPU, the thread will never
  * return, unable to harm other GPUs. If it does return, it means we only had
@@ -1372,15 +1355,7 @@ select_cgpu:
 out:
 	return NULL;
 }
-#else
-void *reinit_gpu(__maybe_unused void *userdata)
-{
-	return NULL;
-}
-#endif
 
-
-#ifdef USE_OPENCL
 struct device_drv opencl_api;
 
 static int opencl_autodetect()
@@ -1987,4 +1962,3 @@ struct device_drv opencl_api = {
 	.scanhash = opencl_scanhash,
 	.thread_shutdown = opencl_thread_shutdown,
 };
-#endif

+ 0 - 2
findnonce.c

@@ -10,7 +10,6 @@
  */
 
 #include "config.h"
-#ifdef USE_OPENCL
 
 #include <stdint.h>
 #include <stdio.h>
@@ -207,4 +206,3 @@ void postcalc_hash_async(struct thr_info *thr, struct work *work, uint32_t *res)
 		return;
 	}
 }
-#endif /* USE_OPENCL */

+ 1 - 2
findnonce.h

@@ -22,10 +22,9 @@
 #define OPENCL_MAX_BUFFERSIZE  BUFFERSIZE
 #endif
 
-#ifdef USE_OPENCL
 #ifdef USE_SHA256D
 extern void precalc_hash(struct opencl_work_data *blk, uint32_t *state, uint32_t *data);
 #endif
 extern void postcalc_hash_async(struct thr_info *thr, struct work *work, uint32_t *res);
-#endif /* USE_OPENCL */
+
 #endif /*__FINDNONCE_H__*/

+ 0 - 4
ocl.c

@@ -9,7 +9,6 @@
  */
 
 #include "config.h"
-#ifdef USE_OPENCL
 
 #include <ctype.h>
 #include <limits.h>
@@ -1175,6 +1174,3 @@ built:
 	kernelinfo->loaded = true;
 	return true;
 }
-
-#endif /* USE_OPENCL */
-

+ 1 - 2
ocl.h

@@ -6,7 +6,6 @@
 #include <stdbool.h>
 #include <stdio.h>
 
-#ifdef USE_OPENCL
 #include "CL/cl.h"
 
 #include "miner.h"
@@ -58,5 +57,5 @@ extern char *opencl_kernel_source(const char *filename, int *out_sourcelen, enum
 extern int clDevicesNum(void);
 extern _clState *opencl_create_clState(unsigned int gpu, char *name, size_t nameSize);
 extern bool opencl_load_kernel(struct cgpu_info *, _clState *clState, const char *name, struct opencl_kernel_info *, const char *kernel_file, const struct mining_algorithm *);
-#endif /* USE_OPENCL */
+
 #endif /* __OCL_H__ */