From a7e46721f6a3979f7904176c0f0fcf09a989f132 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 18 Feb 2014 10:27:18 +0100 Subject: [PATCH] TC adjustments for nscrypt. --- ocl.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ocl.c b/ocl.c index 0105321f..93ac720d 100644 --- a/ocl.c +++ b/ocl.c @@ -484,20 +484,28 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) } else cgpu->lookup_gap = cgpu->opt_lg; + // TODO: check if this params can be the same for both scrypt and nscrypt + unsigned int sixtyfours = use_nscrypt ? ((cgpu->max_alloc*cgpu->lookup_gap) / (2048*128) / 64 - 1) : (cgpu->max_alloc / 131072 / 64 - 1); if (!cgpu->opt_tc) { - unsigned int sixtyfours; - - sixtyfours = cgpu->max_alloc / 131072 / 64 - 1; cgpu->thread_concurrency = sixtyfours * 64; if (cgpu->shaders && cgpu->thread_concurrency > cgpu->shaders) { cgpu->thread_concurrency -= cgpu->thread_concurrency % cgpu->shaders; - if (cgpu->thread_concurrency > cgpu->shaders * 5) - cgpu->thread_concurrency = cgpu->shaders * 5; + size_t tc_limit = cgpu->shaders * use_nscrypt ? 11 : 5; + if (cgpu->thread_concurrency > tc_limit) + cgpu->thread_concurrency = tc_limit; } applog(LOG_DEBUG, "GPU %d: selecting thread concurrency of %d", gpu, (int)(cgpu->thread_concurrency)); - } else + } else { cgpu->thread_concurrency = cgpu->opt_tc; + } + // TODO: check if this works with standard scrypt, too + if (use_nscrypt) { + if (((cgpu->thread_concurrency * (2048*128)) / cgpu->lookup_gap) > cgpu->max_alloc) { + cgpu->thread_concurrency = sixtyfours * 64; + applog(LOG_INFO, "GPU %d: thread concurrency too high, set to %d", gpu, (int)(cgpu->thread_concurrency)); + } + } FILE *binaryfile; size_t *binary_sizes;