4 Replies Latest reply: Aug 26, 2010 4:28 PM by nythrix RSS

Stream 2.2 broke callback into managed code (FIXED)

nythrix Newbie
Currently Being Moderated

Hi,

I'm the maintainer of the Cloo project (http://sourceforge.net/projects/cloo/). After upgrading my ATI Stream installation to v2.2 (from v2.01), two things stopped working:

a) clBuildProgram() if a notify function is given (works with null) and

b) clEnqueueNDRangeKernel() if an event list is specified (also works with null).

It might be a bug on my side although I can jump back and forward between the two versions of Stream and reproduce the issues only on one of them.

I should point out that the project is a .NET wrapper, which may or may not be important. Perhaps you've changed something in your callback mechanisms? Because clSetEventCallback fails too (AccessViolationException). However, I'm not 100% that's Stream's fault, so let's focus on a) and b) for now.

I'm conducting the tests on an Intel CPU (SSE3 capable). Catalyst not present.

I could post some code if it helps you. It's not C/C++ though (surprisingly).

  • Stream 2.2 broke callback into managed code
    Illusio Newbie
    Currently Being Moderated

    b) Is likely some issue with your code. OpenCL.Net runs through all variations of clEnqueueNDRangeKernel with event lists, no event lists and event outputs in its unit tester and has no issues.

    SetEventCallback works there as well.

     

  • Stream 2.2 broke callback into managed code
    jeff_golds Novice
    Currently Being Moderated

     

    Originally posted by: nythrix Hi,

     

    I'm the maintainer of the Cloo project (http://sourceforge.net/projects/cloo/). After upgrading my ATI Stream installation to v2.2 (from v2.01), two things stopped working:

     

    a) clBuildProgram() if a notify function is given (works with null) and



    You need to add "CL_CALLBACK" to the function definition.  For example:

    static void CL_CALLBACK notify_callback(...)

    If you look in the header files, you will see:

    extern CL_API_ENTRY cl_int CL_API_CALL
    clBuildProgram(cl_program           /* program */,
                   cl_uint              /* num_devices */,
                   const cl_device_id * /* device_list */,
                   const char *         /* options */,
                   void (CL_CALLBACK *  /* pfn_notify */)(cl_program /* program */, void * /* user_data */),
                   void *               /* user_data */) CL_API_SUFFIX__VERSION_1_0;

    And in cl_platform.h you will find:

    #if defined(_WIN32)
    #define CL_API_ENTRY
    #define CL_API_CALL __stdcall
        #define CL_CALLBACK     __stdcall
    #else
    #define CL_API_ENTRY
    #define CL_API_CALL
        #define CL_CALLBACK
    #endif

    Jeff

     

    Jeff Golds

    AMD, Inc.

    The information presented in this document is for informational purposes only and may contain technical inaccuracies, omissions and typographical errors. Links to third party sites are for convenience only, and no endorsement is implied.

  • Stream 2.2 broke callback into managed code
    nythrix Newbie
    Currently Being Moderated

    Indeed, changing from UnmanagedFunctionPointer(CallingConvention.Cdecl) to StdCall does work in both cases (clBuildProgram and clSetEventCallback).

    Also clEnqueueNDRange is mysteriously working again. And I never touched it. I must've hit a weak spot in the drivers running the tests one after another. Very odd...

    Much appreciated, guys. You've been very helpful indeed!

More Like This