PDA

View Full Version : Re-using cl_event objects for event_wait_list pointers



apakal
01-20-2010, 08:38 AM
Once an event_wait_list pointer is passed to a clEnqueue* function (and the function returns CL_SUCCESS) can the cl_event objects pointed to by event_wait_list be re-assigned to new events, or should none of them be touched until all commands enqueued with that wait list have finished?

For example, say I wanted to enqueue pairs of kernels in a loop (kernel B depends kernel A):



cl_command_queue queue;
size_t gws, lws;
cl_kernel kernel_A, kernel_B;
...
cl_event e;
for(int i = 0; i < N; ++i) {
clEnqueueNDRangeKernel(queue, kernel_A, 1, NULL, &gws, &lws, 0, NULL, &e);
clEnqueueNDRangeKernel(queue, kernel_B, 1, NULL, &gws, &lws, 1, &e, NULL);
clReleaseEvent(e);
}


Is this code safe? Or will re-using the cl_event handle corrupt the existing wait lists?

dbs2
01-20-2010, 10:52 AM
That should be fine as far as I know. I've done things like that without problems on Mac OS X, at least.