Results 1 to 3 of 3

Thread: OpenCL C++ Bindings and premature program deallocation

  1. #1

    OpenCL C++ Bindings and premature program deallocation

    Hello, I hope this is the right place for C++ bindings improvements.

    The current C++ headers allow for a possible premature destruction of program objects before the kernels using them have been destroyed.

    When a kernel is created from a program object, it does not increment the program objects ref counter. If the program object goes out of scope (let's say you had a single compilation function) before the kernel object this might cause trouble.

    I haven't noticed this as an error in my programs on ATI/NVidia's platforms but Gremedy certainly reports it as an OpenCL error.

    Marcus

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: OpenCL C++ Bindings and premature program deallocation

    When a kernel is created from a program object, it does not increment the program objects ref counter. If the program object goes out of scope (let's say you had a single compilation function) before the kernel object this might cause trouble.
    It is not necessary to explicitly increment the ref counter in the program each time a new kernel is created. This happens automatically. A program will stay alive as long as at least one of its kernels is alive.

    This is explained in section 5.7.1: "clCreateKernel or clCreateKernelsInProgram do an implicit retain."

    Please file a bug on GRemedy's tool.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3

    Re: OpenCL C++ Bindings and premature program deallocation

    Ah thanks for clarifying that for me and sorry for the bad post.
    Marcus

Similar Threads

  1. OpenCL C++ Bindings
    By oddhack in forum OpenCL
    Replies: 99
    Last Post: 09-20-2011, 10:57 AM
  2. OpenCL C# bindings
    By The Fiddler in forum OpenCL
    Replies: 1
    Last Post: 08-11-2009, 03:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •