From f479be0700d376381090ecf716dab827477c11f4 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Fri, 27 Apr 2012 08:29:56 +0200 Subject: [PATCH] add goffset support for diakgcn with -v 1 and update kernel version --- configure.ac | 2 +- diakgcn120223.cl => diakgcn120427.cl | 10 ++++++++-- driver-opencl.c | 16 +++++++++------- ocl.c | 2 +- 4 files changed, 19 insertions(+), 11 deletions(-) rename diakgcn120223.cl => diakgcn120427.cl (99%) diff --git a/configure.ac b/configure.ac index 9c82bb4d..cce6cdd6 100644 --- a/configure.ac +++ b/configure.ac @@ -367,7 +367,7 @@ AC_DEFINE_UNQUOTED([CGMINER_PREFIX], ["$prefix/bin"], [Path to cgminer install]) AC_DEFINE_UNQUOTED([PHATK_KERNNAME], ["phatk120223"], [Filename for phatk kernel]) AC_DEFINE_UNQUOTED([POCLBM_KERNNAME], ["poclbm120327"], [Filename for poclbm kernel]) -AC_DEFINE_UNQUOTED([DIAKGCN_KERNNAME], ["diakgcn120223"], [Filename for diakgcn kernel]) +AC_DEFINE_UNQUOTED([DIAKGCN_KERNNAME], ["diakgcn120427"], [Filename for diakgcn kernel]) AC_DEFINE_UNQUOTED([DIABLO_KERNNAME], ["diablo120328"], [Filename for diablo kernel]) diff --git a/diakgcn120223.cl b/diakgcn120427.cl similarity index 99% rename from diakgcn120223.cl rename to diakgcn120427.cl index ad981a63..37d51c51 100644 --- a/diakgcn120223.cl +++ b/diakgcn120427.cl @@ -1,4 +1,4 @@ -// DiaKGCN 16-03-2012 - OpenCL kernel by Diapolo +// DiaKGCN 27-04-2012 - OpenCL kernel by Diapolo // // Parts and / or ideas for this kernel are based upon the public-domain poclbm project, the phatk kernel by Phateus and the DiabloMiner kernel by DiabloD3. // The kernel was rewritten by me (Diapolo) and is still public-domain! @@ -33,7 +33,9 @@ __kernel __attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) void search( +#ifndef GOFFSET const u base, +#endif const uint PreVal0, const uint PreVal4, const uint H1, const uint D1A, const uint B1, const uint C1, const uint F1, const uint G1, const uint C1addK5, const uint B1addK6, const uint PreVal0addK7, @@ -56,7 +58,11 @@ __kernel #elif defined VECTORS2 const u nonce = (uint)(get_local_id(0)) * 2U + (uint)(get_group_id(0)) * (uint)(WORKVEC) + base; #else - const u nonce = (uint)(get_local_id(0)) + (uint)(get_group_id(0)) * (uint)(WORKSIZE) + base; + #ifdef GOFFSET + const u nonce = (uint)(get_global_id(0)); + #else + const u nonce = (uint)(get_local_id(0)) + (uint)(get_group_id(0)) * (uint)(WORKSIZE) + base; + #endif #endif V[0] = PreVal0 + nonce; diff --git a/driver-opencl.c b/driver-opencl.c index 98d9fc14..dd156871 100644 --- a/driver-opencl.c +++ b/driver-opencl.c @@ -879,15 +879,17 @@ static cl_int queue_diakgcn_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_unused cl_uint threads) { cl_kernel *kernel = &clState->kernel; - cl_uint vwidth = clState->vwidth; - unsigned int i, num = 0; + unsigned int num = 0; cl_int status = 0; - uint *nonces; - nonces = alloca(sizeof(uint) * vwidth); - for (i = 0; i < vwidth; i++) - nonces[i] = blk->nonce + i; - CL_SET_VARG(vwidth, nonces); + if (!clState->goffset) { + cl_uint vwidth = clState->vwidth; + uint *nonces = alloca(sizeof(uint) * vwidth); + unsigned int i; + for (i = 0; i < vwidth; i++) + nonces[i] = blk->nonce + i; + CL_SET_VARG(vwidth, nonces); + } CL_SET_BLKARG(PreVal0); CL_SET_BLKARG(PreVal4_2); diff --git a/ocl.c b/ocl.c index 5c7ba249..464cb4e1 100644 --- a/ocl.c +++ b/ocl.c @@ -421,7 +421,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) gpus[gpu].vwidth = preferred_vwidth; } - if ((clState->chosen_kernel == KL_POCLBM || clState->chosen_kernel == KL_DIABLO) && + if ((clState->chosen_kernel == KL_POCLBM || clState->chosen_kernel == KL_DIABLO || clState->chosen_kernel == KL_DIAKGCN) && clState->vwidth == 1 && clState->hasOpenCL11plus) clState->goffset = true;