Opencl code may start executing before the clfinish order is given to it so get the start timing used for dynamic intensity from before the kernel is queued.
diff --git a/driver-opencl.c b/driver-opencl.c
index 17be40a..0571a14 100644
--- a/driver-opencl.c
+++ b/driver-opencl.c
@@ -1353,7 +1353,6 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work,
unsigned int threads;
unsigned int hashes;
- gettimeofday(&gpu->tv_gpustart, NULL);
/* This finish flushes the readbuffer set with CL_FALSE later */
clFinish(clState->commandQueue);
gettimeofday(&gpu->tv_gpuend, NULL);
@@ -1372,7 +1371,7 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work,
if (gpu->gpu_ms_average > opt_dynamic_interval) {
if (gpu->intensity > MIN_INTENSITY)
--gpu->intensity;
- } else if (gpu->gpu_ms_average < ((opt_dynamic_interval / 2) ? : 1)) {
+ } else if (gpu->gpu_ms_average < (float)opt_dynamic_interval / 2) {
if (gpu->intensity < MAX_INTENSITY)
++gpu->intensity;
}
@@ -1408,6 +1407,8 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work,
clFinish(clState->commandQueue);
}
+ gettimeofday(&gpu->tv_gpustart, NULL);
+
if (clState->goffset) {
size_t global_work_offset[1];