From d55bcc38127ab9c5aab001ce46593e218f8ef8f9 Mon Sep 17 00:00:00 2001 From: dirk Date: Fri, 22 Apr 2016 17:43:02 +0200 Subject: [PATCH] Disabled caching of command queues when profile_kernels is enabled. --- MagickCore/opencl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MagickCore/opencl.c b/MagickCore/opencl.c index 7ff1cf08a..6f5c2624d 100644 --- a/MagickCore/opencl.c +++ b/MagickCore/opencl.c @@ -568,7 +568,8 @@ MagickPrivate cl_command_queue AcquireOpenCLCommandQueue(MagickCLDevice device) assert(device != (MagickCLDevice) NULL); LockSemaphoreInfo(device->lock); device->created_queues++; - if (device->command_queues_index >= 0) + if ((device->profile_kernels == MagickFalse) && + (device->command_queues_index >= 0)) { queue=device->command_queues[device->command_queues_index--]; UnlockSemaphoreInfo(device->lock); @@ -1765,8 +1766,10 @@ MagickExport const KernelProfileRecord *GetOpenCLKernelProfileRecords( if (length != (size_t *) NULL) { *length=0; + LockSemaphoreInfo(device->lock); while (device->profile_records[*length] != (KernelProfileRecord) NULL) *length=*length+1; + UnlockSemaphoreInfo(device->lock); } return(device->profile_records); } @@ -2508,7 +2511,8 @@ MagickPrivate void RelinquishOpenCLCommandQueue(MagickCLDevice device, assert(device != (MagickCLDevice) NULL); LockSemaphoreInfo(device->lock); device->created_queues--; - if (device->command_queues_index >= MAGICKCORE_OPENCL_COMMAND_QUEUES-1) + if ((device->profile_kernels == MagickFalse) || + (device->command_queues_index >= MAGICKCORE_OPENCL_COMMAND_QUEUES-1)) (void) openCL_library->clReleaseCommandQueue(queue); else device->command_queues[++device->command_queues_index]=queue; -- 2.40.0