Browse Source

Only support thread-per-device or N-threads-per-processor; simplify work_restart check

Luke Dashjr 13 years ago
parent
commit
709181de25
2 changed files with 4 additions and 22 deletions
  1. 3 3
      HACKING
  2. 1 19
      miner.c

+ 3 - 3
HACKING

@@ -39,10 +39,10 @@ function with it as an argument. Various values you can initialize are:
 	.api         This MUST be set to your driver's `struct driver_api`!
 	.api         This MUST be set to your driver's `struct driver_api`!
 	.deven       Should be set to DEV_ENABLED
 	.deven       Should be set to DEV_ENABLED
 	.procs       Number of Processors for this device
 	.procs       Number of Processors for this device
-	.threads     Number of threads your device needs - should be either an even
+	.threads     Number of threads your device needs - should be either a
 	             multiple of .procs (threads will be allocated to each
 	             multiple of .procs (threads will be allocated to each
-	             Processor), or a number less than .procs (threads will be
-	             allocated only to the Device, to manage all Processors)
+	             Processor), or one (a single thread will be allocated only to
+	             the Device, to manage all Processors)
 	.name        Null-terminated name of the device itself
 	.name        Null-terminated name of the device itself
 `api_detect` should return the total number of devices created. It should leave
 `api_detect` should return the total number of devices created. It should leave
 the device in an unused state, as the user may opt to delete it outright.
 the device in an unused state, as the user may opt to delete it outright.

+ 1 - 19
miner.c

@@ -6757,31 +6757,13 @@ void minerloop_async(struct thr_info *mythr)
 	int proc_thr_no;
 	int proc_thr_no;
 	
 	
 	while (1) {
 	while (1) {
-		if (unlikely(cgpu->thr[0]->work_restart)) {
-			for (proc = cgpu; proc; proc = proc->next_proc)
-			{
-				for (proc_thr_no = proc->threads ?: 1; proc_thr_no--; )
-				{
-					mythr = proc->thr[proc_thr_no];
-					mythr->work_restart = true;
-					if ((!proc_thr_no) || mythr->primary_thread)
-						timerclear(&mythr->tv_morework);
-					else
-						/* Apart from device_thread 0, we stagger the
-						 * starting of every next thread to try and get
-						 * all devices busy before worrying about
-						 * getting work for their extra threads */
-						timer_set_delay_from_now(&mythr->tv_morework, 250000 * proc_thr_no);
-				}
-			}
-		}
 		tv_timeout.tv_sec = -1;
 		tv_timeout.tv_sec = -1;
 		gettimeofday(&tv_now, NULL);
 		gettimeofday(&tv_now, NULL);
 		for (proc = cgpu; proc; proc = proc->next_proc)
 		for (proc = cgpu; proc; proc = proc->next_proc)
 		{
 		{
 			mythr = proc->thr[0];
 			mythr = proc->thr[0];
 			
 			
-			if (timercmp(&mythr->tv_morework, &tv_now, <))
+			if (unlikely(mythr->work_restart) || timercmp(&mythr->tv_morework, &tv_now, <))
 			{
 			{
 				thread_reportin(mythr);
 				thread_reportin(mythr);
 				prev_job_work = mythr->work;
 				prev_job_work = mythr->work;