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

Bug#787952: jessie-pu: package ocl-icd/2.2.3-1



Package: release.debian.org
Severity: normal
Tags: jessie
User: release.debian.org@packages.debian.org
Usertags: pu

  Hi,

  As upstream of ocl-icd, we just discovered an annoying bug for all ocl-icd
version from 2.2.0 (included) to 2.2.5 (excluded, bug fixed).

  ocl-icd builds the libOpenCL.so.1 library that is a kind of stub library that
dispatch OpenCL calls to real OpenCL implementation (available as ICD).
  Due to this bug, the clSVMFree function (and only it) is not dispatched at
all. So, if any OpenCL program calls clSVMFree, it is as if there was no call
at all.

  I just uploaded a package to sid (2.2.5-1) that fixes this bug (#787941).
However, I would like a pre-approuval to prepare a package for jessie with only
this bug fix.

  The patch that will be applied to the jessie version will be a backport of
this one:
===================
diff --git a/icd_generator.rb b/icd_generator.rb
index 61d7e4b..3c3f0a8 100644
--- a/icd_generator.rb
+++ b/icd_generator.rb
@@ -580,12 +580,13 @@ EOF
       error_handler.call
       ocl_icd_loader_gen_source += "  }\n"
       if return_type != "void" then
-        ocl_icd_loader_gen_source += "  RETURN(((struct _#{fps[0]} *)#{fps[1]})->dispatch->#{func_name}("
-        ocl_icd_loader_gen_source += ps.join(", ")
-        ocl_icd_loader_gen_source += "));\n"
+        return_debug="RETURN"
       else
-        ocl_icd_loader_gen_source += "  return;"
+        return_debug="return"
       end
+      ocl_icd_loader_gen_source += "  #{return_debug}(((struct _#{fps[0]} *)#{fps[1]})->dispatch->#{func_name}("
+      ocl_icd_loader_gen_source += ps.join(", ")
+      ocl_icd_loader_gen_source += "));\n"
       ocl_icd_loader_gen_source += "}\n\n"
     }
     ocl_icd_loader_gen_source += "#pragma GCC visibility push(hidden)\n\n"
===================

  Note that most code of the libOpenCL.so library from ocl-icd is auto-generated
at build time. The previous fix is in the generator script. For a better understanding,
this fix leads to the following difference in the compiled code:
===================
$ diff -u7 ../../../build-area/ocl-icd-2.2.4/ocl_icd_loader_gen.c ocl_icd_loader_gen.c 
--- ../../../build-area/ocl-icd-2.2.4/ocl_icd_loader_gen.c	2015-06-06 17:43:52.686800886 +0200
+++ ocl_icd_loader_gen.c	2015-06-06 17:55:53.510141219 +0200
@@ -1407,15 +1407,16 @@
 CL_API_ENTRY void CL_API_CALL
 clSVMFree(cl_context         context ,
           void *             svm_pointer ){
   debug_trace();
   if( (struct _cl_context *)context == NULL) {
     return;
   }
-  return;}
+  return(((struct _cl_context *)context)->dispatch->clSVMFree(context, svm_pointer));
+}
 
 CL_API_ENTRY cl_int CL_API_CALL
 clEnqueueSVMFree(cl_command_queue   command_queue ,
                  cl_uint            num_svm_pointers ,
                  void *             svm_pointers[] ,
                  void (CL_CALLBACK * pfn_free_func)(cl_command_queue  queue ,
                                                         cl_uint           num_svm_pointers ,
===================
You can see that, now, the clSVMFree call is correctly dispatched to the ICD instead
of being a noop.

Only the clSVMFree function is impacted because this is the only one having a "void"
return type (that is handled a bit differently in the generator script)


  So, if you agree, I will prepare a ocl-icd for jessie with (only) this bug fix.


  Regards,
    Vincent


Reply to: