Khronos public bugtracker – Full Text Bug Listing
|Summary:||cl.hpp: reference counting bug|
|Product:||OpenCL||Reporter:||Markus Grabner <markus.grabner>|
|Component:||Header Files||Assignee:||Neil Trevett <ntrevett>|
|Status:||RESOLVED FIXED||QA Contact:||OpenCL Working Group <opencl>|
demonstrate reference counting bug
proposed patch for reference counting bug
Description Markus Grabner 2010-04-26 08:41:16 PDT
<Please comment on your experience with the C++ bindings to OpenCL 1.0 here, including any bugs you encounter as well as suggestions for improvement. If you are having problems, please try to provide a complete example including source code demonstrating the problem as well as describing the OS, C++ compiler, and compiler options used.>
Comment 1 Markus Grabner 2010-04-26 08:51:28 PDT
(In reply to comment #0) > <Please comment on your experience with the C++ bindings to OpenCL 1.0 here, > including any bugs you encounter as well as suggestions for improvement. If > you are having problems, please try to provide a complete example including > source code demonstrating the problem as well as describing the OS, C++ > compiler, and compiler options used.> Sorry, didn't expect that clicking the back button discards the text, so here it is: cl::CommandQueue::getInfo<CL_QUEUE_CONTEXT>() doesn't increase the reference count of the cl::Context object returned by this method. This results in a program crash when the destructur is called for the unreferenced instance. The problem probably exists for other getInfo<...> variants since the code is shared. This file demonstrates the problem. The program crashes in ReferenceHandler<cl_context>::release(), which is invoked from cl::Context::~Context(). If the context's reference count is increased explicitly (by setting "#if 1" in line 47), the program finishes without error.
Comment 2 Markus Grabner 2010-04-26 08:52:30 PDT
Created attachment 40 [details] demonstrate reference counting bug
Comment 3 Benedict Gaster 2010-04-26 10:40:45 PDT
This is a known problem and something we are working on, unlike many of the other bugs it does not have a straightforward solution.
Comment 4 Markus Grabner 2010-04-27 03:26:53 PDT
I see. Is there a public discussion on this issue elsewhere? I would like to contribute since the workaround I'm currently using is quite ugly :-)
Comment 5 Benedict Gaster 2010-04-27 10:41:10 PDT
There is general discussion of the C++ bindings on the OpenCL forum here: http://www.khronos.org/message_boards/viewtopic.php?f=28&t=1415
Comment 6 Markus Grabner 2010-05-03 11:38:03 PDT
Created attachment 41 [details] proposed patch for reference counting bug This is a proposed patch for this issue: *) define a template function "fixReferenceCount()" which does nothing *) overload this function for all relevant types (e.g., cl::Context), and call their retain() method *) call "fixReferenceCount()" for data returned by the native OpenCL functions (in GetInfoHelper::get())
Comment 7 Sebastian Schuberth 2011-01-07 07:08:21 PST
This post says reference counting was fixed: http://www.khronos.org/message_boards/viewtopic.php?p=7692#p7692 Can the OP confirm?
Comment 8 Benedict Gaster 2011-08-30 09:17:08 PDT
Reference counting is fixed and so closing.