|
|
@ -422,7 +422,9 @@ vg_ocl_hash_program(vg_ocl_context_t *vocp, const char *opts, |
|
|
|
MD5_Update(&ctx, str, strlen(str) + 1); |
|
|
|
MD5_Update(&ctx, str, strlen(str) + 1); |
|
|
|
str = vg_ocl_device_getstr(vocp->voc_ocldid, CL_DEVICE_NAME); |
|
|
|
str = vg_ocl_device_getstr(vocp->voc_ocldid, CL_DEVICE_NAME); |
|
|
|
MD5_Update(&ctx, str, strlen(str) + 1); |
|
|
|
MD5_Update(&ctx, str, strlen(str) + 1); |
|
|
|
|
|
|
|
if (opts) |
|
|
|
MD5_Update(&ctx, opts, strlen(opts) + 1); |
|
|
|
MD5_Update(&ctx, opts, strlen(opts) + 1); |
|
|
|
|
|
|
|
if (size) |
|
|
|
MD5_Update(&ctx, program, size); |
|
|
|
MD5_Update(&ctx, program, size); |
|
|
|
MD5_Final(hash_out, &ctx); |
|
|
|
MD5_Final(hash_out, &ctx); |
|
|
|
} |
|
|
|
} |
|
|
@ -616,7 +618,8 @@ vg_ocl_context_callback(const char *errinfo, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int |
|
|
|
int |
|
|
|
vg_ocl_init(vg_context_t *vcp, vg_ocl_context_t *vocp, cl_device_id did) |
|
|
|
vg_ocl_init(vg_context_t *vcp, vg_ocl_context_t *vocp, cl_device_id did, |
|
|
|
|
|
|
|
int safe_mode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
cl_int ret; |
|
|
|
cl_int ret; |
|
|
|
const char *vend, *options; |
|
|
|
const char *vend, *options; |
|
|
@ -633,7 +636,7 @@ vg_ocl_init(vg_context_t *vcp, vg_ocl_context_t *vocp, cl_device_id did) |
|
|
|
if (vcp->vc_verbose > 1) |
|
|
|
if (vcp->vc_verbose > 1) |
|
|
|
vg_ocl_dump_info(vocp); |
|
|
|
vg_ocl_dump_info(vocp); |
|
|
|
|
|
|
|
|
|
|
|
if (!vg_ocl_check_driver(vocp)) { |
|
|
|
if (!vg_ocl_check_driver(vocp) && (vcp->vc_verbose > 0)) { |
|
|
|
char yesbuf[16]; |
|
|
|
char yesbuf[16]; |
|
|
|
printf("Type 'yes' to continue: "); |
|
|
|
printf("Type 'yes' to continue: "); |
|
|
|
fflush(stdout); |
|
|
|
fflush(stdout); |
|
|
@ -661,9 +664,12 @@ vg_ocl_init(vg_context_t *vcp, vg_ocl_context_t *vocp, cl_device_id did) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
options = "-DUNROLL_MAX=16"; |
|
|
|
options = "-DUNROLL_MAX=16"; |
|
|
|
|
|
|
|
|
|
|
|
vend = vg_ocl_device_getstr(did, CL_DEVICE_VENDOR); |
|
|
|
vend = vg_ocl_device_getstr(did, CL_DEVICE_VENDOR); |
|
|
|
if (!strcmp(vend, "Advanced Micro Devices, Inc.") || |
|
|
|
|
|
|
|
|
|
|
|
if (safe_mode) { |
|
|
|
|
|
|
|
options = NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (!strcmp(vend, "Advanced Micro Devices, Inc.") || |
|
|
|
!strcmp(vend, "AMD")) { |
|
|
|
!strcmp(vend, "AMD")) { |
|
|
|
/* Radeons do better with less flow control */ |
|
|
|
/* Radeons do better with less flow control */ |
|
|
|
options = "-DUNROLL_MAX=16 -DVERY_EXPENSIVE_BRANCHES"; |
|
|
|
options = "-DUNROLL_MAX=16 -DVERY_EXPENSIVE_BRANCHES"; |
|
|
@ -1335,8 +1341,8 @@ out: |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
void * |
|
|
|
void * |
|
|
|
vg_opencl_loop(vg_context_t *vcp, cl_device_id did, int worksize, |
|
|
|
vg_opencl_loop(vg_context_t *vcp, cl_device_id did, int safe_mode, |
|
|
|
int nrows, int ncols, int invsize) |
|
|
|
int worksize, int nrows, int ncols, int invsize) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
int round, full_worksize; |
|
|
|
int round, full_worksize; |
|
|
@ -1363,7 +1369,7 @@ vg_opencl_loop(vg_context_t *vcp, cl_device_id did, int worksize, |
|
|
|
|
|
|
|
|
|
|
|
struct timeval tvstart; |
|
|
|
struct timeval tvstart; |
|
|
|
|
|
|
|
|
|
|
|
if (!vg_ocl_init(vcp, &ctx, did)) |
|
|
|
if (!vg_ocl_init(vcp, &ctx, did, safe_mode)) |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
|
|
pkey = vxcp->vxc_key; |
|
|
|
pkey = vxcp->vxc_key; |
|
|
@ -1983,11 +1989,12 @@ main(int argc, char **argv) |
|
|
|
int nrows = 0, ncols = 0; |
|
|
|
int nrows = 0, ncols = 0; |
|
|
|
int invsize = 0; |
|
|
|
int invsize = 0; |
|
|
|
int remove_on_match = 1; |
|
|
|
int remove_on_match = 1; |
|
|
|
|
|
|
|
int safe_mode = 0; |
|
|
|
vg_context_t *vcp = NULL; |
|
|
|
vg_context_t *vcp = NULL; |
|
|
|
cl_device_id did; |
|
|
|
cl_device_id did; |
|
|
|
const char *result_file = NULL; |
|
|
|
const char *result_file = NULL; |
|
|
|
|
|
|
|
|
|
|
|
while ((opt = getopt(argc, argv, "vqrikNTp:d:w:g:b:h?f:o:s:")) != -1) { |
|
|
|
while ((opt = getopt(argc, argv, "vqrikNTp:d:w:g:b:Sh?f:o:s:")) != -1) { |
|
|
|
switch (opt) { |
|
|
|
switch (opt) { |
|
|
|
case 'v': |
|
|
|
case 'v': |
|
|
|
verbose = 2; |
|
|
|
verbose = 2; |
|
|
@ -2049,6 +2056,9 @@ main(int argc, char **argv) |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'S': |
|
|
|
|
|
|
|
safe_mode = 1; |
|
|
|
|
|
|
|
break; |
|
|
|
case 'f': |
|
|
|
case 'f': |
|
|
|
if (fp) { |
|
|
|
if (fp) { |
|
|
|
printf("Multiple files specified\n"); |
|
|
|
printf("Multiple files specified\n"); |
|
|
@ -2161,6 +2171,7 @@ main(int argc, char **argv) |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
vg_opencl_loop(vcp, did, worksize, nrows, ncols, invsize); |
|
|
|
vg_opencl_loop(vcp, did, safe_mode, |
|
|
|
|
|
|
|
worksize, nrows, ncols, invsize); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|