admin管理员组文章数量:1422048
OpenCL command queues' enqueue API functions typically take a sequence of dependency events. For example:
cl_int clEnqueueCopyBuffer(
cl_command_queue command_queue,
cl_mem src_buffer,
cl_mem dst_buffer,
size_t src_offset,
size_t dst_offset,
size_t size,
cl_uint num_events_in_wait_list, // <--- Note this
const cl_event* event_wait_list, // <--- Note this
cl_event* event);
(the last parameter is an output event - that of the enqueued barrier being reached).
Well, the thing is, a command queue can also have a barrier enqueued, depending on a bunch of events:
cl_int clEnqueueBarrierWithWaitList(
cl_command_queue command_queue,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
So, if we want to perform operation, like the buffer copy, and have it depend on events events
, we can just do:
clEnqueueBarrierWithWaitList(my_queue, n, events, nullptr);
clEnqueueCopyBuffer(
src_buffer, dst_buffer, src_offset, dst_offset, size,
0, nullptr, nullptr);
i.e. the event_wait_list
specification seems completely redundant - a two-actions-in-one-API-call type thing. And we have this same pair of arguments for most/all other enqueue API functions.
My question is: Why? What is the use in having this second avenue for specifying dependencies, making the code more complex and repetitive?
本文标签:
版权声明:本文标题:dependencies - Why do OpenCL enqueue API functions take event lists, when we can enqueue a barrier? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745356419a2655080.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论