Browse Source

Add basic build ability with diakgcn and put all kernel names in configure.ac to avoid changing them in mutliple places.

nfactor-troky
ckolivas 13 years ago committed by Con Kolivas
parent
commit
cb7145b179
  1. 4
      Makefile.am
  2. 5
      configure.ac
  3. 48
      device-gpu.c
  4. 1
      miner.h
  5. 16
      ocl.c

4
Makefile.am

@ -17,7 +17,7 @@ INCLUDES = $(PTHREAD_FLAGS) -fno-strict-aliasing $(JANSSON_INCLUDES) @@ -17,7 +17,7 @@ INCLUDES = $(PTHREAD_FLAGS) -fno-strict-aliasing $(JANSSON_INCLUDES)
bin_PROGRAMS = cgminer
bin_SCRIPTS = phatk120203.cl poclbm120203.cl
bin_SCRIPTS = *.cl
cgminer_LDFLAGS = $(PTHREAD_FLAGS)
cgminer_LDADD = $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ \
@ -44,7 +44,7 @@ cgminer_SOURCES += device-gpu.h device-gpu.c @@ -44,7 +44,7 @@ cgminer_SOURCES += device-gpu.h device-gpu.c
# the original GPU related sources, unchanged
cgminer_SOURCES += ocl.c ocl.h findnonce.c findnonce.h
cgminer_SOURCES += adl.c adl.h adl_functions.h
cgminer_SOURCES += phatk120203.cl poclbm120203.cl
cgminer_SOURCES += *.cl
if HAS_CPUMINE
# original CPU related sources, unchanged

5
configure.ac

@ -293,6 +293,11 @@ fi @@ -293,6 +293,11 @@ fi
AC_DEFINE_UNQUOTED([CGMINER_PREFIX], ["$prefix/bin"], [Path to cgminer install])
AC_DEFINE_UNQUOTED([PHATK_KERNNAME], ["phatk120203"], [Filename for phatk kernel])
AC_DEFINE_UNQUOTED([POCLBM_KERNNAME], ["poclbm120203"], [Filename for poclbm kernel])
AC_DEFINE_UNQUOTED([DIAKGCN_KERNNAME], ["diakgcn120208"], [Filename for diakgcn kernel])
AC_SUBST(OPENCL_LIBS)
AC_SUBST(OPENCL_FLAGS)
AC_SUBST(JANSSON_LIBS)

48
device-gpu.c

@ -754,6 +754,43 @@ static cl_int queue_phatk_kernel(_clState *clState, dev_blk_ctx *blk) @@ -754,6 +754,43 @@ static cl_int queue_phatk_kernel(_clState *clState, dev_blk_ctx *blk)
return status;
}
static cl_int queue_diakgcn_kernel(_clState *clState, dev_blk_ctx *blk)
{
cl_kernel *kernel = &clState->kernel;
cl_int status = 0;
int num = 0;
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_a);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_b);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_c);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_d);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_e);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_f);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_g);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->ctx_h);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_b);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_c);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_d);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_f);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_g);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->cty_h);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->nonce);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW0);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW1);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW2);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW3);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW15);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fW01r);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fcty_e);
status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->fcty_e2);
status |= clSetKernelArg(*kernel, num++, sizeof(clState->outputBuffer),
(void *)&clState->outputBuffer);
return status;
}
static void set_threads_hashes(unsigned int vectors, unsigned int *threads,
unsigned int *hashes, size_t *globalThreads,
unsigned int minthreads, int intensity)
@ -905,9 +942,11 @@ static void opencl_detect() @@ -905,9 +942,11 @@ static void opencl_detect()
return;
if (opt_kernel) {
if (strcmp(opt_kernel, "poclbm") && strcmp(opt_kernel, "phatk"))
quit(1, "Invalid kernel name specified - must be poclbm or phatk");
if (!strcmp(opt_kernel, "poclbm"))
if (strcmp(opt_kernel, "poclbm") && strcmp(opt_kernel, "phatk") && strcmp(opt_kernel, "diakgcn"))
quit(1, "Invalid kernel name specified - must be poclbm, phatk or diakgcn");
if (!strcmp(opt_kernel, "diakgcn"))
chosen_kernel = KL_DIAKGCN;
else if (!strcmp(opt_kernel, "poclbm"))
chosen_kernel = KL_POCLBM;
else
chosen_kernel = KL_PHATK;
@ -1042,6 +1081,9 @@ static bool opencl_thread_init(struct thr_info *thr) @@ -1042,6 +1081,9 @@ static bool opencl_thread_init(struct thr_info *thr)
default:
thrdata->queue_kernel_parameters = &queue_phatk_kernel;
break;
case KL_DIAKGCN:
thrdata->queue_kernel_parameters = &queue_diakgcn_kernel;
break;
}
thrdata->res = calloc(BUFFERSIZE, 1);

1
miner.h

@ -675,6 +675,7 @@ enum cl_kernel { @@ -675,6 +675,7 @@ enum cl_kernel {
KL_NONE,
KL_POCLBM,
KL_PHATK,
KL_DIAKGCN,
};
extern void get_datestamp(char *, struct timeval *);

16
ocl.c

@ -348,21 +348,27 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -348,21 +348,27 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
char filename[16];
if (chosen_kernel == KL_NONE) {
if (!clState->hasBitAlign || strstr(name, "Tahiti"))
if (strstr(name, "Tahiti"))
chosen_kernel = KL_DIAKGCN;
else if (!clState->hasBitAlign)
chosen_kernel = KL_POCLBM;
else
chosen_kernel = KL_PHATK;
}
switch (chosen_kernel) {
case KL_DIAKGCN:
strcpy(filename, DIAKGCN_KERNNAME".cl");
strcpy(binaryfilename, DIAKGCN_KERNNAME);
break;
case KL_POCLBM:
strcpy(filename, "poclbm120203.cl");
strcpy(binaryfilename, "poclbm120203");
strcpy(filename, POCLBM_KERNNAME".cl");
strcpy(binaryfilename, POCLBM_KERNNAME);
break;
case KL_NONE: /* Shouldn't happen */
case KL_PHATK:
strcpy(filename, "phatk120203.cl");
strcpy(binaryfilename, "phatk120203");
strcpy(filename, PHATK_KERNNAME".cl");
strcpy(binaryfilename, PHATK_KERNNAME);
break;
}

Loading…
Cancel
Save