|
Bugzilla – 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> |
| Severity: | normal | ||
| Priority: | P3 | CC: | bgaster, sschuberth |
| Version: | 1.0 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: |
demonstrate reference counting bug
proposed patch for reference counting bug |
||
|
Description
Markus Grabner
2010-04-26 08:41:16 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. Created attachment 40 [details]
demonstrate reference counting bug
This is a known problem and something we are working on, unlike many of the other bugs it does not have a straightforward solution. 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 :-) 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 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())
This post says reference counting was fixed: http://www.khronos.org/message_boards/viewtopic.php?p=7692#p7692 Can the OP confirm? Reference counting is fixed and so closing. |