Browse Source

Merge branch 'master' of git://github.com/ckolivas/cgminer.git

nfactor-troky
Paul Sheppard 12 years ago
parent
commit
a5299fef61
  1. 19
      NEWS
  2. 36
      cgminer.c
  3. 2
      configure.ac
  4. 33
      driver-opencl.c
  5. 2
      miner.h
  6. 8
      ocl.c

19
NEWS

@ -1,3 +1,22 @@
Version 2.7.5 - August 31, 2012
- Adjust opencl intensity when adjusting thread count to prevent it getting
pegged at a value below the minimum threads possible.
- miner.h max_hashes -> int64_t
- Keep the local block number in the blocks structs stored and sort them by
number to guarantee we delete the oldest when ageing the block struct entries.
- Use correct sdk version detection for SDK 2.7
- Revert "Pick worksize 256 with Cypress if none is specified."
- Test for lagging once more in queue_request to enable work to leak to backup
pools.
- There is no need to try to switch pools in select_pool since the current pool
is actually not affected by the choice of pool to get work from.
- Only clear the pool lagging flag if we're staging work faster than we're using
it.
- needed flag is currently always false in queue_request. Remove it for now.
- thr is always NULL going into queue_request now.
Version 2.7.4 - August 23, 2012 Version 2.7.4 - August 23, 2012
- Perform select_pool even when not lagging to allow it to switch back if needed - Perform select_pool even when not lagging to allow it to switch back if needed

36
cgminer.c

@ -218,6 +218,7 @@ struct timeval block_timeval;
struct block { struct block {
char hash[37]; char hash[37];
UT_hash_handle hh; UT_hash_handle hh;
int block_no;
}; };
static struct block *blocks = NULL; static struct block *blocks = NULL;
@ -2811,6 +2812,11 @@ static inline bool from_existing_block(struct work *work)
return ret; return ret;
} }
static int block_sort(struct block *blocka, struct block *blockb)
{
return blocka->block_no - blockb->block_no;
}
static void test_work_current(struct work *work) static void test_work_current(struct work *work)
{ {
char *hexstr; char *hexstr;
@ -2828,29 +2834,31 @@ static void test_work_current(struct work *work)
* new block and set the current block details to this one */ * new block and set the current block details to this one */
if (!block_exists(hexstr)) { if (!block_exists(hexstr)) {
struct block *s = calloc(sizeof(struct block), 1); struct block *s = calloc(sizeof(struct block), 1);
int deleted_block = 0;
if (unlikely(!s)) if (unlikely(!s))
quit (1, "test_work_current OOM"); quit (1, "test_work_current OOM");
strcpy(s->hash, hexstr); strcpy(s->hash, hexstr);
s->block_no = new_blocks++;
wr_lock(&blk_lock); wr_lock(&blk_lock);
/* Only keep the last 6 blocks in memory since work from blocks /* Only keep the last hour's worth of blocks in memory since
* before this is virtually impossible and we want to prevent * work from blocks before this is virtually impossible and we
* memory usage from continually rising */ * want to prevent memory usage from continually rising */
if (HASH_COUNT(blocks) > 5) { if (HASH_COUNT(blocks) > 6) {
struct block *blocka, *blockb; struct block *oldblock;
int count = 0;
HASH_SORT(blocks, block_sort);
HASH_ITER(hh, blocks, blocka, blockb) { oldblock = blocks;
if (count++ < 6) deleted_block = oldblock->block_no;
continue; HASH_DEL(blocks, oldblock);
HASH_DEL(blocks, blocka); free(oldblock);
free(blocka);
}
} }
HASH_ADD_STR(blocks, hash, s); HASH_ADD_STR(blocks, hash, s);
wr_unlock(&blk_lock); wr_unlock(&blk_lock);
if (deleted_block)
applog(LOG_DEBUG, "Deleted block %d from database", deleted_block);
set_curblock(hexstr, work->data); set_curblock(hexstr, work->data);
if (unlikely(++new_blocks == 1)) if (unlikely(new_blocks == 1))
goto out_free; goto out_free;
work_block++; work_block++;

2
configure.ac

@ -2,7 +2,7 @@
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--## ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_define([v_maj], [2]) m4_define([v_maj], [2])
m4_define([v_min], [7]) m4_define([v_min], [7])
m4_define([v_mic], [4]) m4_define([v_mic], [5])
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--## ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_define([v_ver], [v_maj.v_min.v_mic]) m4_define([v_ver], [v_maj.v_min.v_mic])
m4_define([lt_rev], m4_eval(v_maj + v_min)) m4_define([lt_rev], m4_eval(v_maj + v_min))

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;

2
miner.h

@ -352,7 +352,7 @@ struct cgpu_info {
int threads; int threads;
struct thr_info **thr; struct thr_info **thr;
unsigned int max_hashes; int64_t max_hashes;
const char *kname; const char *kname;
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL

8
ocl.c

@ -393,7 +393,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
strstr(vbuff, "831.4") || strstr(vbuff, "831.4") ||
strstr(vbuff, "898.1") || // 12.2 driver SDK strstr(vbuff, "898.1") || // 12.2 driver SDK
strstr(vbuff, "923.1") || // 12.4 strstr(vbuff, "923.1") || // 12.4
strstr(vbuff, "938.1"))) { // SDK 2.7 strstr(vbuff, "938.2"))) { // SDK 2.7
applog(LOG_INFO, "Selecting diablo kernel"); applog(LOG_INFO, "Selecting diablo kernel");
clState->chosen_kernel = KL_DIABLO; clState->chosen_kernel = KL_DIABLO;
/* Detect all 7970s, older ATI and NVIDIA and use poclbm */ /* Detect all 7970s, older ATI and NVIDIA and use poclbm */
@ -411,7 +411,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
if (clState->chosen_kernel == KL_PHATK && if (clState->chosen_kernel == KL_PHATK &&
(strstr(vbuff, "844.4") || strstr(vbuff, "851.4") || (strstr(vbuff, "844.4") || strstr(vbuff, "851.4") ||
strstr(vbuff, "831.4") || strstr(vbuff, "898.1") || strstr(vbuff, "831.4") || strstr(vbuff, "898.1") ||
strstr(vbuff, "923.1") || strstr(vbuff, "938.1"))) { strstr(vbuff, "923.1") || strstr(vbuff, "938.2"))) {
applog(LOG_WARNING, "WARNING: You have selected the phatk kernel."); applog(LOG_WARNING, "WARNING: You have selected the phatk kernel.");
applog(LOG_WARNING, "You are running SDK 2.6+ which performs poorly with this kernel."); applog(LOG_WARNING, "You are running SDK 2.6+ which performs poorly with this kernel.");
applog(LOG_WARNING, "Downgrade your SDK and delete any .bin files before starting again."); applog(LOG_WARNING, "Downgrade your SDK and delete any .bin files before starting again.");
@ -468,12 +468,8 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
clState->wsize = cgpu->work_size; clState->wsize = cgpu->work_size;
else if (strstr(name, "Tahiti")) else if (strstr(name, "Tahiti"))
clState->wsize = 64; clState->wsize = 64;
else {
if (strstr(name, "Cypress"))
clState->wsize = 256;
else else
clState->wsize = (clState->max_work_size <= 256 ? clState->max_work_size : 256) / clState->vwidth; clState->wsize = (clState->max_work_size <= 256 ? clState->max_work_size : 256) / clState->vwidth;
}
cgpu->work_size = clState->wsize; cgpu->work_size = clState->wsize;
#ifdef USE_SCRYPT #ifdef USE_SCRYPT

Loading…
Cancel
Save