[gegl/gsoc2011-opencl-2: 12/17] Set OpenCL tile size property as a square



commit 84aba8156b611bbe7f225f533f6a0874b15c98df
Author: Victor Oliveira <victormatheus gmail com>
Date:   Fri Nov 18 16:58:20 2011 -0200

    Set OpenCL tile size property as a square

 gegl/opencl/gegl-cl-init.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index 127028e..7a126d4 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -169,10 +169,14 @@ gegl_cl_init (GError **error)
       gegl_clGetDeviceInfo (cl_state.device, CL_DEVICE_IMAGE2D_MAX_WIDTH,  sizeof(size_t),   &cl_state.max_image_width,  NULL);
       gegl_clGetDeviceInfo (cl_state.device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof(cl_ulong), &cl_state.max_mem_alloc,    NULL);
 
+      cl_state.max_image_width  = MIN(cl_state.max_image_width, cl_state.max_image_height);
+      cl_state.max_image_height = MIN(cl_state.max_image_width, cl_state.max_image_height);
+
       g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "[OpenCL] Platform Name:%s",       cl_state.platform_name);
       g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "[OpenCL] Version:%s",             cl_state.platform_version);
       g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "[OpenCL] Extensions:%s",          cl_state.platform_ext);
       g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "[OpenCL] Default Device Name:%s", cl_state.device_name);
+      g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "[OpenCL] Tile Dimensions: (%d, %d)", cl_state.max_image_width, cl_state.max_image_height);
 
       if (cl_state.image_support)
         {
@@ -202,6 +206,10 @@ gegl_cl_init (GError **error)
     }
 
   cl_state.is_accelerated = TRUE;
+
+  /* XXX: this dict is being leaked */
+  cl_program_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
   return TRUE;
 }
 
@@ -243,6 +251,10 @@ gegl_cl_compile_and_build (const char *program_source, const char *kernel_name[]
           free(err_msg);
           return NULL;
         }
+      else
+        {
+          g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "[OpenCL] Compiling successful\n");
+        }
 
       for (i=0; i<kernel_n; i++)
         CL_SAFE_CALL( cl_data->kernel[i] =



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