OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1663 Discussions

any difference between clEnqueueBarrierWithWaitList and clEnqueueMarkerWithWaitList?

dang__zhaiwei
Beginner
431 Views

anyone can help explain the difference about these 2 APIs in OPENCL1.2, clEnqueueMarkerWithWaitList() and clEnqueueBarrierWithWaitList()?

test running is  on Intel(R) OpenCL 2.1 LINUX, and it seems they are totally the same in behvavior.

0 Kudos
1 Reply
Ben_A_Intel
Employee
431 Views

Yeah, the difference is very subtle.

For reference:

https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/clEnqueueMarkerWithWaitList.html

https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/clEnqueueBarrierWithWaitList.html

In short, if a barrier and a wait list are used in an in-order command queue, there is no difference, since there is an implied dependency between commands in an in-order command queue.

There is a difference in an out-of-order command queue though.

In an out-of-order command queue, a marker can be used to indicate that some number of previously enqueued commands are complete, but it doesn't necessarily affect any subsequently enqueued commands.  In particular, a subsequently enqueued command may start before the marker completes, absent any other dependencies.

By contrast, a barrier both indicates that some number of previously enqueued commands are complete and prevents any subsequently enqueued commands from starting until the barrier is complete.  One way to think about this is that there is an implied dependency between a barrier and subsequently enqueued commands.  This implied dependency does not exist for a marker.

Note that even with this distinction, there's no guarantee that an implementation will implement a barrier and a marker differently.  The marker allows additional opportunities for concurrent execution, but does not require it.

I hope this helps - please don't hesitate to ask follow-on questions.  Thanks!

Reply