Basic support for concurrency in OpenCL engine.

This commit is contained in:
samr7
2012-07-25 21:30:24 -07:00
parent 06af705498
commit c21e99a58b
4 changed files with 183 additions and 177 deletions

View File

@@ -1571,7 +1571,6 @@ vg_ocl_prefix_check(vg_ocl_context_t *vocp, int slot)
found_delta, orig_delta);
res = 1;
}
vocp->voc_pattern_rewrite = 1;
} else {
vxcp->vxc_delta += (vocp->voc_ocl_cols * vocp->voc_ocl_rows);
}
@@ -1879,6 +1878,7 @@ vg_opencl_loop(void *arg)
vg_ocl_context_t *vocp = (vg_ocl_context_t *) arg;
int i;
int round, nrows, ncols;
int pattern_generation;
const BN_ULONG rekey_max = 100000000;
BN_ULONG npoints, rekey_at;
@@ -1991,6 +1991,10 @@ l_rekey:
!vocp->voc_rekey_func(vocp))
goto enomem;
vg_exec_context_upgrade_lock(vxcp);
pattern_generation = vcp->vc_pattern_generation;
/* Generate a new random private key */
EC_KEY_generate_key(pkey);
npoints = 0;
@@ -2007,6 +2011,8 @@ l_rekey:
EC_POINT_copy(ppbase[0], EC_KEY_get0_public_key(pkey));
vg_exec_context_downgrade_lock(vxcp);
if (vcp->vc_pubkey_base) {
EC_POINT_add(pgroup,
ppbase[0],
@@ -2076,6 +2082,15 @@ l_rekey:
vg_output_timing(vcp, c, &tvstart);
c = 0;
}
vg_exec_context_yield(vxcp);
/* If the patterns changed, reload it to the GPU */
if (vocp->voc_rekey_func &&
(pattern_generation !=
vcp->vc_pattern_generation)) {
vocp->voc_pattern_rewrite = 1;
rekey_at = 0;
}
}
if (vcp->vc_halt)
@@ -2176,6 +2191,8 @@ l_rekey:
printf("done!\n");
}
vg_exec_context_yield(vxcp);
if (ppbase) {
for (i = 0; i < (nrows + ncols); i++)
if (ppbase[i])