|
|
@ -1490,6 +1490,7 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work, |
|
|
|
_clState *clState = clStates[thr_id]; |
|
|
|
_clState *clState = clStates[thr_id]; |
|
|
|
const cl_kernel *kernel = &clState->kernel; |
|
|
|
const cl_kernel *kernel = &clState->kernel; |
|
|
|
const int dynamic_us = opt_dynamic_interval * 1000; |
|
|
|
const int dynamic_us = opt_dynamic_interval * 1000; |
|
|
|
|
|
|
|
struct timeval tv_gpuend; |
|
|
|
cl_bool blocking; |
|
|
|
cl_bool blocking; |
|
|
|
|
|
|
|
|
|
|
|
cl_int status; |
|
|
|
cl_int status; |
|
|
@ -1508,13 +1509,17 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work, |
|
|
|
clFinish(clState->commandQueue); |
|
|
|
clFinish(clState->commandQueue); |
|
|
|
|
|
|
|
|
|
|
|
if (gpu->dynamic) { |
|
|
|
if (gpu->dynamic) { |
|
|
|
struct timeval diff; |
|
|
|
double gpu_us; |
|
|
|
suseconds_t gpu_us; |
|
|
|
|
|
|
|
|
|
|
|
/* Windows returns the same time for gettimeofday due to its
|
|
|
|
gettimeofday(&gpu->tv_gpuend, NULL); |
|
|
|
* 15ms timer resolution, so we must average the result over |
|
|
|
timersub(&gpu->tv_gpuend, &gpu->tv_gpustart, &diff); |
|
|
|
* at least 5 values that are actually different to get an |
|
|
|
gpu_us = diff.tv_sec * 1000000 + diff.tv_usec; |
|
|
|
* accurate result */ |
|
|
|
if (likely(gpu_us >= 0)) { |
|
|
|
gpu->intervals++; |
|
|
|
|
|
|
|
gettimeofday(&tv_gpuend, NULL); |
|
|
|
|
|
|
|
gpu_us = us_tdiff(&tv_gpuend, &gpu->tv_gpumid); |
|
|
|
|
|
|
|
if (gpu_us > 0 && ++gpu->hit > 4) { |
|
|
|
|
|
|
|
gpu_us = us_tdiff(&tv_gpuend, &gpu->tv_gpustart) / gpu->intervals; |
|
|
|
gpu->gpu_us_average = (gpu->gpu_us_average + gpu_us * 0.63) / 1.63; |
|
|
|
gpu->gpu_us_average = (gpu->gpu_us_average + gpu_us * 0.63) / 1.63; |
|
|
|
|
|
|
|
|
|
|
|
/* Try to not let the GPU be out for longer than
|
|
|
|
/* Try to not let the GPU be out for longer than
|
|
|
@ -1527,6 +1532,7 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work, |
|
|
|
if (gpu->intensity < MAX_INTENSITY) |
|
|
|
if (gpu->intensity < MAX_INTENSITY) |
|
|
|
++gpu->intensity; |
|
|
|
++gpu->intensity; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
gpu->intervals = gpu->hit = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
set_threads_hashes(clState->vwidth, &threads, &hashes, globalThreads, |
|
|
|
set_threads_hashes(clState->vwidth, &threads, &hashes, globalThreads, |
|
|
@ -1562,7 +1568,11 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work, |
|
|
|
clFinish(clState->commandQueue); |
|
|
|
clFinish(clState->commandQueue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
gettimeofday(&gpu->tv_gpustart, NULL); |
|
|
|
gettimeofday(&gpu->tv_gpumid, NULL); |
|
|
|
|
|
|
|
if (!gpu->intervals) { |
|
|
|
|
|
|
|
gpu->tv_gpustart.tv_sec = gpu->tv_gpumid.tv_sec; |
|
|
|
|
|
|
|
gpu->tv_gpustart.tv_usec = gpu->tv_gpumid.tv_usec; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (clState->goffset) { |
|
|
|
if (clState->goffset) { |
|
|
|
size_t global_work_offset[1]; |
|
|
|
size_t global_work_offset[1]; |
|
|
|