Browse Source

Titan flush optimization: Send works to all dies after flush

Pelle Nilsson 11 years ago
parent
commit
1cb4417901
3 changed files with 8 additions and 25 deletions
  1. 6 23
      driver-titan.c
  2. 1 1
      titan-asic.c
  3. 1 1
      titan-asic.h

+ 6 - 23
driver-titan.c

@@ -575,6 +575,7 @@ static void knc_titan_poll(struct thr_info * const thr)
 	struct timeval tv_now, tv_prev;
 	bool any_was_flushed = false;
 	int num_request_busy;
+	bool fpga_status_checked = false;
 
 	knc_titan_prune_local_queue(thr);
 	timer_set_now(&tv_prev);
@@ -600,32 +601,14 @@ static void knc_titan_poll(struct thr_info * const thr)
 							work_accepted = true;
 						}
 					} else {
-						/* Use unicasts */
-						bool work_acc_arr[die_p->cores];
-						for (proc = first_proc; proc; proc = proc->next_proc) {
-							mythr = proc->thr[0];
-							core1 = mythr->cgpu_data;
-							if ((core1->dieno != die) || (core1->asicno != asic))
-								break;
-							work_acc_arr[core1->coreno] = false;
+						/* Use FPGA accelerated unicasts */
+						if (!fpga_status_checked) {
+							knc_titan_get_work_status(first_proc->device->dev_repr, knc->ctx, asic, &num_request_busy);
+							fpga_status_checked = true;
 						}
-						knc_titan_get_work_status(first_proc->device->dev_repr, knc->ctx, asic, &num_request_busy);
 						if (num_request_busy == 0) {
-							if (knc_titan_set_work_parallel(first_proc->device->dev_repr, knc->ctx, asic, 1 << die, 0, die_p->next_slot, work, true, work_acc_arr, die_p->cores, KNC_TITAN_FPGA_RETRIES)) {
+							if (knc_titan_set_work_parallel(first_proc->device->dev_repr, knc->ctx, asic, 1 << die, 0, die_p->next_slot, work, true, die_p->cores, KNC_TITAN_FPGA_RETRIES)) {
 								work_accepted = true;
-								for (proc = first_proc; proc; proc = proc->next_proc) {
-									mythr = proc->thr[0];
-									core1 = mythr->cgpu_data;
-									if ((core1->dieno != die) || (core1->asicno != asic))
-										break;
-									if (work_acc_arr[core1->coreno]) {
-										/* Submit stale shares just in case we are working with multi-coin pool
-										 * and those shares still might be useful (merged mining case etc) */
-										/* if (knc_titan_process_report(knc, core1, &(reports[core1->coreno]))) */
-										/* 	timer_set_now(&(die_p->last_share)); */
-										work_accepted = true;
-									}
-								}
 							}
 						}
 					}

+ 1 - 1
titan-asic.c

@@ -172,7 +172,7 @@ bool knc_titan_setup_spi(const char *repr, void * const ctx, int asic, int divid
 	return true;
 }
 
-bool knc_titan_set_work_parallel(const char *repr, void * const ctx, int asic, int die, int core_start, int slot, struct work *work, bool urgent, bool *work_accepted, int num, int resend)
+bool knc_titan_set_work_parallel(const char *repr, void * const ctx, int asic, int die, int core_start, int slot, struct work *work, bool urgent, int num, int resend)
 {
 	uint8_t request[9 + BLOCK_HEADER_BYTES_WITHOUT_NONCE];
 	int request_length;

+ 1 - 1
titan-asic.h

@@ -38,7 +38,7 @@ bool knc_titan_set_work_multi(const char *repr, void * const ctx, int channel, i
 bool knc_titan_get_report(const char *repr, void * const ctx, int channel, int die, int core, struct knc_report *report);
 bool knc_titan_setup_core_local(const char *repr, void * const ctx, int channel, int die, int core, struct titan_setup_core_params *params);
 bool knc_titan_setup_spi(const char *repr, void * const ctx, int asic, int divider, int preclk, int declk, int sslowmin);
-bool knc_titan_set_work_parallel(const char *repr, void * const ctx, int asic, int die, int core_start, int slot, struct work *work, bool urgent, bool *work_accepted, int num, int resend);
+bool knc_titan_set_work_parallel(const char *repr, void * const ctx, int asic, int die, int core_start, int slot, struct work *work, bool urgent, int num, int resend);
 bool knc_titan_get_work_status(const char *repr, void * const ctx, int asic, int *num_request_busy);
 
 #endif /* __TITAN_ASIC_H */