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. 12
      ocl.c

19
NEWS

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

2
configure.ac

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

2
miner.h

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

12
ocl.c

@ -393,7 +393,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -393,7 +393,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
strstr(vbuff, "831.4") ||
strstr(vbuff, "898.1") || // 12.2 driver SDK
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");
clState->chosen_kernel = KL_DIABLO;
/* Detect all 7970s, older ATI and NVIDIA and use poclbm */
@ -411,7 +411,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -411,7 +411,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
if (clState->chosen_kernel == KL_PHATK &&
(strstr(vbuff, "844.4") || strstr(vbuff, "851.4") ||
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, "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.");
@ -468,12 +468,8 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -468,12 +468,8 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
clState->wsize = cgpu->work_size;
else if (strstr(name, "Tahiti"))
clState->wsize = 64;
else {
if (strstr(name, "Cypress"))
clState->wsize = 256;
else
clState->wsize = (clState->max_work_size <= 256 ? clState->max_work_size : 256) / clState->vwidth;
}
else
clState->wsize = (clState->max_work_size <= 256 ? clState->max_work_size : 256) / clState->vwidth;
cgpu->work_size = clState->wsize;
#ifdef USE_SCRYPT

Loading…
Cancel
Save