From 8c1f7e272b1d484c2c3e05cbbc100626493c8c62 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Feb 2014 10:47:19 +0100 Subject: [PATCH] Use shaders param if provided. --- driver-opencl.c | 10 +++++----- ocl.c | 5 +---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/driver-opencl.c b/driver-opencl.c index 006be853..f2ee1bb9 100644 --- a/driver-opencl.c +++ b/driver-opencl.c @@ -1046,13 +1046,13 @@ static cl_int queue_scrypt_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_u return status; } -static void set_threads_hashes(unsigned int vectors, unsigned int compute_shaders, int64_t *hashes, size_t *globalThreads, +static void set_threads_hashes(unsigned int vectors, size_t shaders, int64_t *hashes, size_t *globalThreads, unsigned int minthreads, __maybe_unused int *intensity, __maybe_unused int *xintensity, __maybe_unused int *rawintensity) { unsigned int threads = 0; - if (use_nscrypt) { + if (use_nscrypt && shaders) { // new intensity calculation based on shader count - threads = (compute_shaders * minthreads << (MAX_INTENSITY-19)) >> (MAX_INTENSITY - *intensity); + threads = (shaders * minthreads << (MAX_INTENSITY-19)) >> (MAX_INTENSITY - *intensity); if (threads < minthreads) threads = minthreads; @@ -1064,7 +1064,7 @@ static void set_threads_hashes(unsigned int vectors, unsigned int compute_shader if (*rawintensity > 0) { threads = *rawintensity; } else if (*xintensity > 0) { - threads = compute_shaders * *xintensity; + threads = shaders * *xintensity; } else { threads = 1 << *intensity; } @@ -1455,7 +1455,7 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work, gpu->intervals = 0; } - set_threads_hashes(clState->vwidth, clState->compute_shaders, &hashes, globalThreads, localThreads[0], + set_threads_hashes(clState->vwidth, gpu->shaders ? gpu->shaders : clState->compute_shaders, &hashes, globalThreads, localThreads[0], &gpu->intensity, &gpu->xintensity, &gpu->rawintensity); if (hashes > gpu->max_hashes) gpu->max_hashes = hashes; diff --git a/ocl.c b/ocl.c index 73ea6bda..50336f1c 100644 --- a/ocl.c +++ b/ocl.c @@ -384,10 +384,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) return NULL; } - if (cgpu->shaders) { - clState->compute_shaders = cgpu->shaders; - } - else { + if (!cgpu->shaders) { // AMD architechture got 64 compute shaders per compute unit. // Source: http://www.amd.com/us/Documents/GCN_Architecture_whitepaper.pdf clState->compute_shaders = compute_units * 64;