|
|
@ -1346,6 +1346,7 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work, |
|
|
|
struct cgpu_info *gpu = thr->cgpu; |
|
|
|
struct cgpu_info *gpu = thr->cgpu; |
|
|
|
_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; |
|
|
|
|
|
|
|
|
|
|
|
cl_int status; |
|
|
|
cl_int status; |
|
|
|
size_t globalThreads[1]; |
|
|
|
size_t globalThreads[1]; |
|
|
@ -1353,30 +1354,31 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work, |
|
|
|
unsigned int threads; |
|
|
|
unsigned int threads; |
|
|
|
unsigned int hashes; |
|
|
|
unsigned int hashes; |
|
|
|
|
|
|
|
|
|
|
|
gettimeofday(&gpu->tv_gpustart, NULL); |
|
|
|
|
|
|
|
/* This finish flushes the readbuffer set with CL_FALSE later */ |
|
|
|
/* This finish flushes the readbuffer set with CL_FALSE later */ |
|
|
|
clFinish(clState->commandQueue); |
|
|
|
clFinish(clState->commandQueue); |
|
|
|
gettimeofday(&gpu->tv_gpuend, NULL); |
|
|
|
gettimeofday(&gpu->tv_gpuend, NULL); |
|
|
|
|
|
|
|
|
|
|
|
if (gpu->dynamic) { |
|
|
|
if (gpu->dynamic) { |
|
|
|
struct timeval diff; |
|
|
|
struct timeval diff; |
|
|
|
suseconds_t gpu_ms; |
|
|
|
suseconds_t gpu_us; |
|
|
|
|
|
|
|
|
|
|
|
timersub(&gpu->tv_gpuend, &gpu->tv_gpustart, &diff); |
|
|
|
timersub(&gpu->tv_gpuend, &gpu->tv_gpustart, &diff); |
|
|
|
gpu_ms = diff.tv_sec * 1000 + diff.tv_usec / 1000; |
|
|
|
gpu_us = diff.tv_sec * 1000000 + diff.tv_usec; |
|
|
|
gpu->gpu_ms_average = (gpu->gpu_ms_average + gpu_ms * 0.63) / 1.63; |
|
|
|
if (likely(gpu_us > 0)) { |
|
|
|
|
|
|
|
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 6ms, but
|
|
|
|
|
|
|
|
* increase intensity when the system is idle, unless |
|
|
|
/* Try to not let the GPU be out for longer than
|
|
|
|
* dynamic is disabled. */ |
|
|
|
* opt_dynamic_interval in ms, but increase |
|
|
|
if (gpu->gpu_ms_average > opt_dynamic_interval) { |
|
|
|
* intensity when the system is idle in dynamic mode */ |
|
|
|
|
|
|
|
if (gpu->gpu_us_average > dynamic_us) { |
|
|
|
if (gpu->intensity > MIN_INTENSITY) |
|
|
|
if (gpu->intensity > MIN_INTENSITY) |
|
|
|
--gpu->intensity; |
|
|
|
--gpu->intensity; |
|
|
|
} else if (gpu->gpu_ms_average < ((opt_dynamic_interval / 2) ? : 1)) { |
|
|
|
} else if (gpu->gpu_us_average < dynamic_us / 2) { |
|
|
|
if (gpu->intensity < MAX_INTENSITY) |
|
|
|
if (gpu->intensity < MAX_INTENSITY) |
|
|
|
++gpu->intensity; |
|
|
|
++gpu->intensity; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
set_threads_hashes(clState->vwidth, &threads, &hashes, globalThreads, |
|
|
|
set_threads_hashes(clState->vwidth, &threads, &hashes, globalThreads, |
|
|
|
localThreads[0], gpu->intensity); |
|
|
|
localThreads[0], gpu->intensity); |
|
|
|
if (hashes > gpu->max_hashes) |
|
|
|
if (hashes > gpu->max_hashes) |
|
|
@ -1408,6 +1410,8 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work, |
|
|
|
clFinish(clState->commandQueue); |
|
|
|
clFinish(clState->commandQueue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gettimeofday(&gpu->tv_gpustart, NULL); |
|
|
|
|
|
|
|
|
|
|
|
if (clState->goffset) { |
|
|
|
if (clState->goffset) { |
|
|
|
size_t global_work_offset[1]; |
|
|
|
size_t global_work_offset[1]; |
|
|
|
|
|
|
|
|
|
|
|