From 7950c10374f69ae0957aa031e7d3c42b91b92958 Mon Sep 17 00:00:00 2001 From: Noel Maersk Date: Mon, 20 Jan 2014 23:32:44 +0200 Subject: [PATCH] kernel: integrate Zuikkis' kernel, selectable with `--kernel=zuikkis`. Kernel ckolivas is still the default. Needs documentation, too. https://github.com/veox/sgminer/issues/4 --- configure.ac | 1 + driver-opencl.c | 10 +++++++++- miner.h | 1 + ocl.c | 6 ++++++ sgminer.c | 3 +++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 49978c2e..ed4441ee 100644 --- a/configure.ac +++ b/configure.ac @@ -318,6 +318,7 @@ fi AC_DEFINE_UNQUOTED([SGMINER_PREFIX], ["$prefix/bin"], [Path to sgminer install]) AC_DEFINE_UNQUOTED([CKOLIVAS_KERNNAME], ["ckolivas"], [Filename for original scrypt kernel]) +AC_DEFINE_UNQUOTED([ZUIKKIS_KERNNAME], ["zuikkis"], [Filename for Zuikkis' optimised kernel]) AC_SUBST(OPENCL_LIBS) diff --git a/driver-opencl.c b/driver-opencl.c index 2d29707f..ec8e2faf 100644 --- a/driver-opencl.c +++ b/driver-opencl.c @@ -198,6 +198,8 @@ static enum cl_kernels select_kernel(char *arg) { if (!strcmp(arg, "ckolivas")) return KL_CKOLIVAS; + if (!strcmp(arg, "zuikkis")) + return KL_ZUIKKIS; return KL_NONE; } @@ -1211,7 +1213,10 @@ static bool opencl_thread_prepare(struct thr_info *thr) { switch (clStates[i]->chosen_kernel) { case KL_CKOLIVAS: - cgpu->kname = "scrypt"; + cgpu->kname = "ckolivas"; + break; + case KL_ZUIKKIS: + cgpu->kname = "zuikkis"; break; default: break; @@ -1244,6 +1249,9 @@ static bool opencl_thread_init(struct thr_info *thr) case KL_CKOLIVAS: thrdata->queue_kernel_parameters = &queue_scrypt_kernel; break; + case KL_ZUIKKIS: + thrdata->queue_kernel_parameters = &queue_scrypt_kernel; + break; default: break; } diff --git a/miner.h b/miner.h index 13962217..16231b29 100644 --- a/miner.h +++ b/miner.h @@ -373,6 +373,7 @@ enum dev_enable { enum cl_kernels { KL_NONE, KL_CKOLIVAS, + KL_ZUIKKIS, }; enum dev_reason { diff --git a/ocl.c b/ocl.c index 3d2dc0d8..c3b60b64 100644 --- a/ocl.c +++ b/ocl.c @@ -422,6 +422,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) /* Scrypt only supports vector 1 */ cgpu->vwidth = 1; break; + case KL_ZUIKKIS: + strcpy(filename, ZUIKKIS_KERNNAME".cl"); + strcpy(binaryfilename, ZUIKKIS_KERNNAME); + /* Scrypt only supports vector 1 */ + cgpu->vwidth = 1; + break; case KL_NONE: /* Shouldn't happen */ break; } diff --git a/sgminer.c b/sgminer.c index 06913134..6b1ee9ba 100644 --- a/sgminer.c +++ b/sgminer.c @@ -4124,6 +4124,9 @@ void write_config(FILE *fcfg) case KL_CKOLIVAS: fprintf(fcfg, "ckolivas"); break; + case KL_ZUIKKIS: + fprintf(fcfg, "zuikkis"); + break; } } fputs("\",\n\"lookup-gap\" : \"", fcfg);