Results 1 to 3 of 3

Thread: Error in opencl-1.1.pdf ?

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    2

    Error in opencl-1.1.pdf ?

    I am reading opencl-1.1.pdf. In page 143, there is sample like this:
    NOTE: Enqueued commands that specify user events in the event_wait_list argument of
    clEnqueue*** commands must ensure that the status of these user events being waited on are set
    using clSetUserEventStatus before any OpenCL APIs that release OpenCL objects except for
    event objects are called; otherwise the behavior is undefined.
    For example, the following code sequence will result in undefined behavior of
    clReleaseMemObject.
    ev1 = clCreateUserEvent(ctx, NULL);
    clEnqueueWriteBuffer(cq, buf1, CL_FALSE, ...,
    1, &ev1, NULL);
    clEnqueueWriteBuffer(cq, buf2, CL_FALSE,...);
    clReleaseMemObject(buf2);
    clSetUserEventStatus(ev1, CL_COMPLETE);

    According to the Note message, I wonder if the example should be like this:
    ev1 = clCreateUserEvent(ctx, NULL);
    clEnqueueWriteBuffer(cq, buf1, CL_FALSE, ...,
    1, &ev1, NULL);
    clEnqueueWriteBuffer(cq, buf2, CL_FALSE,...);
    clReleaseMemObject(buf1);
    clSetUserEventStatus(ev1, CL_COMPLETE);

    Since buf2 does not wait any user event, there is no side effect if it is released before ev1 is set as CL_COMPLETE.

    Am I right?

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

    Re: Error in opencl-1.1.pdf ?

    I think the example in the spec is doing that intentionally.

    buf2 depends on the user event transitively: the first call to clEnqueueWriteBuffer() depends on the user event directly and the second call to clEnqueueWriteBuffer() depends implicitly on the previous call, and therefore it depends on the user event implicitly as well.
    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
    Junior Member
    Join Date
    Sep 2011
    Posts
    2

    Re: Error in opencl-1.1.pdf ?

    But what if cq is out-of-order execution?

Similar Threads

  1. fatal error C1189: #error : ERROR: Use of C runtime library
    By gjermani in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 09-24-2007, 03:02 AM
  2. An error in the OpenML specification( PDF BOOK )
    By ehsan2004 in forum OpenML Coding & Technical Issues
    Replies: 0
    Last Post: 06-22-2006, 08:48 AM

Posting Permissions

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