Andreas Kloeckner <[email protected]> writes:
> - Partial implementation is totally fine, but if I can crash the
>   implementation through a CL call, I'd call that a bug. I found a couple
>   of those. I'll report them.

I've attached a diff fixing a few little issues I found while fixing
pyopencl+pocl (against latest bzr). I've also added enough quirks to the
pyopencl test suite (latest git) that the thing at least runs to
completion without crashing (with this patch applied).

Andreas

=== modified file 'lib/CL/clGetProgramInfo.c'
--- lib/CL/clGetProgramInfo.c	2012-12-07 02:14:25 +0000
+++ lib/CL/clGetProgramInfo.c	2013-05-27 02:15:46 +0000
@@ -22,6 +22,7 @@
 */
 
 #include "pocl_cl.h"
+#include "pocl_util.h"
 #include <string.h>
 
 CL_API_ENTRY cl_int CL_API_CALL
@@ -34,6 +35,13 @@
   int i;
   switch (param_name)
   {
+  case CL_PROGRAM_REFERENCE_COUNT:
+    POCL_RETURN_GETINFO( cl_uint, (cl_uint)program->pocl_refcount );
+    break;
+  case CL_PROGRAM_CONTEXT:
+    POCL_RETURN_GETINFO( cl_context, program->context );
+    break;
+
   case CL_PROGRAM_SOURCE:
     {
       size_t const value_size = strlen(program->source) + 1;

=== modified file 'lib/CL/clGetSupportedImageFormats.c'
--- lib/CL/clGetSupportedImageFormats.c	2012-12-07 02:14:25 +0000
+++ lib/CL/clGetSupportedImageFormats.c	2013-05-27 02:54:33 +0000
@@ -37,18 +37,26 @@
   for (i=0; i<supported_order_count; i++)
     for (j=0; j<supported_type_count; j++)
       {
-        if (idx >= num_entries)
-          return CL_SUCCESS;
-        
-        image_formats[idx].image_channel_order = supported_orders[i];
-        image_formats[idx].image_channel_data_type = supported_types[j];
+        if (image_formats && idx < num_entries)
+        {
+          image_formats[idx].image_channel_order = supported_orders[i];
+          image_formats[idx].image_channel_data_type = supported_types[j];
+        }
         
         idx++;
       }
       
-   // Add special cases here if a channel order is supported with only some types or vice versa.
-   *num_image_formats = idx;
-   
-   return CL_SUCCESS;
+  // Add special cases here if a channel order is supported with only some types or vice versa.
+  if (num_image_formats)
+  {
+    // CL Standard:
+    //
+    // num_image_formats is the actual number of supported image formats for a
+    // specific context and values specified by flags. If num_image_formats is
+    // NULL, it is ignored.
+    *num_image_formats = idx;
+  }
+  
+  return CL_SUCCESS;
 }
 POsym(clGetSupportedImageFormats)

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
pocl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pocl-devel

Reply via email to