cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

branch
Journeyman III

Possible bug in commandQueue synchronization routines?

flush and enqueueWaitForEvents seem not to work

When the following code is executed after commandQueue::enqueueReadBuffer, the following output is produced:

Begin:          Queued
Flush:          Queued
WaitForEvents:  Queued
Wait:           Complete
Finish:         Complete

The status of the event corresponds to whether data is actually valid in the buffer, ie. if i read the buffer after enqueueWaitForEvents() the data is garbage, but if i read it after Event::wait() the data is correct.  According to my understanding, status after flush() should be Submitted, and status after enqueuWaitForEvents() should be Complete.

This result is the same regardless of whether the commandQueue is bound to the CPU or the GPU.  Any comments or insights would be welcome.

System: OS = RHEL 5.5; ATI Stream SDK Version = 2.2; Driver = Catalyst 10.9 with 09/27 hotfix; CPU = AMD Phenom II X4 945; GPU = ATI RV730;

std::vector<cl::Event> read_eventv(1, read_event); fprintf(stderr, "Begin:\t\t"); print_event_status(read_event); queue.flush(); fprintf(stderr, "Flush:\t\t"); print_event_status(read_event); queue.enqueueWaitForEvents(read_eventv); fprintf(stderr, "WaitForEvents:\t"); print_event_status(read_event); read_event.wait(); fprintf(stderr, "Wait:\t\t"); print_event_status(read_event); queue.finish(); fprintf(stderr, "Finish:\t\t"); print_event_status(read_event);

0 Likes
3 Replies
LeeHowes
Staff

I haven't double checked the spec by I would imagine the following:

Enqueue wait for events enqueues an event. After that event has happened the data will be valid. The enqueue is still asynchronous, though and is only enqueuing a test not actually waiting itself.

0 Likes

Ok.  Yes, you are correct, i didn't read carefully enough. enqueueWaitEvents only serves as synchronization with other queue operations, not the host process.

What about flush()?

 

0 Likes

flush tells the runtime to start packaging the data up to send to the device. It doesn't wait for that to happen or for the work to finish.

0 Likes