[gegl] operations/transform: flush cl caches before threaded transform



commit 8b7e7bf5f780638a7ba583218afbfb0010288ca9
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Oct 31 12:55:57 2017 +0100

    operations/transform: flush cl caches before threaded transform
    
    There is a race condition due to each creation of sampler per thread flushing
    the opencl buffer caches in parallel, doing a pre-emptive flush when opencl
    accelerated makes sure the race doesnt need to happen.
    
    Fixing bug #789690

 operations/transform/transform-core.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/operations/transform/transform-core.c b/operations/transform/transform-core.c
index 7b99610..88d82b7 100644
--- a/operations/transform/transform-core.c
+++ b/operations/transform/transform-core.c
@@ -33,6 +33,8 @@
 #include <gegl.h>
 #include <gegl-plugin.h>
 
+#include "buffer/gegl-buffer-cl-cache.h"
+
 #include "gegl-config.h"
 
 #include "transform-core.h"
@@ -1200,6 +1202,11 @@ gegl_transform_process (GeglOperation        *operation,
       input  = gegl_operation_context_get_source (context, "input");
       output = gegl_operation_context_get_target (context, "output");
 
+      /* flush opencl caches, to avoid racy flushing
+       */
+      if (gegl_cl_is_accelerated ())
+        gegl_buffer_cl_cache_flush (input, NULL);
+
       if (gegl_operation_use_threading (operation, result))
       {
         gint threads = gegl_config_threads ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]