Commit fee870b5d1f2a682f888787fdce308e567bdc6ab

Kano 2012-08-23T18:10:05

Merge remote-tracking branch 'conman/master'

diff --git a/NEWS b/NEWS
index d9730c7..adf0a2e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,34 @@
+Version 2.7.3 - August 22, 2012
+
+- Minimise the number of getwork threads we generate.
+
+
+Version 2.7.2 - August 22, 2012
+
+- Pick worksize 256 with Cypress if none is specified.
+- Give warning with sdk2.7 and phatk as well.
+- Whitelist sdk2.7 for diablo kernel as well.
+- Only keep the last 6 blocks in the uthash database to keep memory usage
+constant. Storing more is unhelpful anyway.
+- BFL Flash - always distribute source
+- Increase kernel versions signifying changed APIs.
+- BFL flash - include source in builds and more FPGA-README
+- Check we haven't staged work while waiting for a curl entry before proceeding.
+- Use atomic ops to never miss a nonce on opencl kernels, including nonce==0,
+also allowing us to make the output buffer smaller.
+- Remove compile errors/warnings and document compile/usage in FPGA-README
+- bitforce-firmware-flash.c by Luke-jr
+- Ignore the submit_fail flag when deciding whether to recruit more curls or not
+since we have upper bounds on how many curls can be recruited, this test is
+redundant and can lead to problems.
+- API-README update cgminer version number
+- API-README fix groups P: example mistake
+- API-README add COIN and other edits
+- gpu->hit should be reset on new work as well.
+- Do not add time to dynamic opencl calculations over a getwork.
+- miner.php allow 'coin' is custom pages
+
+
 Version 2.7.1 - August 21, 2012
 
 - Update windows build instructions courtesy of sharky.
@@ -42,7 +73,6 @@ openCL patch by Nite69. Add virtual adl mapping for when none is specified o
 - miner.php show summary Diff1 Shares total
 - miner.php fix Work Utility totals
 - miner.php format new Work Utility and Diff1 Shares
-- Merge pull request #299 from kanoi/api
 - API V1.17 show Work Utility and Diff1 Shares
 
 
diff --git a/cgminer.c b/cgminer.c
index 5b15e85..29362c9 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -187,6 +187,7 @@ int hw_errors;
 int total_accepted, total_rejected, total_diff1;
 int total_getworks, total_stale, total_discarded;
 static int total_queued, staged_rollable;
+static int queued_getworks;
 unsigned int new_blocks;
 static unsigned int work_block;
 unsigned int found_blocks;
@@ -2460,6 +2461,9 @@ out:
 	workio_cmd_free(wc);
 	if (ce)
 		push_curl_entry(ce, pool);
+	mutex_lock(&control_lock);
+	queued_getworks--;
+	mutex_unlock(&control_lock);
 	return NULL;
 }
 
@@ -3922,7 +3926,17 @@ static void pool_resus(struct pool *pool)
 static bool queue_request(struct thr_info *thr, bool needed)
 {
 	struct workio_cmd *wc;
+	bool doq = true;
 
+	mutex_lock(&control_lock);
+	if (queued_getworks > (mining_threads + opt_queue) * 2)
+		doq = false;
+	else
+		queued_getworks++;
+	mutex_unlock(&control_lock);
+	if (!doq)
+		return true;
+	
 	/* fill out work request message */
 	wc = calloc(1, sizeof(*wc));
 	if (unlikely(!wc)) {
diff --git a/configure.ac b/configure.ac
index 7b1f0e2..7ee4885 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 m4_define([v_maj], [2])
 m4_define([v_min], [7])
-m4_define([v_mic], [1])
+m4_define([v_mic], [3])
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 m4_define([v_ver], [v_maj.v_min.v_mic])
 m4_define([lt_rev], m4_eval(v_maj + v_min))
diff --git a/ocl.c b/ocl.c
index 9e9ef02..7bf606c 100644
--- a/ocl.c
+++ b/ocl.c
@@ -392,7 +392,8 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
 			 strstr(vbuff, "851.4") ||  // Windows 64 bit ""
 			 strstr(vbuff, "831.4") ||
 			 strstr(vbuff, "898.1") ||  // 12.2 driver SDK 
-			 strstr(vbuff, "923.1"))) { // 12.4 driver SDK
+			 strstr(vbuff, "923.1") ||  // 12.4
+			 strstr(vbuff, "938.1"))) { // SDK 2.7
 				applog(LOG_INFO, "Selecting diablo kernel");
 				clState->chosen_kernel = KL_DIABLO;
 		/* Detect all 7970s, older ATI and NVIDIA and use poclbm */
@@ -410,9 +411,9 @@ _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, "923.1") || strstr(vbuff, "938.1"))) {
 			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, "Or allow cgminer to automatically choose a more suitable kernel.");
 		}
@@ -467,8 +468,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
 		clState->wsize = cgpu->work_size;
 	else if (strstr(name, "Tahiti"))
 		clState->wsize = 64;
-	else
-		clState->wsize = (clState->max_work_size <= 256 ? clState->max_work_size : 256) / clState->vwidth;
+	else {
+		if (strstr(name, "Cypress"))
+			clState->wsize = 256;
+		else
+			clState->wsize = (clState->max_work_size <= 256 ? clState->max_work_size : 256) / clState->vwidth;
+	}
 	cgpu->work_size = clState->wsize;
 
 #ifdef USE_SCRYPT