From 79a4e25742824c5b2c534e76a6a81de780e6541a Mon Sep 17 00:00:00 2001 From: ckolivas Date: Tue, 26 Jun 2012 11:12:13 +1000 Subject: [PATCH] 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. --- driver-opencl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/driver-opencl.c b/driver-opencl.c index 17be40ae..0571a145 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];