Browse Source

Adjust opencl intensity when adjusting thread count to prevent it getting pegged at a value below the minimum threads possible.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
f1c6ae22f7
  1. 33
      driver-opencl.c

33
driver-opencl.c

@ -1106,20 +1106,23 @@ static cl_int queue_scrypt_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_u
} }
#endif #endif
static void set_threads_hashes(unsigned int vectors, unsigned int *threads, static void set_threads_hashes(unsigned int vectors,int64_t *hashes, size_t *globalThreads,
int64_t *hashes, size_t *globalThreads, unsigned int minthreads, __maybe_unused int *intensity)
unsigned int minthreads, int intensity)
{ {
if (opt_scrypt) { unsigned int threads = 0;
if (intensity < 0)
intensity = 0; while (threads < minthreads) {
*threads = 1 << intensity; threads = 1 << ((opt_scrypt ? 0 : 15) + *intensity);
} else if (threads < minthreads) {
*threads = 1 << (15 + intensity); if (likely(*intensity < MAX_INTENSITY))
if (*threads < minthreads) (*intensity)++;
*threads = minthreads; else
*globalThreads = *threads; threads = minthreads;
*hashes = *threads * vectors; }
}
*globalThreads = threads;
*hashes = threads * vectors;
} }
#endif /* HAVE_OPENCL */ #endif /* HAVE_OPENCL */
@ -1499,15 +1502,13 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work,
cl_int status; cl_int status;
size_t globalThreads[1]; size_t globalThreads[1];
size_t localThreads[1] = { clState->wsize }; size_t localThreads[1] = { clState->wsize };
unsigned int threads;
int64_t hashes; int64_t hashes;
/* This finish flushes the readbuffer set with CL_FALSE later */ /* This finish flushes the readbuffer set with CL_FALSE later */
if (!gpu->dynamic) if (!gpu->dynamic)
clFinish(clState->commandQueue); clFinish(clState->commandQueue);
set_threads_hashes(clState->vwidth, &threads, &hashes, globalThreads, set_threads_hashes(clState->vwidth, &hashes, globalThreads, localThreads[0], &gpu->intensity);
localThreads[0], gpu->intensity);
if (hashes > gpu->max_hashes) if (hashes > gpu->max_hashes)
gpu->max_hashes = hashes; gpu->max_hashes = hashes;

Loading…
Cancel
Save